Published
Edited
Apr 26, 2022
Insert cell
Insert cell
Insert cell
svg`<svg width=${dimensions.displayWidth} height=${dimensions.displayHeight}>
${dotGrid1(10)}</svg>`
Insert cell
function dotGrid1(max) {
let lst = [];
for (let i = 0; i < max; i++) {
for (let j = 0; j < max; j++) {
lst.push(
svg.fragment`<circle cx=${i * 30 + 10} cy=${
j * 30 + 10
} r=10 fill="${d3.interpolateViridis(i / max)}" />`
);
}
}
return lst;
}
Insert cell
svg`<svg width=${dimensions.displayWidth} height=${dimensions.displayHeight}>
${dotGrid2(23, 17)}</svg>`
Insert cell
function dotGrid2(xMax, yMax) {
let lst = [];
for (let i = 0; i < xMax; i++) {
for (let j = 0; j < yMax; j++) {
let colr = d3.interpolateViridis(i / xMax);
lst.push(
svg.fragment`<circle cx=${i * 30 + r} cy=${
j * 30 + r
} r=${r} fill="${colr}" />`
);
}
}
return lst;
}
Insert cell
Insert cell
svg`<svg width=${dimensions.displayWidth} height=${dimensions.displayHeight}>
${dotGrid3(22, 16)}</svg>`
Insert cell
function dotGrid3(xMax, yMax) {
let lst = [];
for (let i = 0; i < xMax; i++) {
for (let j = 0; j < yMax; j++) {
let colr = d3.color(d3.interpolateViridis(i / xMax));
colr.opacity = 0.7;
lst.push(
svg.fragment`<circle cx=${i * 30 + r} cy=${
j * 30 + r
} r=${r} fill="${colr}" />`
);
}
}
return lst;
}
Insert cell
viewof dimensions = Inputs.radio(dimensionOptions, {
label: "Printing Dimensions (in.)",
format: (x) => x.name,
value: dimensionOptions[5]
})
Insert cell
Insert cell
scheme = [...Array(10).keys()].map((x) => d3.interpolateViridis(x / 10))
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