Public
Edited
Apr 25, 2023
7 forks
Importers
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
viewof sport = Inputs.select(sports, {label: "Sport"})
Insert cell
Insert cell
Insert cell
Inputs.range([0, 100], {label: "Amount", step: 5})
Insert cell
Insert cell
Insert cell
Insert cell
viewof amount = Inputs.range([0, 100], {label: "Amount", step: 1})
Insert cell
Insert cell
Insert cell
Insert cell
viewof button = Inputs.button("Click me")
Insert cell
viewof toggle = Inputs.toggle({label: "Toggle", value: true})
Insert cell
viewof checkboxes = Inputs.checkbox(["A", "B"], {label: "Check boxes", value: ["A"]})
Insert cell
viewof radios = Inputs.radio(["A", "B"], {label: "Radio buttons", value: "A"})
Insert cell
viewof date = Inputs.date({label: "Date", value: "2022-12-22"})
Insert cell
viewof text = Inputs.text({label: "Text"})
Insert cell
Insert cell
viewof letter = Inputs.select(letters, {label: "Favorite letter", value: "O"})
Insert cell
viewof color = Inputs.color({label: "Bars color", value: "#4682b4"})
Insert cell
viewof highlight = Inputs.color({label: "Highlight color", value: "#ffa500"})
Insert cell
letterFrequency = Plot.plot({
marks: [
Plot.barY(alphabet, {x: "letter", y: "frequency",
fill: d => d.letter === letter ? highlight : color,
sort: {x: "y", reverse: true}}),
Plot.ruleY([0])
],
caption: "Frequency of letters in English texts",
ariaLabel: "Frequency of letters in English texts",
ariaDescription: `This bar chart shows the frequency of letters in English texts. We see that the top five most common letters are E, T, A, O and I.`
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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