Last active
June 24, 2019 16:51
-
-
Save djbarnwal/b02b6db5c4b60b709c653a7f5cba3a05 to your computer and use it in GitHub Desktop.
Budget VL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v3.json", | |
"background": "#edf1f7", | |
"description": "Google's stock price over time.", | |
"data": { | |
"url": "data/budgets.json" | |
}, | |
"width": 700, | |
"height": 400, | |
"layer": [ | |
{ | |
"selection": { | |
"year": { | |
"type": "single", | |
"encodings": [ | |
"x" | |
], | |
"init": { | |
"forecastYear": 2016 | |
}, | |
"bind": { | |
"forecastYear": { | |
"input": "range", | |
"min": 1980, | |
"max": 2016, | |
"step": 1 | |
} | |
} | |
} | |
}, | |
"transform": [ | |
{ | |
"filter": "datum.budgetYear <= year.forecastYear && datum.forecastYear == datum.budgetYear - 1" | |
} | |
], | |
"mark": "line", | |
"encoding": { | |
"x": { | |
"field": "forecastYear", | |
"type": "quantitative", | |
"axis": { | |
"gridOpacity": 0.5 | |
}, | |
"scale": { | |
"domain": [ | |
1982, | |
2018 | |
] | |
} | |
}, | |
"y": { | |
"field": "value", | |
"type": "quantitative", | |
"axis": null, | |
"scale": { | |
"domain": [ | |
-2, | |
1 | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"mark": "text", | |
"encoding": { | |
"text": { | |
"aggregate": "count", | |
"type": "quantitative" | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment