Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"version": 2,
"width": 700,
"height": 300,
"data": [
{
"name": "table",
"values": [
{"year":1907,"population":51815},
{"year":2011,"population":310956},
{"year":2017,"population":269022}
],
"transform": [
{
"type": "formula",
"field": "date",
"expr": "datetime(datum.year,1,1)"
}
]
}
],
"scales": [
{
"name": "x",
"type": "time",
"range": "width",
"domain": {
"data": "table",
"field": "date"
}
},
{
"name": "y",
"type": "linear",
"range": "height",
"domain": {
"data": "table",
"field": "population"
}
}
],
"marks": [
{
"type": "line",
"from": {"data": "table"},
"properties": {
"enter": {
"x": {"scale": "x","field": "date"},
"y": {"scale": "y","field": "population"},
"stroke": {"value": "#99B2CC"},
"strokeWidth": {"value": 3},
"interpolate": {"value": "monotone"}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment