Platform
Resources
Pricing
Sign in
Get started
CSE412
Workspace
Fork
Public
By
Paul Stevans
Edited
May 4, 2023
Fork of
CSE412 Sp'23: JSON vs. JavaScript Vega-Lite API
Insert cell
Insert cell
Insert cell
ageData
=
[
{
"person"
:
"Mary"
,
"age"
:
45
}
,
{
"person"
:
"Jane"
,
"age"
:
52
}
,
{
"person"
:
"Jamil"
,
"age"
:
35
}
,
{
"person"
:
"Liang"
,
"age"
:
21
}
]
Insert cell
Insert cell
Insert cell
vl
.
markBar
(
)
.
data
(
ageData
)
.
encode
(
vl
.
x
(
)
.
fieldN
(
'person'
)
,
vl
.
y
(
)
.
fieldQ
(
'age'
)
)
.
width
(
200
)
.
height
(
200
)
.
render
(
)
Insert cell
Insert cell
vegalite
(
{
height
:
200
,
width
:
200
,
data
:
{
url
:
"https://jonfroehlich.github.io/age_data.json"
}
,
mark
:
'bar'
,
encoding
:
{
x
:
{
field
:
'person'
,
type
:
'nominal'
}
,
y
:
{
field
:
'age'
,
type
:
'quantitative'
}
}
}
)
Insert cell
Insert cell
Insert cell
Insert cell
{
const
plot
=
vl
.
markBar
(
)
.
data
(
ageData
)
.
encode
(
vl
.
x
(
)
.
fieldN
(
'person'
)
,
vl
.
y
(
)
.
fieldQ
(
'age'
)
)
.
width
(
200
)
.
height
(
200
)
;
return
printVegaLiteJSON
(
plot
,
true
)
}
Insert cell
Insert cell
vl
.
markBar
(
)
.
data
(
ageData
)
.
transform
(
vl
.
filter
(
'datum.age >= 40'
)
)
.
encode
(
vl
.
x
(
)
.
fieldN
(
'person'
)
,
vl
.
y
(
)
.
fieldQ
(
'age'
)
)
.
width
(
200
)
.
height
(
200
)
.
render
(
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ageData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML