Public
Edited
Sep 6, 2024
Insert cell
Insert cell
import { vl } from "@vega/vega-lite-api"
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
vl.markCircle() // Make a scatter chart
.data(cars) // Using the cars data (below)
.encode(
vl.x().fieldQ("Horsepower"), // For x, use the Horsepower field
vl.y().fieldQ("Miles_per_Gallon"), // For y, use the Miles_per_Gallon field
vl.tooltip().fieldN("Name") // For tooltips, show the Name field
)
.render() // Draw the chart
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