Explore Dashboard
By submitting this form, I agree to Sisense's
privacy policy and terms of service.
Watch a Sisense Demo
By submitting this form, I agree to Sisense's
privacy policy and terms of service.
The Switchable Dimensions add-on allows you to provide several views of your data.
With the Switchable Dimensions add-on, you can easily toggle between dimensions displayed in a widget.
The Switchable Dimension add-on can be set for categories, values, rows, columns or any other dimension that exists in a widget.
prism.registerSwitchDimension({ widget: widget, maxItemsBeforeSubMenuIsCreated: 5, //optional dimensions: [ { panel: '<PANEL_NAME>', affectAllWidgets: true, //optional (true|false) dims: [ { "index": 0, "dim": "[<TABLE_NAME>.<FIELD_NAME>]", "datatype": "<DATATYPE>", "title": "", //optional "widgetTitleTemplate": "" //optional }, { "index": 0, "dim": "[<TABLE_NAME>.<FIELD_NAME>]", "datatype": "<DATATYPE>", "title": "", //optional "widgetTitleTemplate": "" //optional } ] } ] });
Example 1
The widget script below allows you to switch between Country, Brand & Category, and by week for the Categories panel and Age Range, Gender for the Break-by panel. Switching between dimensions in the Break-by panel will affect all widgets from a dashboard that has the Break-by panel.
prism.registerSwitchDimension( { widget: widget, dimensions: [ { panel: ‘categories’, dims: [ { “index”:0, “dim”:” [country.Country]”, “datatype”: “text”, “title”:”Country” }, { “index”:0, “dim”:”[brand.Brand]”, “datatype”: “text”, “title”:”Brand” }, { “index”:0, “dim”:”[category.Category]”, “datatype”: “text”, “title”:”Category” }, { “index”:0, “dim”:”[dimDate.Date]”, “level”: “weeks”, “datatype”: “datetime”, “title”:”Weeks” }]}, { panel: ‘break by’, affectAllWidgets: true, dims: [ { “index”:0, “dim”:”[Commerce.Age Range]”, “datatype”: “text”, “title”:”Age range” }, { “index”: 0, “dim”: “[Commerce.Gender]”, “datatype”: “text”, “title”: “Gender” } ] } ] });
Example 2
The widget script below allows you to switch between two dimensions: Date (in weeks) <-> Strategy
Where:
There are two things you need to adjust in your Switchable Dimension code:
1. Add (Calendar) to the “dim” parameter for any date. For example:
{ "index":0, "dim":"[Commerce.Date (Calendar)]", "datatype": "datetime", "title": "Weeks" }
2. Add level parameter to the Date dim, which correspond to the required time granularity:
{ "index":0, "dim":"[Commerce.Date (Calendar)]", "level": "weeks", "datatype": "datetime", "title": "Weeks" }
As a result, your script will look like this:
prism.registerSwitchDimension({ widget: widget, dimensions: [ { panel: 'categories', dims: [ { "index":0, "dim":"[dimDate.Date (Calendar)]", "datatype": "datetime", "title":"Weeks", "level": "weeks" }, { "index":0, "dim":"[dimStrategy.strategy]", "datatype": "text", "title":"strategy" } ] } ] });
18 May 2020 – Fixed bug where add-on changes dimension only for one widget on the dashboard
9 October 2019 – Added possibility to change date-time granularity