Public
Edited
Jan 9, 2024
18 stars
Insert cell
Insert cell
Insert cell
viewof colors = Inputs.checkbox(["red", "green", "blue"], {label: "color"})
Insert cell
colors
Insert cell
html`<div style="display: flex;">${colors.map(color => html`<div style="background-color: ${color}; width: 25px; height: 25px;">`)}`
Insert cell
Insert cell
teams = [
{name: "Lakers", location: "Los Angeles, California"},
{name: "Warriors", location: "San Francisco, California"},
{name: "Celtics", location: "Boston, Massachusetts"},
{name: "Nets", location: "New York City, New York"},
{name: "Raptors", location: "Toronto, Ontario"},
]
Insert cell
viewof watching = Inputs.checkbox(teams, {label: "Watching", format: x => x.name})
Insert cell
watching
Insert cell
Insert cell
viewof vowels = Inputs.checkbox([..."AEIOUY"], {label: "Vowel", disabled: ["Y"]})
Insert cell
vowels
Insert cell
Insert cell
viewof colors2 = Inputs.checkbox(["red", "green", "blue"], {value: ["red"], label: html`<b>Colors</b>`, format: x => html`<span style="text-transform: capitalize; border-bottom: solid 2px ${x}; margin-bottom: -2px;">${x}`})
Insert cell
colors2
Insert cell
Insert cell
viewof sizes = Inputs.checkbox(new Map([["Short", 8], ["Tall", 12], ["Grande", 16], ["Venti", 20]]), {value: [12], label: "Size"})
Insert cell
sizes
Insert cell
Insert cell
viewof size2 = Inputs.checkbox(
new Map([["Short", 8], ["Tall", 12], ["Grande", 16], ["Venti", 20]]),
{value: [12], label: "Size", format: ([name, value]) => `${name} (${value} oz)`}
)
Insert cell
size2
Insert cell
Insert cell
athletes = FileAttachment("athletes.csv").csv({typed: true})
Insert cell
viewof goldAthletes = Inputs.checkbox(d3.group(athletes, d => d.gold), {label: "Gold medal count", sort: "descending", key: [4, 5]})
Insert cell
goldAthletes.flat()
Insert cell
Insert cell
viewof bases = Inputs.checkbox("GATTACA", {sort: true, unique: true})
Insert cell
bases
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