Forum Discussion

Iguinrj's avatar
Iguinrj
Helper I
1 year ago
Solved

Customize Power BI theme

I am creating a JSON file to customize the theme in Power BI. I used the clustered column chart as an example and was able to change the colors, X and Y axes (font, size and color). However, I am having difficulty modifying the data label. I will share my JSON file as I believe I am configuring something wrong, or does Power BI not support changing the data label via JSON?



Json:

 

{
"name": "Custom Color Palette",
"dataColors": [
"#01335C",
"#467BED",
"#FF6564",
"#FFC150",
"#1AB2AE",
"#74e8ee",
"#F0ECEE",
"#808384"
],
"background": "#FFFFFF",
"foreground": "#000000",
"tableAccent": "#467BED",
"visualStyles": {
"clusteredColumnChart": {
"*": {
"categoryAxis": [
{
"labelColor": {"solid": {"color": "#000000"}},
"fontFamily": "Segoe UI",
"fontSize": 20,
"title": {
"fontFamily": "Segoe UI",
"fontSize": 20,
"color": {"solid": {"color": "#000000"}}
}
}
],
"valueAxis": [
{
"labelColor": {"solid": {"color": "#000000"}},
"fontFamily": "Segoe UI",
"fontSize": 20,
"titleFontFamily": "Segoe UI",
"titleFontSize": 20,
"titleColor": {"solid": {"color": "#000000"}}
}
],
"dataLabel": {
"show": true,
"fontSize": 14,
"fontFamily": "Segoe UI",
"color": {"solid": {"color": "#FF6564"}},
"displayUnits": "None",
"labelPosition": "InsideEnd"
}
}
}
}
}

 

  • Hi Iguinrj,
    Thanks for the follow-up.

    Yes, it is possible to configure both the title and subtitle of a visual using a JSON theme in Power BI. These settings can be applied under the visualStyles section by targeting the visual type (e.g., clusteredColumnChart) and specifying the formatting options for "title" and "subTitle".


    I trust this information proves useful. If it does, kindly “Accept as solution” and give it a 'Kudos' to help others locate it easily.
    Thank you.

6 Replies

Replies have been turned off for this discussion
  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi Iguinrj,
    Thank you for reaching out to the Microsoft Fabric Forum Community.

    I have reproduced your scenario using my sample data and successfully achieved the expected output. The data labels, axis formatting, and colors were correctly applied using a JSON theme.

    I noticed a small issue in your JSON file where the data label formatting was not applying correctly. To fix this, I made the following changes:

    • Replaced "dataLabel" with "labels" under visualStyles → clusteredColumnChart. The correct key for modifying data labels is "labels", not "dataLabel".
    • Ensured "show": true inside "labels" to make sure data labels are visible.
    • Modified "labelPosition": "InsideEnd" to position labels correctly inside the bars.
    • Kept "fontSize": 14, "fontFamily": "Segoe UI", and "color": "#FF6564" to apply the desired formatting to data labels.

    Here is the corrected JSON file:

    {
    
        "name": "Custom Color Palette",
    
        "dataColors": [
    
            "#01335C",
    
            "#467BED",
    
            "#FF6564",
    
            "#FFC150",
    
            "#1AB2AE",
    
            "#74e8ee",
    
            "#F0ECEE",
    
            "#808384"
    
        ],
    
        "background": "#FFFFFF",
    
        "foreground": "#000000",
    
        "tableAccent": "#467BED",
    
        "visualStyles": {
    
            "clusteredColumnChart": {
    
                "*": {
    
                    "categoryAxis": [
    
                        {
    
                            "labelColor": { "solid": { "color": "#000000" } },
    
                            "fontFamily": "Segoe UI",
    
                            "fontSize": 20,
    
                            "title": {
    
                                "fontFamily": "Segoe UI",
    
                                "fontSize": 20,
    
                                "color": { "solid": { "color": "#000000" } }
    
                            }
    
                        }
    
                    ],
    
                    "valueAxis": [
    
                        {
    
                            "labelColor": { "solid": { "color": "#000000" } },
    
                            "fontFamily": "Segoe UI",
    
                            "fontSize": 20,
    
                            "titleFontFamily": "Segoe UI",
    
                            "titleFontSize": 20,
    
                            "titleColor": { "solid": { "color": "#000000" } }
    
                        }
    
                    ],
    
                    "labels": [
    
                        {
    
                            "show": true,
    
                            "fontSize": 14,
    
                            "fontFamily": "Segoe UI",
    
                            "color": { "solid": { "color": "#FF6564" } },
    
                            "displayUnits": "None",
    
                            "labelPosition": "InsideEnd"
    
                        }
    
                    ]
    
                }
    
            }
    
        }
    
    }

    I have also attached .pbix file for your reference. Please check it out.

    If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
    Thank you.

    • Iguinrj's avatar
      Iguinrj
      Helper I

      Thanks for the support. However, the font size and label position are not working. I can't attach my template here. I also wanted to create the title and subtitle changes for the visual in JSON. Is it possible to do this via JSON as well?

       

       

      • v-ssriganesh's avatar
        v-ssriganesh
        Community Support

        Hi Iguinrj,
        Thanks for the follow-up.

        Yes, it is possible to configure both the title and subtitle of a visual using a JSON theme in Power BI. These settings can be applied under the visualStyles section by targeting the visual type (e.g., clusteredColumnChart) and specifying the formatting options for "title" and "subTitle".


        I trust this information proves useful. If it does, kindly “Accept as solution” and give it a 'Kudos' to help others locate it easily.
        Thank you.

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi Iguinrj,

    May I ask if you have resolved this issue? If so, please mark it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi Iguinrj,
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.