Published
Edited
Oct 11, 2019
1 fork
Insert cell
Insert cell
chart = {
return svg.node()
}
Insert cell
d3.schemeOranges[9].map(c => dotSwatch(c))
Insert cell
function dotSwatch(color) {
svg.append("circle")
.attr("width", 50)
.attr("height", 50)
.attr("cx", d3.randomUniform(0, width)())
.attr("cy", d3.randomUniform(0, height)())
.attr("r", d3.randomUniform(10, 50)())
.style("fill", color)
}
Insert cell
d3 = require("d3")
Insert cell
height = Math.min(width, 400)
Insert cell
svg = d3.create("svg")
.attr("align", "center")
.attr("viewBox", [0, 0, width, height])
// .attr("viewBox", [-width / 2, -height / 2, width, height])
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