Reputation: 3
I'm currently trying to create a donut chart in Vega-lite that uses Royalty as theta and Year as color, and includes both values in the legend. The legend for color is working fine, but I cannot figure out how to either concatenate the theta values, or create a new legend.
I've tried hiding another arc underneath the current one and using Royalty as color, but Vega-lite connects the legends so you cannot control them individually.
I've tried creating a new text mark and moving it next to the legend, but the values stack as there is no x or y values. This way also feels wrong. I've gone over the documentation multiple times and I can't seem to find a solution.
Is there a way to do this?
Upvotes: 0
Views: 115
Reputation: 2062
Just concatenate the values in the Year field.
{"Year": "2022 - 100000", "Royalty": 100000},
{"Year": "2021 - 150000", "Royalty": 150000},
{"Year": "2020 - 200000", "Royalty": 200000}
You could also create the label in DAX and pass it in as a separate column.
{"Year": "2022", "Year label": "2022 - 100000", "Royalty": 100000},
{"Year": "2021", "Year label": "2021 - 150000", "Royalty": 150000},
{"Year": "2020", "Year label": "2020 - 200000", "Royalty": 200000}
Open the Chart in the Vega Editor
Upvotes: 0