Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

JSON Theme Code for Text Box

Hi All,   Is anyone aware on how to set the font for a text box to a different font (such as arial)? I am looking around and not finding anything. It looks like it doesn't live under the "visualSty...
  • StuartSkabo's avatar
    StuartSkabo
    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
    				}]
    			}
    		}
  • StuartSkabo's avatar
    StuartSkabo
    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
                        }
                    ]
                }
            }
        }
    }