Platform
Resources
Pricing
Sign in
Get started
Andrii Hazin
Workspace
Fork
Published
.by
By
Andrii Hazin
Edited
Jun 14, 2020
1 fork
1 star
.by
Vega-Lite: Data, Marks, Encodings
Vega-Lite: Scales
Vega-Lite: Axes
Vega-Lite: Condition
Vega-Lite: Bin & Aggregate
Vega-Lite: Time Unit & Aggregate
Vega-Lite: Time Unit, Bin & Aggregate
Vega-Lite: Facet
Vega-Lite: Filter
Vega-Lite: Base Map
Vega-Lite: Bubble Map
Vega-Lite: Concatenate Map & Chart
Vega-Lite: Concatenate Map & Chart, Add Brush
Vega-Lite: Concatenate Time-Series & Histogram, Add Brush
Insert cell
md
`# Vega-Lite: Time Unit & Aggregate`
Insert cell
vegalite
=
require
(
"@observablehq/vega-lite"
)
Insert cell
Insert cell
vegalite
(
{
width
:
900
,
height
:
300
,
data
:
{
url
:
"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
}
,
mark
:
"circle"
,
encoding
:
{
x
:
{
field
:
"time"
,
type
:
"temporal"
}
}
}
)
Insert cell
Insert cell
vegalite
(
{
width
:
900
,
height
:
300
,
data
:
{
url
:
"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
}
,
mark
:
"circle"
,
encoding
:
{
x
:
{
timeUnit
:
"yearmonthdate"
,
field
:
"time"
,
type
:
"temporal"
}
}
}
)
Insert cell
Insert cell
vegalite
(
{
width
:
900
,
height
:
300
,
data
:
{
url
:
"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
timeUnit
:
"yearmonthdate"
,
field
:
"time"
,
type
:
"temporal"
}
,
y
:
{
aggregate
:
"count"
}
}
}
)
Insert cell
Insert cell
vegalite
(
{
width
:
900
,
height
:
300
,
data
:
{
url
:
"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
timeUnit
:
"yearmonthdate"
,
field
:
"time"
,
type
:
"temporal"
}
,
y
:
{
aggregate
:
"mean"
,
field
:
"mag"
,
type
:
"quantitative"
}
}
}
)
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
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
vegalite
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
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML