Published
Edited
Jun 9, 2021
1 star
Insert cell
Insert cell
Insert cell
function generateTree(idx, num) {
if (num === 1) {
return {id: idx, children:[]}
}
else {
let split = 1 + Math.floor((num - 1) * Math.random());
return {id: idx + split, children: [generateTree(idx, split), generateTree(idx + split + 1, num - split)]}
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
nCell = 5
Insert cell
config = ({
value: value,
squareSize: 35,
squareCol: '#de3d83',
squareBgd: 'red',
strokeCol: '#fff',
strokeWidth: 2,
margin: {
top: 5,
right: 5,
bottom: 5,
left: 5
}
})
Insert cell
import {slider} from "@jashkenas/inputs"
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