Public
Edited
Feb 18
Insert cell
Insert cell
jobs = FileAttachment("jobs.json").json()
Insert cell
import {vl} from "@vega/vega-lite-api-v5"
Insert cell
import {fromColumns, printTable} from "@uwdata/data-utilities"

Insert cell
md`${jobs.length} rows, ${Object.keys(jobs[0]).length} columns!`
Insert cell
printTable(jobs.slice(0, 10))
Insert cell
vl.markBar()
.data(jobs)
.transform(
vl.calculate("floor(datum.year / 10) * 10").as("decade")
)

.encode(
vl.x().fieldO("decade").title("decade"),
vl.y().sum("count").title("number of people participate in job"),
vl.color().fieldN("sex").title("sex"),
)
.render()
Insert cell
vl.markLine()
.data(jobs)
.transform(
vl.calculate("floor(datum.year / 10) * 10").as("decade")
)
.encode(
vl.x().fieldO("decade").title("decade"),
vl.y().sum("count").title("Job count"),
vl.color().fieldN("job").title("Types of job"),
vl.detail().fieldN("job")
)
.width(800)
.height(400)
.render()
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