Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

JSON Custom Formatting

Hello, 

 

I am trying to create a JSON template for our organization. I'm having a little difficulty understanding all the aspects of each visual. What if I wanted to set certain categories within my categoryAxis to distinct colors instead of them all being defaulted to the same color like in a bar chart? Specifically, if I have countries as my category how would I set US to green and Canada to red for example. Would it be in the "dataPoint" section where I have it now and the syntax might be wrong? Any suggestions appreciated! 

 

Here is what I have so far: 

 

"barChart": {
      "*": {
        "general": [
          {
            "responsive": true
          }
        ],
        "legend": [
          {
            "show": false,
            "position": "Top",
            "showTitle": true,
            "titleText": "",
            "labelColor": {
              "solid": {
                "color": "#01B8AA"
              }
            },
            "fontFamily": "Segoe UI",
            "fontSize": 10
          }
        ],
        "categoryAxis": [
          {
            "show": true,
            "position": "Left",
            "labelColor": {
              "solid": {
                "color": "#FFFFFF"
              }
            },
            "fontSize": 11,
            "fontFamily": "Segoe UI",
            "preferredCategoryWidth": 30,
            "maxMarginFactor": 28,
            "innerPadding": 22,
            "showAxisTitle": false,
            "axisStyle": "showTitleOnly",
            "titleColor": {
              "solid": {
                "color": "#FFFFFF"
              }
            },
            "titleText": "",
            "titleFontSize": 8,
            "titleFontFamily": "Segoe UI"
          }
        ],
        "valueAxis": [
          {
            "show": true,
            "axisScale": "Linear",
            "start": "auto",
            "end": "auto",
            "labelColor": {
              "solid": {
                "color": "#FFFFFF"
              }
            },
            "fontSize": 11,
            "fontFamily": "Segoe UI",
            "labelDisplayUnits": "0",
            "labelPrecision": "Millions",
            "showAxisTitle": false,
            "axisStyle": "showTitleOnly",
            "titleColor": {
              "solid": {
                "color": "FFFFFF"
              }
            },
            "titleText": "",
            "titleFontSize": 11,
            "titleFontFamily": "Segoe UI",
            "gridlineShow": true,
            "gridlineColor": {
              "solid": {
                "color": "#999999"
              }
            },
            "gridlineThickness": 1,
            "gridlineStyle": "dotted"
          }
        ],
        "dataPoint": {
          "defaultColor": {
            "solid": {
              "color": "#448822"
            }
          },
          "United States": {
            "solid": {
              "color": "#FFFFFF"
            }
          }
        },
        "labels": [
          {
            "show": true,
            "color": {
              "solid": {
                "color": "#EEEEEE"
              }
            },
            "labelDisplayUnits": "auto",
            "fontSize": 8,
            "fontFamily": "Segoe UI",
            "enableBackground": false,
            "backgroundColor": {
              "solid": {
                "color": "#FFFFFF"
              }
            },
            "backgroundTransparency": 0
          }
        ],
        "plotArea": [
          {
            "transparency": 0
          }
        ]
      }
    }

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,


I am trying to create a JSON template for our organization. I'm having a little difficulty understanding all the aspects of each visual. What if I wanted to set certain categories within my categoryAxis to distinct colors instead of them all being defaulted to the same color like in a bar chart? Specifically, if I have countries as my category how would I set US to green and Canada to red for example. Would it be in the "dataPoint" section where I have it now and the syntax might be wrong? Any suggestions appreciated! 

 


 

By my tests, I'm afraid we may not achieve that in Power BI Report theme file currently.

 

Your requirement seems like conditional formatting, you could vote your idea in Power BI ideas Forum and add your comments there to improve Power BI and make this feature coming sooner.

 

As an workaround, you could set your country in an order as the color order in your JSON filer.

 

color order.png

 

order .PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,


I am trying to create a JSON template for our organization. I'm having a little difficulty understanding all the aspects of each visual. What if I wanted to set certain categories within my categoryAxis to distinct colors instead of them all being defaulted to the same color like in a bar chart? Specifically, if I have countries as my category how would I set US to green and Canada to red for example. Would it be in the "dataPoint" section where I have it now and the syntax might be wrong? Any suggestions appreciated! 

 


 

By my tests, I'm afraid we may not achieve that in Power BI Report theme file currently.

 

Your requirement seems like conditional formatting, you could vote your idea in Power BI ideas Forum and add your comments there to improve Power BI and make this feature coming sooner.

 

As an workaround, you could set your country in an order as the color order in your JSON filer.

 

color order.png

 

order .PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you very much! I hadn't thought of that solution. Until or when category specific formatting is availabe I will use this option! 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.