Fairly new to vega/vega-lite and javascript in general so trying my hand at this and it is not working the way I'd like.
My main issue at the moment is that my years are whole numbers as primitive values. I've tried parsing them to show as temporal units in the format of %Y but I just keep getting decimal places which doesn't work.
{
"data": {"name": "dataset"},
"width": 500,
"height": 500,
"layer": [
{
"mark": {
"type": "line",
"point": true
},
"encoding": {
"y": {"aggregate": "mean","field": "Index Score", "type": "quantitative", "axis": {"format": ".1e"}, "title": "Economic Exposure Score"},
"x": {"field": "Year","type": "quantitative", "title": "Years"},
"color": {"field": "Country", "type": "nominal", "legend": null}
}
},
{
"mark": {"type": "text", "align": "center", "dy": 15, "fontWeight": "bold", "fontSize": 14},
"encoding": {
"x": {
"field": "Year",
"type": "quantitative"
},
"y": {
"field": "Index Score",
"type": "quantitative"
},
"text": {"field": "Event Name", "type": "nominal"},
"color": {"value": "black"}
}
}
]
}
Here is where I'm at right now: v1 index score over years. Yes there are a lot of lines. I have a dynamic card that will show the chart only once a country has been selected from a slicer in the dashboard so no worries there. I plan on adding labels to the lines.
Summary of troubleshooting:
- have tried formatting this at the "Data" level as well as within the mark/line/encoding/y but I either get a whole number representation or a decimal...