mmalhame
09-19-2024Cloud Apps
How to Use the SwitchDimension Add-On
I am trying to create a line chart for which users can select the 'Break by' dimension. The user should be able to select whether to break out the line chart by choosing 1 of 2 different text fields....
- 09-20-2024
Hi mmalhame ,
I tried the same script in a line chart (just replacing the dimensions with those from my table), and it worked as expected. Here are a few things you might want to double-check:
Field Names: Ensure that the dimension fields you’re using in your script are correct and match exactly with those in your dataset.
Break By Dimension: Make sure you’ve added the “Break By” dimension in the line chart.
Also check if there is any error showing in the browser console.
Here is the script I used:prism.registerSwitchDimension({ widget: widget, maxItemsBeforeSubMenuIsCreated: 5, //optional dimensions: [ { panel: 'break by', affectAllWidgets: true, //optional (true|false) dims: [ { "index": 0, "dim": "[Commerce.Age Range]", "datatype": "text", "title": "Applied Rate Class" //optional //"widgetTitleTemplate": "" //optional }, { "index": 0, "dim": "[Commerce.Condition]", "datatype": "text", "title": "Approved Rate Class" //optional //"widgetTitleTemplate": "" //optional } ] } ] });
Result:
-Hari