cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
austrich Frequent Visitor
Frequent Visitor

JSON theme legend position

Hello,

Multiple fields in my JSON theme script are not carrying over to my Power BI file. I am working with a clustered bar chart just to practice getting my theme up and running. The fields that are not applying are:

1) Gridlines

2) X axis data labels (but the title shows)

3) Legend position (I have it as Bottom Center but only the word Bottom works)

4) Data labels (the decimal places are always in the trillions when really, I don't want any decimal places)Script 1.PNGScript2.PNG

graph1.PNG

 

 

4 REPLIES 4
austrich Frequent Visitor
Frequent Visitor

json theme legend position

Hello,

Multiple fields in my JSON theme script are not carrying over to my Power BI file. I am working with a clustered bar chart just to practice getting my theme up and running. The fields that are not applying are:

1) Gridlines

2) X axis data labels (but the title shows)

3) Legend position (I have it as Bottom Center but only the word Bottom works)

4) Data labels (the decimal places are always in the trillions when really, I don't want any decimal places)Script 1.PNGScript2.PNG

graph1.PNG

 

 

Community Support Team
Community Support Team

Re: JSON theme legend position

Hi @austrich

 

Here are some articles for you:

https://docs.microsoft.com/en-us/power-bi/desktop-report-themes

https://feathersanalytics.com/power-bi-custom-report-theme/

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
austrich Frequent Visitor
Frequent Visitor

Re: JSON theme legend position

I have used this resource throughout creating the JSON theme.

The issue is that my script is correct but when applied to the BI report it does not change some of the fields that should be changed. For example my legend script is:

"legend": [{
          "show": true,
          "position": "Bottom",
          "showTitle": false,
          "titleText": "",
          "fontColor": "#666666",
          "fontSize": 10,
          "fontFamily": "Segoe UI"
        }]

Every part of this script works and changes the BI report when applied, EXCEPT the position; when the position says "Bottom Center" it doesn't apply (of course I can always apply it manually within Power BI). When the positions says "Bottom" or "Top" in the scripts, it applies to the report.

 

Based off of this resource, "Bottom Center" should be able to apply to the report.

 This issue--some script comands will apply while others won't in the same format according to this resource--occurs with other fields (noted in my first post), notably "Labels":

 "labels": [{
          "show": false,
          "labelColor":"#777777",
          "labelDisplayUnits": "Auto",
          "labelPrecision": 0,
          "labelPosition": "Auto",
          "fontSize": 9,
          "fontFamily":"DIN",
          "enableBackground": false,
          "backgroundColor": { "solid": { "color": "#0928DD"}},
          "backgroundTransparency": 30
        }]

 

With the code the "labelPrecision" is set to 0, meaning that the data labels occuring beside tmy data columns should have no decimals points. However, when I apply the theme, the report sets the precision to "Trillions". Again, this field has elements that should be able to be controlled in a JSON theme file but are not controlled, or are changed to something completely unspecified within the BI report.

 

To me this could mean:

1) Maybe there is something in my code that is globally over-riding other parts of my script so that they are ignored when I try to apply the theme.

(but I keep checking so I don't think this is the case). 

OR

2) Maybe some of the syntax listed in this resource are incorrect and therefore when I try to apply the script to the report Power BI doesn't recognize them and uses it's defult settings instead.

OR

3)  Maybe Power BI requires some of these fields to be itemized globally within the JSON file rather than noted under the visual element's properties part of the script; so when I apply the theme Power BI doesn't "see" my command because it isn't in the right place in the script.

 

Any other thoughts or theories as to what I'm doing wrong? It is becoming very limiting for the amount of control I want over the report using the JSON theme.

AUS4B33R Visitor
Visitor

Re: JSON theme legend position

I had to use "bottomcenter" and then at times I had to recreate the graph, but when I did it the legend was bottom center.