Published
Edited
Nov 19, 2021
Insert cell
# Data visualization with vega-lite
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
import {printTable} from '@uwdata/data-utilities'
Insert cell
response = fetch('https://untitled-4emlpxz084g6.runkit.sh/api/items')
Insert cell
data = response.json()
Insert cell
// data = [{x: 1, y:11}, {x: 2, y: 22}, {x: 3, y:33}, {x: 4, y: 44}, {x: 5, y: 55}, {x: 6, y:66}, {x: 7, y:77}, {x: 8, y:88}, {x: 9, y:99}, {x: 10, y:100}]
Insert cell
printTable(data.slice(0, 3))
Insert cell
vl.markBar()
.data(data)
.encode(
vl.x().fieldN('x'),
vl.y().fieldQ('y')
)
.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