Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Old Custom Theme JSON File Errors

Hi All,   I am getting errors (over 140) loading a custom theme file. My Current version of PBI Desktop is Dec 2023. It seems that much has changed over the years and all errors are related to vis...
  • rajendraongole1's avatar
    1 year ago

    Hi Anonymous - Use a JSON schema validator with the official Power BI theme schema link shared below.as per my observation your current error that the background property under labels for pieChart is no longer just a boolean or a simple string value but may require a specific type or constant value.Try adjusting properties like background, position, etc., to see what combination works. If a property is causing issues, sometimes it's best to remove it and test the theme without it.

    theme (jsonformatter.org)

     

     

    Use report themes in Power BI Desktop - Power BI | Microsoft Learn

     

    Hope this helps you to fix the custom theme issue. 

     

     

     

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi rajendraongole1 ,thanks for the quick reply, I'll add more.

    Hi Anonymous ,

    Regarding your question, first you need to download the software, using Notepad to encode is a disaster.

    Download the latest file and save it in the same folder as your JSON file.

    powerbi-desktop-samples/Report Theme JSON Schema at main · microsoft/powerbi-desktop-samples · GitHub

    Add this line of code in your Json file, then save and restart 'vs code'

    "$schema": "reportThemeSchema-2.132.json",

    Then write the code and there will be a prompt.

    {
    	"name": "PieChartTemplate",
    	"$schema": "reportThemeSchema-2.132.json",
    	"visualStyles": {
    		"pieChart": {
    			"*": {
    				"labels": [{
    					"show": true,
    					"labelStyle": "Category",
    					"fontSize": 20,
    					"fontFamily": "Segoe UI Bold, wf_segoe-ui_bold, helvetica, arial, sans-serif",
    					"position": "preferOutside",
    					"overflow": false,
    					"background": "off"
    				}]
    			}
    		}
    	}
    }

    GitHub - MattRudy/PowerBI-ThemeTemplates: JSON Templates for assembling Power BI Themes

    The template here is a little newer, but it seems to have some problems and needs to be modified according to the error message in Power BI.

     

    Best Regards,
    Wenbin Zhou