Platform
Resources
Pricing
Sign in
Contact us
Maeve Kane
Historian of early America, Indigenous history, and material culture
Workspace
Fork
Published
Making a bar chart 3 ways
By
Maeve Kane
Edited
Oct 11, 2020
1
Making a bar chart 3 ways
Negative bar chart
Basic bar chart in Vega-Lite
Basic bar chart in D3
Basic bar chart intro
Insert cell
md
`# Basic bar chart in Vega-Lite`
Insert cell
vl
.
markBar
(
)
.
data
(
data
)
.
width
(
700
)
.
encode
(
vl
.
x
(
)
.
fieldN
(
"date"
)
.
timeUnit
(
"monthyear"
)
,
vl
.
y
(
)
.
fieldQ
(
"value"
)
)
.
render
(
)
Insert cell
md
`### Get the data`
Insert cell
data
=
FileAttachment
(
"data.csv"
)
.
csv
(
)
Insert cell
md
`### Import Vega Lite`
Insert cell
import
{
vl
}
from
"@vega/vega-lite-api"
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
Fork
View
Export
Add comment
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
data
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
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML