Published
Edited
Sep 19, 2022
2 forks
8 stars
Insert cell
Insert cell
html`<h2 style='color:${yourColor}'>Hello, ${yourName}!</h2>`
Insert cell
viewof yourName = html`<input type=text value=${myName}>`
Insert cell
myName = "Anjana"
Insert cell
viewof yourColor = color({value: "#21abc0", title:"Your favorite color"})
Insert cell
import {color} from "@jashkenas/inputs"
Insert cell
letterFrequencyChart = vl.markBar() // Make a bar chart
.data(yourLetters) // Using letter frequency data
.encode(
vl.x().fieldO("letter"), // Show letters in sequential order on the x-axis
vl.y().fieldQ("frequency").axis({ format: "%" }), // Show frequency on the y-axis, formatted as percent
vl.color().value(yourColor) // Set the bar color
)
.render()

// Source: https://observablehq.com/@observablehq/vega-lite-chart-types#simpleBar
Insert cell
yourLetters = letterFrequencies.filter(row => yourName.toUpperCase().includes(row.letter))
Insert cell
import {vl, alphabet as letterFrequencies} from '@observablehq/vega-lite-chart-types'
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