Created
March 30, 2023 07:41
-
-
Save GitNoise/be40c6c490e6aeb4dec97374faafff8a to your computer and use it in GitHub Desktop.
Line chart w. gradient
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/v5.json", | |
"description": "Google's stock price over time.", | |
"data": { | |
"url": "data/stocks.csv" | |
}, | |
"transform": [ | |
{ | |
"filter": "datum.symbol==='GOOG'" | |
} | |
], | |
"mark": { | |
"type": "line", | |
"color": { | |
"x1": 1, | |
"y1": 1, | |
"x2": 1, | |
"y2": 0, | |
"gradient": "linear", | |
"stops": [ | |
{ | |
"offset": 0, | |
"color": "red" | |
}, | |
{ | |
"offset": 0.5, | |
"color": "red" | |
}, | |
{ | |
"offset": 0.5, | |
"color": "blue" | |
}, | |
{ | |
"offset": 1, | |
"color": "blue" | |
} | |
] | |
} | |
}, | |
"encoding": { | |
"x": { | |
"field": "date", | |
"type": "temporal" | |
}, | |
"y": { | |
"field": "price", | |
"type": "quantitative" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment