Published
Edited
May 27, 2021
Insert cell
md`# Soha Circles`
Insert cell
html `<div id = "dots"><\div>`
Insert cell
drawChart()
Insert cell
drawChart = function(){

let svg = d3.select("#dots")
.append("svg")
.attr("width",width)
.attr("height",height);
var simulation = d3.forceSimulation(nodes)
.force('charge', d3.forceManyBody())
.force("x", d3.forceX())
.force("y", d3.forceY())
.force("center", d3.forceCenter());

let node = svg.append("g")
.selectAll("circle")
.data(nodes)
.join("circle")
.attr("cx", d => Math.random()*width)
.attr("cy", d => Math.random()*height)
.attr("r", 2)
.attr("fill", "blue")
.attr("fill-opacity", 1);

}
Insert cell
width = 300
Insert cell
height = 300
Insert cell
Insert cell
d3 = require("d3@6")
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