# How to Make the Gauge Chart Dynamic Again

09. August 2018 3

Several have asked me “how do we do the dynamic gauge post Summer18 release?”. Why? Well, when the gauge chart was released I wrote a blog on how to make the ranges dynamic; a great use case for actual vs. quota. On top of that, it was often a question I got when I worked with standard reporting in Salesforce, people really like that the ranges in the gauge are dynamic. However, since the introduction of conditional formatting and the asset XMD in Summer18 if you follow the steps in the blog I wrote back in June 2017 you will no longer be successful. Therefore I decided to try and solve this puzzle (and the many questions I got) and luckily I was successful so this blog will demonstrate how you can make the gauge chart dynamic again.

### Get the basics down

So the steps that I covered in “How to make your Gauge chart dynamic” still apply. You need to make sure you have the following:

• Your gauge chart
• Your breakpoint calculations
• The breakpoint bindings

So basically you need to follow the whole blog! Once you have that there is one more action to take in the Dashboard JSON.

### The secret trick

Before going into the JSON make sure you notice the widget name of your gauge. You can do this by clicking on your gauge chart and in the property panel to the right you will see two tabs “Widget” and “Step”, make sure you are on the “Widget” tab and one of the first things you see is the name or ID of the widget.

With that memorized now go to your Dashboard JSON by hitting command+E (Mac) or control+E (Windows).

You can now search for the widget that you just looked at; in my case ‘Chart_1’. In order to search in the Dashboard JSON hit command+F (Mac) or control+F (windows) and type in the widget name of the gauge.

The JSON for that widget should look something like this:

``` "chart_1": {
"parameters": {
"max": "{{cell(BP_1.result,0,\"Max\").asString()}}",
"showPercentage": true,
"visualizationType": "gauge",
"exploreLink": true,
"medium": "{{cell(BP_1.result,0,\"Mid\").asString()}}",
"title": {
"fontSize": 14,
"subtitleFontSize": 11,
"label": "",
"align": "center",
"subtitleLabel": ""
},
"trellis": {
"flipLabels": false,
"showGridLines": true,
"size": [
100,
100
],
"enable": false,
"type": "x",
"chartsPerLine": 4
},
"bands": {
"high": {
"color": "#008000",
"label": "High"
},
"low": {
"color": "#B22222",
"label": "Low"
},
"medium": {
"color": "#ffa500",
"label": "Medium"
}
},
"showRange": true,
"showLabel": true,
"showValue": true,
"high": "{{cell(BP_1.result,0,\"High\").asString()}}",
"columnMap": {
"trellis": [],
"plots": [
"sum_Amount"
]
},
"min": 0,
"angle": 240,
"theme": "wave",
"step": "Gauge_1",
"applyConditionalFormatting": true,
"legend": {
"show": false,
"inside": false,
"showHeader": true,
"position": "right-top"
}
},
"type": "chart"
},```

You may have noticed that my naming is not consistent with the original blog, but that is alright the idea is the same. The only real difference is that with Summer18 you can create a column alias in compare tables, which means we don’t have to use ‘A’, ‘B’ and ‘C’ when referencing columns, we can just use the alias. Hence my bindings are using ‘Max’, ‘High’ and ‘Mid’.

Now the other change is there is a key called applyConditionalFormatting; I’ve highlighted it in the JSON above. This key is what we need to change. By default, it is set to ‘true’ but we want to change that to ‘false’. The JSON for that chart should now look like this:

``` "chart_1": {
"parameters": {
"max": "{{cell(BP_1.result,0,\"Max\").asString()}}",
"showPercentage": true,
"visualizationType": "gauge",
"exploreLink": true,
"medium": "{{cell(BP_1.result,0,\"Mid\").asString()}}",
"title": {
"fontSize": 14,
"subtitleFontSize": 11,
"label": "",
"align": "center",
"subtitleLabel": ""
},
"trellis": {
"flipLabels": false,
"showGridLines": true,
"size": [
100,
100
],
"enable": false,
"type": "x",
"chartsPerLine": 4
},
"bands": {
"high": {
"color": "#008000",
"label": "High"
},
"low": {
"color": "#B22222",
"label": "Low"
},
"medium": {
"color": "#ffa500",
"label": "Medium"
}
},
"showRange": true,
"showLabel": true,
"showValue": true,
"high": "{{cell(BP_1.result,0,\"High\").asString()}}",
"columnMap": {
"trellis": [],
"plots": [
"sum_Amount"
]
},
"min": 0,
"angle": 240,
"theme": "wave",
"step": "Gauge_1",
"applyConditionalFormatting": false,
"legend": {
"show": false,
"inside": false,
"showHeader": true,
"position": "right-top"
}
},
"type": "chart"
},```

With this done hit ‘Done’ in the top right corner and your gauge should yet again be dynamic.

## 3 thoughts on “How to Make the Gauge Chart Dynamic Again”

• Robert Greaves on December 12, 2018

Hi Rikka,

Do you know of any way to NOT have the value the same color as where the gauge arrow is pointing? I have a customer who wants that number to stay black and not adopt the gauge color.

Robert

• Detti on January 7, 2019

Unfortunately it is not working for me 🙁 Is there anything else what might be set up incorrectly? It is not changing the angle either.

• Rikke on January 7, 2019

Did you check if you added your binding to the widget? It won’t work if you add it to the step.

This site uses Akismet to reduce spam. Learn how your comment data is processed.