Published
Edited
Jan 8, 2020
1 fork
2 stars
Insert cell
Insert cell
{
const boxHeight = 300;
const svg = d3.create('svg').attr('viewBox', [0, 0, width, boxHeight]);

const nodes = [
{ x: 50, y: 50 },
{ x: 150, y: 50 },
{ x: 170, y: 200 },
{ x: 350, y: 175 },
{ x: 500, y: 100 }
];

// Append the nodes to the svg element
svg
.selectAll('circle')
.data(nodes)
.join('circle')
.attr('cx', d => d.x)
.attr('cy', d => d.y)
.attr('r', 20)
.style('fill', 'green');

return svg.node();
}
Insert cell
d3 = require('d3')
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