Published
Edited
May 22, 2020
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof categories = select(xDomain)
Insert cell
basic_map = {
const svg = d3
.create("svg")
.attr("width", 6000)
.attr("height", 600);
// Paths
const paths = svg
.selectAll("g")
.data(topojson.feature(us, us.objects.states).features)
.join("path")
.style("stroke", "white")
.style("fill", d => {
if (state.includes(d.properties.name)) {
var color_value = nested_data
.find(state => state.key == d.properties.name)
.values.find(x => x.key == categories).value;
}
return color_scale(color_value); // Any type of scale
})
.attr("d", d => path(d));

return svg.node();
}
Insert cell
Insert cell
Insert cell
height = 1000
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_ = require("lodash")
Insert cell
d = require("d3-array@^2.2")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more