Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |