I was a bit rushed yesterday when I posted the initial linear gauge Deneb/Vega-Lite template, and didn’t include one of the new features that is slated to be available in the upcoming Deneb version 1.3 release, namely the direct access to the colours in the current color theme of the Power BI report.
I’ve modified my original linear gauge Deneb/Vega-Lite code to conform to the 2nd, 4th, 6th, and 8th colours of the current Power BI theme.
Here’s an example of the colour block Deneb JSON code to set the colours based on the Power BI theme:
"color": {
"field": "Name",
"type": "nominal",
"title": "Range",
"sort": {
"op": "sum",
"field": "ID"
},
"scale": {
"range": [
{"expr": "pbiColor(1)"},
{"expr": "pbiColor(3)"},
{"expr": "pbiColor(5)"},
{"expr": "pbiColor(7)"}
]
}
}
(Deneb uses a zero-based index to access the theme colours, so to get the 2nd, 4th, 6th, and 8th colours one must use indexes of 1, 3, 5, and 7.)
Also included is a sample PBIX using a made-up dataset as a demo.
NOTE: This template was prepared using a beta version of Deneb version 1.3 (a standalone version) for illustrative purposes only, and, as such, may contain development features that will not be in the final production release.
Greg