Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have created a Deneb visual that concatenates a view with a text mark on top of a bullet chart/gauge.
I want to create a legend that explains what the 2 bars and the tick mark mean. But I'm not sure how/where to include it in the visual. I need the symbols on the legend to match the colors in the visual. If I can't make one "natively", I am fine getting creative and concatenating a "fake" one on the bottom. I'd rather it be inside the Deneb visual rather than layering another Power BI visual on top of it. But I'm struggling to figure out the best way to handle this. Vega-lite code is below.
{
"data": {"name": "dataset"},
"vconcat": [
{
"mark": {
"type": "text",
"fontSize": 40,
"align": "left",
"baseline": "top",
"dy": 20,
"fontWeight": "bold"
},
"encoding": {
"text": {
"field": "Actual",
"type": "quantitative",
"format": "$,.0f"
},
"color": {"expr": "pbicolor(3)"}
}
},
{ "width": "300",
"encoding": {
"x": {
"type": "quantitative",
"scale": {"nice": false},
"title": null,
"axis": null
},
"y": {"type": "nominal"},
"tooltip": [
{"field": "Actual"},
{"field": "Budget"},
{"field": "Projection"}
]
},
"layer": [
{
"mark": {
"type": "bar",
"cornerRadiusEnd": 8,
"color": {
"expr": "pbiColor(4, .6)"
},
"size": 60
},
"encoding": {
"x": {"field": "Budget"}
}
},
{
"mark": {
"type": "bar",
"cornerRadiusEnd": 8,
"color": {
"expr": "pbiColor(4)"
},
"size": 40
},
"encoding": {
"x": {"field": "Actual"}
}
},
{
"mark": {
"type": "tick",
"height": 70,
"thickness": 5,
"color": {
"expr": "pbiColor(4,-.5)"
}
},
"encoding": {
"x": {"field": "Projection"}
}
}
]
}
]
}
Solved! Go to Solution.
Ok, I got it working following this custom legend tutorial from Enterprise DNA: https://forum.enterprisedna.co/t/deneb-examples-legends/28900. I don't love that I had to make a fake chart, but it does work well. Basically add another view to the vconcat, make a fake chart using an arc marc with a radius of zero. Hard code the legend values in the data for that view.
Ok, I got it working following this custom legend tutorial from Enterprise DNA: https://forum.enterprisedna.co/t/deneb-examples-legends/28900. I don't love that I had to make a fake chart, but it does work well. Basically add another view to the vconcat, make a fake chart using an arc marc with a radius of zero. Hard code the legend values in the data for that view.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
87 | |
82 | |
71 | |
49 |
User | Count |
---|---|
143 | |
123 | |
107 | |
61 | |
55 |