Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
austrich
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

 

 

6 REPLIES 6
austrich
Frequent Visitor

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.

Anonymous
Not applicable

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. 

Anonymous
Not applicable

I've just tried "position": "TopCenter" and it worked

v-cherch-msft
Employee
Employee

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.
austrich
Frequent Visitor

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

 

 

Anonymous
Not applicable

have you tried using barChart instead of clusterBarChart?  this worked for me

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.