Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi there
I am attempting to change one line in pbiviz.json file to update the color:
Change json code from:
var m = e.getColor(h.toString());
(above works and cycles through the different colours in the colour pallette)
To (does not work):
var m=\"#ED1C24\"; or var m=\"ED1C24\"; or var m=\"red\";
None of the above works, and the visual always comes out black, irrespective of the hex code / color name used.
My query is then what does e.getColor(String) return?
Thank you
Solved! Go to Solution.
The getColor method returns an instance of IColorInfo.
To fix the issue you should return an object like this:
{ value: "#ED1C24" }
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Great, thanks @v-viig!
More details ....
getColor (string) returns IColorInfo in the format:
{ value: '#FFFFFF' }
See line 39 of:
For example, JSON in Power BI visual is updated from:
m = e.getColor(h.toString());
To:
m={value:'#009EEC'};
to override the colour in the visual.
IColorPalette -> https://github.com/maqsoftware/PowerBI-visuals/blob/master/src/CustomVisuals/Published/JSONGrid/src/...
Power BI uses D3 for colour management: https://github.com/d3/d3/wiki
And ordinal scales in particular:
https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#ordinal
Process to edit a legacy .pbiviz file, eg the great Acquarium Visual https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381112?tab=Overview
In my experience, the following didn't work:
I had to keep the .pbiviz folder open within Winrar and copy the edited files back into the Winrar window.
The getColor method returns an instance of IColorInfo.
To fix the issue you should return an object like this:
{ value: "#ED1C24" }
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Great, thanks @v-viig!
More details ....
getColor (string) returns IColorInfo in the format:
{ value: '#FFFFFF' }
See line 39 of:
For example, JSON in Power BI visual is updated from:
m = e.getColor(h.toString());
To:
m={value:'#009EEC'};
to override the colour in the visual.
IColorPalette -> https://github.com/maqsoftware/PowerBI-visuals/blob/master/src/CustomVisuals/Published/JSONGrid/src/...
Power BI uses D3 for colour management: https://github.com/d3/d3/wiki
And ordinal scales in particular:
https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#ordinal
Process to edit a legacy .pbiviz file, eg the great Acquarium Visual https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381112?tab=Overview
In my experience, the following didn't work:
I had to keep the .pbiviz folder open within Winrar and copy the edited files back into the Winrar window.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
9 | |
3 | |
3 | |
2 |