Public
Edited
Nov 10, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
var width = 300,
height = 300;
var nodes = [{}, {}, {}, {}, {}];

var simulation = d3
.forceSimulation(nodes)
.force("charge", d3.forceManyBody()) //.strength(-30))
.force("center", d3.forceCenter(width / 2, height / 2))
.on("tick", ticked);

function ticked() {
d3.select("#content1")
.select("svg")
.selectAll("circle")
.data(nodes)
.join("circle")
.attr("r", 5)
.attr("cx", function (d) {
return d.x;
})
.attr("cy", function (d) {
return d.y;
});
}
return "Code for example 1";
}
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