Published
Edited
Mar 1, 2022
23 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
preset = {
let values = new Map();
const url = new URL(document.baseURI);
try {
values = new Map(
Object.entries(d3.autoType(Object.fromEntries([...url.searchParams])))
);
} catch (e) {}
return (name, defaultValue) =>
values.has(name) ? values.get(name) : defaultValue;
}
Insert cell
presetUrl = {
const url = new URL(document.baseURI);
Object.entries({
buffer,
randomize,
orientation,
curve,
stroke,
bottomColor,
topColor,
backgroundColor
}).forEach(kv => url.searchParams.set(kv[0], kv[1]));
return '' + url;
}
Insert cell
Insert cell
viewof buffer = Inputs.toggle({
label: 'Border Cells',
value: preset('buffer', false)
})
Insert cell
viewof randomize = Inputs.toggle({
label: 'Randomize',
value: preset('randomize', true)
})
Insert cell
viewof orientation = Inputs.select(['Left', 'Top', 'Right', 'Bottom'], {
label: 'Path Orientation',
value: preset('orientation', 'Top')
})
Insert cell
viewof curve = Inputs.select(
new Map([
['Basis', 'curveBasisClosed'],
['BumpX', 'curveBumpX'],
['BumpY', 'curveBumpY'],
['Bundle', 'curveBundle'],
['Cardinal', 'curveCardinal'],
['Linear', 'curveLinear'],
['MonotoneX', 'curveMonotoneX'],
['MonotoneY', 'curveMonotoneY'],
['Natural', 'curveNatural'],
['Step', 'curveStep']
]),
{
label: 'Curve Type',
value: preset('curve', 'curveBasisClosed')
}
)
Insert cell
viewof stroke = Inputs.select(['None', 'Reverse', 'Black', 'White'], {
label: 'Stroke Type',
value: preset('stroke', 'Reverse')
})
Insert cell
viewof bottomColor = Inputs.text({
type: "color",
value: preset('bottomColor', "#4d4193"),
label: "Bottom Color"
})
Insert cell
viewof topColor = Inputs.text({
type: "color",
value: preset("topColor", "#60c96e"),
label: "Top Color"
})
Insert cell
viewof backgroundColor = Inputs.text({
type: "color",
value: preset("backgroundColor", "#ecddc8"),
label: "Background Color"
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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