Published
Edited
Jun 14, 2020
2 forks
2 stars
Insert cell
Insert cell
vegalite = require("@observablehq/vega-lite")
Insert cell
vegalite({
width: 600,
height: 400,
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
mark: "circle",
encoding: {
x: {
field: "time",
type: "temporal"
},
y: {
field: "mag",
type: "quantitative"
}
}
})
Insert cell
vegalite({
width: 300,
height: 400,
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
mark: "bar",
encoding: {
y: {
field: "mag",
type: "quantitative",
bin: true
},
x: {
aggregate: "count"
}
}
})
Insert cell
vegalite({
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
hconcat: [
// time series
// histogram
]
})
Insert cell
vegalite({
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
hconcat: [
// time series
{
width: 600,
height: 400,
mark: "circle",
encoding: {
x: {
field: "time",
type: "temporal"
},
y: {
field: "mag",
type: "quantitative"
}
}
},
// histogram
{
width: 300,
height: 400,
mark: "bar",
encoding: {
y: {
field: "mag",
type: "quantitative",
bin: true
},
x: {
aggregate: "count"
}
}
}
]
})
Insert cell
vegalite({
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
hconcat: [
// time series
// selection brush
// histogram
// transform filter
]
})
Insert cell
vegalite({
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
hconcat: [
// time series
{
width: 600,
height: 400,
// selection brush
selection: {
brush: {
type: "interval",
encodings: ["x", "y"]
}
},
mark: "circle",
encoding: {
x: {
field: "time",
type: "temporal"
},
y: {
field: "mag",
type: "quantitative"
}
}
},
// histogram
{
width: 300,
height: 400,
// transform filter
transform: [
{
filter: {
selection: "brush"
}
}
],
mark: "bar",
encoding: {
y: {
field: "mag",
type: "quantitative",
bin: {
step: 0.5
},
scale: {
domain: [-2, 7]
}
},
x: {
aggregate: "count"
}
}
}
]
})
Insert cell
vegalite({
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
hconcat: [
// time series
// color condition
// histogram
// selection brush
]
})
Insert cell
vegalite({
data: {
url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
},
hconcat: [
// time series
{
width: 600,
height: 400,
mark: "circle",
encoding: {
x: {
field: "time",
type: "temporal"
},
y: {
field: "mag",
type: "quantitative"
},
color: {
condition: {
selection: "brush",
value: "#D11349"
},
value: "#81858C"
}
}
},
// histogram
{
width: 300,
height: 400,
selection: {
brush: {
type: "interval",
encodings: ["y"]
}
},
mark: {
type: "bar",
color: "#D11349"
},
encoding: {
y: {
field: "mag",
type: "quantitative",
bin: {
step: 0.5
}
},
x: {
aggregate: "count"
}
}
}
]
})
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.
Learn more