The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi everyone
Can someone please advise the JSON code to set the background color scale in JSON as I would like to add this to our corporate color scheme JSON file?
The code needs to set the colors for Minimum, Center and Maximum for both Lowest Value and Number.
Thanks!
@IBweroP We're you able to find the correct JSON to apply conditional formatting colors?
The September 2019 Power BI Desktop update video had a spot that finally showed the correct syntax to do this!
"maximum": "#00b050",
"center": "#ffff00",
"minimum": "#c00000",
Hi @IBweroP,
What background color do you want to set in JSON file, Page or Visuals?
If you want to set the background color of visuals, you could modify your JSON file. You could have a good reference of this article to know Report theme JSON file format.
If you want to set the background of page in JSON file, this feature is not supported in Power BI currently, you could vote this similar idea here which has been submitted in Power BI ideas forum and add your comments there to improve Power BI and make this feature coming sooner.
The code needs to set the colors for Minimum, Center and Maximum for both Lowest Value and Number.
I'm not clear about what you mean, could you describe in more details?
Best Regards,
Cherry
Hi Cherry @v-piga-msft
Thank you for your response and apologies for being slightly vague with my first post.
In a Table visualisation, you can manually set the Background Color Style of a Values column** by
1) Left mouse click select the desired Values field arrow you wish to apply the style to then
2) Select Conditional Formatting then
3) Select Background Color Style
This then gets you to a screen where you select the color values for Minimum, Center (if Diverging is ticked) and Maximum Values for either Lowest Value or Number.
This then shades the column values with various color shades which allows you to visually see which values are at the extreme ends of the scale and what values are somewhere in the middle.
I would like to set the color scheme for the color scale in a Json file so that staff dont use non-company branded colors in their table graphics. i.e. the correct color scheme is already loaded for them and they dont have to think about "making it pretty" with non-branded colors.. We have created a Json file for many of the other Visuals but this one has us stumped on the exact Json code needed.
**The functionality for a Background Color scale only works with columns that can sum to a total.
Thanks for your interest in this problem.
Much appreciated!
Hi @IBweroP,
If I understand your requirement correctly that you want to set the theme color in the JSON file that you could use it in your conditional formatting?
Do you want to get theme color like below?
If it is, you could have a reference of this JSON file.
Reference:
Best Regards,
Cherry
Hi again Cherry
My understanding is that what you describe, sets a single colour scheme for the whole table
However what we are trying to achieve is that the table visualisation needs to have
1) a black header, black grid and white rows (which you can set using the method you described in your last post)
2) for any individual column background colour scale (if selected), set that to our company branded red (#C8102E) for low , light brown, (#C1A01E) for center and green (#009A17) for high, as the default scale colors in our corporate theme Json file.
Your suggestion deals with #1 but does not cover #2
The Json files given in the webpage link here https://docs.microsoft.com/en-us/power-bi/desktop-report-themes#how-report-themes-work dont seem to change the background color scale colors at all in the couple of tests I have done on it so far..
As an example, if I set the datacolor in the Json file to only two colors, black and grey, I would expect the background color scale to be black and green but it does not change it from the Power BI default.
Thanks