Public
Edited
Jan 23, 2023
3 forks
Insert cell
Insert cell
height = 100

Insert cell
viewof maxLeafHeight = Inputs.range([50, 100], {value: 80, step: 1, label: "maximum leaf height"})
Insert cell
viewof maxLeafWidth = Inputs.range([35, 100], {value: 45, step: 1, label: "maximum leaf width"})

Insert cell
chart = {
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height);

// get initial sizes from inputs

let x = 30;
while (x < (width + maxLeafWidth)) {
drawLeaf(x, svg);
x += maxLeafWidth * 1.5;
}
return svg.node();
}
Insert cell
Insert cell
Insert cell
chartPoints = {
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height + 10);

drawLeaf(30, svg, true);

return svg.node()
}
Insert cell
Insert cell
chartRotate = {
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height);

// get initial sizes from inputs
let x = 30;
while (x < (width + maxLeafWidth)) {
drawLeaf(x, svg, false, true); // don't show points, do rotate
x += maxLeafWidth * 1.5;
}
return svg.node();
}
Insert cell
Insert cell
leafSkew = {
const svg = d3.create("svg")
.attr("width", width * 2)
.attr("height", height * 4); // needs more height somehow because of skewing

// get initial sizes from inputs
let x = 30;
while (x < (width + maxLeafWidth)) {
drawLeaf(x, svg, false, false, true); // don't show points, don't rotate, do skew
x += maxLeafWidth * 1.5;
}
return svg.node();
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more