Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

New Shapes in PBI - How to Setup JSON?

Hi There,

with the may 2021 release of PBIRS we also got the new shapes feature with desktop which was released to the regular desktop in april 2021 (https://powerbi.microsoft.com/de-de/blog/power-bi-april-2021-feature-summary/#post-14480-_Toc68689097).

 

Unfortunately after converting existing shapes my settings in my custom json don't work properly anymore.

 

Is there any updated documentation to this?

 

This (https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-report-themes#report-theme-json-file-format) does not help at all...

 

Cheers

Axel

8 Replies

  • Hi Axel Et al,

     

    The element name for 'new' shapes (new from April 2021) is now just "shape" instead of "basicShape". Curiously, it also shares a similar structure with actionButton (you have to declare the default state for the shape).

     

    I found a recently updated Git Repo which has some useful info these new shapes:

    https://github.com/deldersveld/PowerBI-ThemeTemplates/blob/master/Shape.json

     

    Please see the below json, hope this helps!

     

     

    {
      "name": "ShapeFillAndOutline",
      "visualStyles": {
        "shape": {
          "*": {
            "background": [
              {
                "show": false
              }
            ],
            "fill": [
              {
                "show": true
              },
              {
                "$id": "default",
                "transparency": 0,
                "fillColor": {
                  "solid": {
                    "color": "#FFFFFF"
                  }
                }
              },
              {
                "$id": "hover",
                "transparency": 0,
                "fillColor": {
                  "solid": {
                    "color": "#000000"
                  }
                }
              }
            ],
            "outline": [
              {
                "show": true
              },
              {
                "$id": "default",
                "transparency": 0,
                "lineColor": {
                  "solid": {
                    "color": "#000000"
                  }
                }
              }
            ],
            "visualHeader": [
              {
                "show": false
              }
            ]
          }
        }
      }
    }

     

     

    • bernardoamaral's avatar
      bernardoamaral
      Frequent Visitor

      Hello Joshua,

       

      Thank you for your answer. In fact, this helped me apply the settings to the shapes as I wanted.

      However, I would like to apply different settings for different shaps (lines, rectangles, oval, etc.).

      Do you know if there is any way to define it? Our is there no possibility to select the type of shape that I want to apply settings?

       

      Regards

  • v-deddai1-msft's avatar
    v-deddai1-msft
    Community Support

    Hi Anonymous ,

     

    Would you please try to change the color for the shapes manually?

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Dedmon Dai

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Dedmon,

    this works after converting the shape. But that's not the point. This is my current JSON (partly):

    "basicShape": {
    			"*": {
    				"background": [{
    					"show": false,
                        "color": { "solid": { "color": "#ffffff" } },
                        "transparency": 20
                    }],
    				"line": [{
    					"lineColor": { "solid": { "color": "#323232"}},
    					"transparency": 0,
    					"weight": 3,
    					"roundEdge": 0
    				}],
    				"fill": [{
    					"show": false,
    					"fillColor": { "solid": { "color": "#ffffff"}},
    					"transparency": 100
    				}],
    				"title": [{
    					"show": false,
    				    "fontColor": { "solid": { "color": "#323232" } },
    				    "background": { "solid": { "color": "#ffffff" } },
    				    "alignment": "Left",
    				    "fontSize": 11,
    				    "fontFamily": "Segoe UI Light"
    				}],
    				"rotation": [{
    					"angle": 0
    				}],
    				"visualHeader": [{
    					"show": false
    				}],
    				"border":[{
    					"show":true,
    					"color": { "solid": { "color":"#CCCCCC" } },
    					"radius": 5
    				}]
    			}
    		}

    Now the code from above does not have any affect. I guess with the new shapes something else needs to change...


    Cheers

    Axel

    • v-deddai1-msft's avatar
      v-deddai1-msft
      Community Support

      Hi Anonymous ,

       

      It seems that something wrong with the custom shape by json file. I tried it also in the latest verison of power bi desktop cloud version, it didn't work also. 

       

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

       

      Best Regards,

      Dedmon Dai

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Dedmon,

        my version is an extended version of this:

        https://github.com/deldersveld/PowerBI-ThemeTemplates/blob/master/Shape.json

         

        {
        	"name": "ShapeTemplate",
        	"visualStyles": {
        		"basicShape": {
        			"*": {
        				"line": [{
        					"lineColor": { "solid": { "color": "#01B8AA"}},
        					"transparency": 0,
        					"weight": 3,
        					"roundEdge": 0
        				}],
        				"fill": [{
        					"show": true,
        					"fillColor": { "solid": { "color": "#DDDDDD"}},
        					"transparency": 0
        				}],
        				"rotation": [{
        					"angle": 0
        				}],
        				"visualHeader": [{
        					"show": false
        				}]
        			}
        		}
        	}
        }

        Of course, my code was only a part of a much larger JSON file... I assumed you would anticipate that. Sorry.

         

        Anyway: If we focus on the fill attribute the new shapes do not recognize the setting given in the JSON file. So my question is: were there any fundamental changes to how to setup the JSON file regarding the new shapes and if so, where is the documentation?

         

        Thanks in advance

        Axel