Public
Edited
Jan 24, 2023
Paused
Fork of Dashboard
1 fork
Importers
26 stars
Insert cell
Insert cell
Insert cell
display
Insert cell
Insert cell
options = {
const view = form(htl.html`<form>
<label>Size: <input name=width type=number min=200 step=50 value=400 max=1000 style=width:auto> x <input name=height type=number min=200 step=50 value=300 max=1000 style=width:auto></label><hr style=margin:0>
<label style=display:flex>Pad: <input name=pad type=range min=0 max=200 value=50 step=1 style=width:100%></label><hr style=margin:0>
<label style=display:flex><input name=colorize type=checkbox> Single color</label>
`);
display('controls', view, invalidation);
return Generators.input(view);
}
Insert cell
color = {
if(!options.colorize) return null;
const input = htl.html`<input type=color value=#ffffff>`;
display('optional', input, invalidation);
return Generators.input(input);
}
Insert cell
Insert cell
Insert cell
function dashboard(view) {
const regions = new Map(Array.from(view.querySelectorAll('[data-region]'), n => [n.dataset.region, {
node: n,
}]));
view.oninput = view.onchange = view.onclick = e => e.stopImmediatePropagation();
view.value = function(region, content, invalidate) {
const {node} = regions.get(region);
node.appendChild(content);
const remove = () => { if(content.parentNode === node) node.removeChild(content) };
if(invalidate) invalidate.then(remove);
return remove;
};
return view;
}
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