Forum Discussion
JSON Theme Code for Text Box
- 6 years ago
Using that I found that you can set the font family, size, color etc using he "*": attribute, sample code below:
"textbox": { "*": { "*": [ { "fontSize": 40, "fontFamily": "Calibri", "wordWrap": true, "color": { "solid": { "color": "#FFFFFF"} } }], "general": [{ "responsive": true }], "background": [{ "show": false, "color": { "solid": { "color": "#DDDDDD"}}, "transparency": 100 }], "visualHeader": [{ "show": false }] } } - 5 years ago
Hoi SteveVail,
I don't use PBI much anymore but we still have reports using this "textbox" formatting in a custom theme, they all still work in Version: 2.91.884.0 64-bit (March 2021). I made a minimal demo theme to test it and applied it as a new theme, which all seems to work. Sample code below to show where I put the code in the answer above. Cheers.
{ "name": "Textbox format demo", "dataColors": [ "#0F5CA4", "#71cff4", "#0F8CD2", "#00b050", "#92d050", "#FF9900", "#FF0000", "#C0C0C0", "#3599B8", "#DFBFBF", "#4AC5BB", "#5F6B6D", "#FB8281", "#F4D25A", "#7F898A", "#A4DDEE", "#FDAB89", "#B687AC", "#28738A", "#A78F8F", "#168980", "#293537", "#BB4A4A", "#B59525", "#475052", "#6A9FB0", "#BD7150", "#7B4F71", "#1B4D5C", "#706060", "#0F5C55", "#1C2325" ], "visualStyles": { "*": { "*": { "*": [ { "fontSize": 14, "fontFamily": "Calibri, Cambria", "wordWrap": true, "color": { "solid": {} } } ], "valueAxis": [ { "showAxisTitle": true, "gridlineStyle": "solid" } ], "wordWrap": [ { "show": true } ], "general": [ { "responsive": true } ] } }, "textbox": { "*": { "*": [ { "fontSize": 40, "fontFamily": "Calibri", "wordWrap": true, "color": { "solid": { "color": "#FFFFFF" } } } ], "general": [ { "responsive": true } ], "background": [ { "show": false, "color": { "solid": { "color": "#DDDDDD" } }, "transparency": 100 } ], "visualHeader": [ { "show": false } ] } }, "areaChart": { "*": { "general": [ { "responsive": true } ], "legend": [ { "show": true, "position": "Bottom Center", "showTitle": false, "fontFamily": "Calibri", "fontSize": 14 } ], "categoryAxis": [ { "show": true, "axisType": "continuous", "fontSize": 14, "fontFamily": "Calibri", "showAxisTitle": false, "titleFontSize": 14, "titleFontFamily": "Calibri" } ], "valueAxis": [ { "show": true, "position": "Left", "axisScale": "Linear", "fontSize": 14, "fontFamily": "Calibri", "showAxisTitle": true, "axisStyle": "showTitleOnly", "titleFontSize": 14, "titleFontFamily": "Calibri", "gridlineShow": true, "gridlineColor": { "solid": { "color": "#B3B3B3" } }, "gridlineThickness": 1, "gridlineStyle": "solid" } ], "dataPoint": [ { "defaultColor": { "solid": { "color": "#448822" } } } ] } }, "page": { "*": { "outspace": [ { "color": { "solid": { "color": "#003B5D" } } } ], "background": [ { "color": { "solid": { "color": "#003B5D" } }, "transparency": 0 } ] } } } }
HI Anonymous,
Current it seems like only visuals can use json theme to customize. (shape, line and textbox not include)
Maybe you can try to use theme to setting global font style to apply default font on text box.
Regards,
Xiaoxin Sheng
Hi Anonymous
Do you have example JSON code that shows how to set the global font?
Thanks,
James
- Anonymous8 years agoNot applicable
HI Anonymous,
You can take a look at official document:
Use Report Themes in Power BI Desktop (Preview)
It seems like you write properties without specific visual types, it will try to apply it to whole visuals.
Regards,
Xiaoxin Sheng
- Anonymous7 years agoNot applicable
Hiya,
Did you end up figuring this out? I'm trying to do the same thing.
Thanks,