Published
Edited
Jul 9, 2020
Insert cell
Insert cell
Insert cell
viewof selected = {
let e = DOM.element("div");
let s = DOM.select(Object.keys(data));
e.appendChild(s);
let c = null;
s.onchange = () => {
if(c) e.removeChild(c);
c = DOM.select(data[s.value]);
e.appendChild(c);
c.onchange = () => {
e.value = {state: s.value, county: c.value};
e.dispatchEvent(new CustomEvent('input'))
};

c.onchange();
}
s.onchange();
return e;
}
Insert cell
selected
Insert cell
data = ({
A: ['A1', 'A2', 'A3'],
B: ['B1', 'B2', 'B3'],
C: ['C1', 'C2', 'C3']
})
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