Published
Edited
Nov 6, 2021
13 forks
Importers
135 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chart2 = {
const svg = d3.create("svg")
.attr("width", diameter)
.attr("viewBox", [0, 0, diameter, diameter])
.style("max-width", "100%")
.style("cursor", "default");
// TimeSpiral needs getBBox()
document.body.append(svg.node());
const chart = new TimeSpiral(svg)
.size([diameter, diameter])
.style({
align: options2.align,
barWidth: options2.barwidth,
rounded: options2.rounded,
colorBy: options2.colorby,
showTicks: options2.showTicks,
tickInterval: "monthly"
})
.layers(+options2.layers)
.palette(options2.colorby === "time" ? d3.schemeTableau10 : d3.interpolateBuPu)
.field({value: `new${options.field}`})
.data(data("New York"))
.render();

svg.node().remove();
return svg.node();
}
Insert cell
Insert cell
Insert cell
chart3 = {
const svg = d3.create("svg")
.attr("width", diameter)
.attr("viewBox", [0, 0, diameter, diameter])
.style("max-width", "100%")
.style("cursor", "default");
// TimeSpiral needs getBBox()
document.body.append(svg.node());
const data = weather[options3.city].map(d => ({
date: new Date(d["Date time"]),
temp: +d["Temperature"]
}));
const chart = new TimeSpiral(svg)
.size([diameter, diameter])
.layers(3)
.style({
align: options3.align,
reverseColor: true // reverse d3.interpolateRdYlBu
})
.palette(d3.interpolateRdYlBu)
.field({value:"temp"})
.data(data)
.render();

svg.node().remove();
return svg.node();
}
Insert cell
Insert cell
chart4 = {
const svg = d3.create("svg")
.attr("width", diameter)
.attr("viewBox", [0, 0, diameter, diameter])
.style("max-width", "100%")
.style("cursor", "default");
// TimeSpiral needs getBBox()
document.body.append(svg.node());
const chart = new TimeSpiral(svg)
.size([diameter, diameter])
.layers(4)
.style({
align: "base",
colorBy: "time",
tickInterval: "auto",
titleFormat: "$,.2f"
})
.palette(d3.schemePaired)
.field({value:"value"})
.data(sample)
.render();

svg.node().remove();
return svg.node();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more