Public
Edited
Mar 27
Insert cell
Insert cell
count = 15
Insert cell
randNums = Array.from({length: count}, d3.randomInt(500))
Insert cell
mySVG = svg`<svg width="${width}" height="200" viewBox="0 0 ${width} 200"></svg>`

Insert cell
circles.filter(d => d > 300).style("fill", "orange")
Insert cell
svgCanvas = d3.select(mySVG)
Insert cell
text = svgCanvas.selectAll("text")
.data(randNums)
.join("text")
.transition().duration(1000)
.attr("x", (d,i) => d)
.attr("y", (d,i) => 15 + i * 10)
.text(d => d)
.style("text-anchor", "middle");
Insert cell
circles = svgCanvas.selectAll("circle")
.data(randNums)
.join("circle")
//.transition().duration(1000)
.attr("cx", (d,i) => d)
.attr("cy", (d,i) => 15 + i * 10)
.attr("r", d => d/10)
.style("fill", "none")
.style("stroke", "steelblue");
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