Created
May 30, 2024 03:06
-
-
Save trinker/2ff0a3857b011fc1bf139e8e099a77f8 to your computer and use it in GitHub Desktop.
Vega-Lite spec from Wed May 29 2024
This file contains hidden or 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", | |
"width": 600, | |
"data": { | |
"values": [ | |
{ | |
"__row__": 0, | |
"calendar_month_year": "Dec-23", | |
"concentration_risk_monthly": 0.51 | |
}, | |
{ | |
"__row__": 1, | |
"calendar_month_year": "Jan-24", | |
"concentration_risk_monthly": 0.8 | |
}, | |
{ | |
"__row__": 2, | |
"calendar_month_year": "Feb-24", | |
"concentration_risk_monthly": 0.027 | |
}, | |
{ | |
"__row__": 3, | |
"calendar_month_year": "Mar-24", | |
"concentration_risk_monthly": 0.022 | |
}, | |
{ | |
"__row__": 4, | |
"calendar_month_year": "Apr-24", | |
"concentration_risk_monthly": 0.125 | |
}, | |
{ | |
"__row__": 5, | |
"calendar_month_year": "May-24", | |
"concentration_risk_monthly": 0.022 | |
} | |
] | |
}, | |
"transform": [{"extent": "concentration_risk_monthly", "param": "myExtent"}], | |
"mark": { | |
"type": "area", | |
"fill": { | |
"expr": "{'gradient': 'linear', 'x1':0,'y1':1,'x2':0,'y2':0, 'stops': [{'offset': 0, 'color': scale('stroke', myExtent[0]>1?1:myExtent[0]>0.3?0.3:0)},{'offset': 0.3, 'color': scale('stroke', myExtent[1]>1?1:myExtent[1]>0.3?0.3:0)},{'offset': 1, 'color': scale('stroke', myExtent[1]>=1?1:myExtent[1]>0.3?0.3:0)}]}" | |
}, | |
"strokeOpacity": 0 | |
}, | |
"encoding": { | |
"stroke": { | |
"field": "1", | |
"legend": null, | |
"scale": { | |
"type": "linear", | |
"range": ["green", "yellow", "red"], | |
"domain": [0, 0.3, 1] | |
} | |
}, | |
"x": { | |
"field": "calendar_month_year", | |
"type": "ordinal", | |
"sort": {"field": "__row__"}, | |
"axis": {"title": null}, | |
"scale": {"padding": 0} | |
}, | |
"y": { | |
"field": "concentration_risk_monthly", | |
"type": "quantitative", | |
"axis": {"title": null} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment