Pages

Monday, July 22, 2019

Einstein Analytics: Gauge chart

In Einstein Analytics Gauge chart, there is only 1 value to set, which is for the needle, you can set the value from a query in step. While the value of the breakpoint are static by default, you can set Min and Max value from the user interface, but if you want to set other the breakpoint values (medium is 1/3 and high is 2/3 by default), you can set them from dashboard JSON, then also set applyConditionalFormatting to false from dashboard JSON.

But can we make the breakpoints and max numbers to be dynamic? Yes, we can use binding to make those numbers dynamic. There are 4 points can be configured:
  • min: usually this is 0
  • medium: usually this is X% of max
  • high: usually this is Y% of max
  • max: usually this is the target

Step-1. Prepare Breakpoints
Use a compare table to prepare the medium, high, and max numbers. For my use case, I'll query to get the max number from a dataset, then calculate medium = 60% of max, and high = 90% of max as breakpoints.


Clip the lens (compare table) to the dashboard, let's name it "breakpoints", then drag it to the dashboard temporarily, we will display the numbers temporary to make sure the numbers are correct. Note down the query name created, this will be used for "Step-3" below.


Step-2. Add Gauge Chart
Drag a gauge chart, select the dataset and value for the needle, and add filters (if necessary).



Step-3. Bind Breakpoints defined into Gauge chart
Note down the Widget Id (not Query Id), switch to dashboard JSON mode, looks for max, high and medium parameters.
Update the value with result binding, use the step created in "Step-1".
"medium": "{{cell(breakpoints.result,0,\"Medium\").asString()}}"
"high": "{{cell(breakpoints.result,0,\"High\").asString()}}"
"max": "{{cell(breakpoints.result,0,\"Max\").asString()}}"

* Medium, High, Max in the column name in "Step-1".


Step-4. Remove Conditional Formatting
Still in dashboard JSON, at the chart parameter, look for applyConditionalFormatting, and change this to false, by default this is true.


Step-5. Done
Here is the result








No comments:

Post a Comment

Page-level ad