Public
Edited
Jul 3, 2024
14 forks
Importers
57 stars
Insert cell
Insert cell
embed = require("vega-embed@6")
Insert cell
Insert cell
Insert cell
viewof view = embed({
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
width: 360,
data: {
values: [
{a: 'A', b: 28}, {a: 'B', b: 55}, {a: 'C', b: 43},
{a: 'D', b: 91}, {a: 'E', b: 81}, {a: 'F', b: 53},
{a: 'G', b: 19}, {a: 'H', b: 87}, {a: 'I', b: 52}
],
name: 'source'
},
selection: {
a: {type: 'single'}
},
mark: 'bar',
encoding: {
x: {field: 'a', type: 'ordinal', axis: {labelAngle: 0}},
y: {field: 'b', type: 'quantitative'},
tooltip: {field: 'b', type: 'quantitative'},
color: {
condition: {selection: 'a', value: 'steelblue'},
value: 'grey'
}
},
// pass options to Vega-Embed
usermeta: {
embedOptions: {
renderer: 'svg'
}
}
})
Insert cell
Insert cell
Insert cell
view.insert('source', {a: 'J', b: 42}).run()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
embedWithSpecificVersions = require.alias({
"vega": "vega@5.21.0",
"vega-lite": "vega-lite@5.2.0"
})("vega-embed@6")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more