Platform
Resources
Pricing
Sign in
Get started
Adam Perer
Workspace
Fork
Published
By
Adam Perer
Edited
Nov 21, 2019
Fork of
Interaction with Vega-Lite
Insert cell
md
`# Stacked Chart Example`
Insert cell
import
{
vl
}
from
'@vega/vega-lite-api'
Insert cell
import
{
printTable
,
uniqueValid
}
from
'@uwdata/data-utilities'
Insert cell
datasets
=
require
(
'vega-datasets'
)
Insert cell
barleyData
=
datasets
[
'barley.json'
]
(
)
Insert cell
printTable
(
barleyData
.
slice
(
0
,
5
)
)
Insert cell
vl
.
markBar
(
)
.
data
(
barleyData
)
.
encode
(
vl
.
x
(
)
.
fieldQ
(
'yield'
)
.
aggregate
(
'sum'
)
,
vl
.
y
(
)
.
fieldN
(
'variety'
)
,
vl
.
color
(
)
.
fieldN
(
'site'
)
)
.
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.
Try it for free
Learn more
Compare fork
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
datasets
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
barleyData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML