The Measure Changer Widget
Download: Measure Changer
Introduction
Dimension Changer Widget Plugin allows the user to display several values on one widget with easy values switching on the same chart visualization.
The purpose is to display several related values in one chart in a simple and easy way.
The Dimension Changer Widget Plugin can be used in Column Chart, Pie Chart, Bar Chart, Line Chart and Pivot.
Important: The Dimension Changer Widget Plugin does not support ranking filter (Top x).
The Dimension Changer Widget Plugin works on V5.7. and up.
Example
In this example we choose 3 values to switch between in the Dimension Changer Widget Plugin.
Above we see the Dimension Changer Widget and below we see the Column chart it affects.
The data presentation in the chart below changes according to the value chosen in the Dimension Changer Widget above. You can see the chosen value marked in green.
In this example we see that clicking on a value changes the data visualization in the graph - from Total revenues to Total Quantity.
Steps
In order to add the Dimension Changer Widget Plugin to affect a chart, please follow the listed steps below:
Step 1:
Download and extract the enclosed folder into the plugins folder:
C:\Program Files\Sisense\PrismWeb\plugins\DimensionChanger, if the "plugins" folder is not there, please create it. If you are using version 7.2 and higher unzip the contents into your C:\Program Files\Sisense\app\plugins\ folder.
Step 2:
Create a Column Chart/ Bar Chart/ Line Chart/ Pivot.
The Dimension Changer Widget Plugin supports more than one chart value (but affects only one).
Step 3:
Create a Dimension Changer
For Charts:
Put the values you wish to display and change between them under value.
The first value will appear first in the chart. Leave Rows empty.
For Pivots:
Put the rows you wish to display and change between them under rows.
The first row will appear first in the chart. Leave Values empty.
Save the widget.
Step 4:
Refresh the Widget and click apply
The chart should appear with the Plot Line chosen and configuration.
Attached is an example for a dashboard with Dimension Changer Widget Plugin. (connects to Sample Ecommerce data).
DimentionChangerPlugin.dash
Release Notes:
January 09, 2018 - the plugin was updated with the following:
- Fixed widget not working in V6.7 and V7 in some scenarios
- Fixed In export to PDF layout of widgets distorted
- Added robust configuration via design pane
June 23, 2020 - the plugin was updated with the following:
- Fixed plugin.json manifest to support Sisense v8.2
- Updated readme with script samples
-
Hi,
Thank you for this plugin - I definitely think it's supposed to be as part of the market place plugins.
I come across with two critical problems:
- I can't use two different number displays using this plugin such as number and percentage.
I want to switch between "Sales value" and "Share of Sales %". - The chart can be sort by each of the measures - important functionality when you look at many items.
Are you aware of that? Can you update if you will change it in the future?
Thanks,
Sharon.
- I can't use two different number displays using this plugin such as number and percentage.
-
hi Sharon Morad
I use a custom script in the measure changer to accomplish this. After setting the 'format' like this
You can use this custom script in the dimension changer, which will then apply the formatting when it applies the measure to the target widget(s).widget.on('render', function (w, e) {
// TODO set target widgets here, replace the id value(s) with the id of the target widget(s).
e.widgetIds = [
{
id: '44ffffffffffffffffffffff',
panelToChange: 'values',
index: 0
},
{
id: '44fffffffffffffffffffffe',
panelToChange: 'values',
index: 0
}
];
function dimClicked(ex) {
let titleToFind = ex.target.innerText;
let targetDim = getDimByTitle(titleToFind);
for (var i = e.widgetIds.length - 1; i >= 0; i--) {
let widgetId = e.widgetIds[i].id;
let widgetToApplyOn = getWidgetById(widgetId);
if (widgetToApplyOn) {
let item = widgetToApplyOn.metadata.panel(e.widgetIds[i].panelToChange.toLowerCase()).items[e.widgetIds[i].index];
if (item) {
item.jaql = targetDim.jaql;
item.format = targetDim.format;
widgetToApplyOn.changesMade();
widgetToApplyOn.refresh();
}
}
}
return (true);
}
function getDimByTitle(title) {
let dimension = w.rawQueryResult.metadata;
for (let i = dimension.length - 1; i >= 0; i--) {
if (dimension[i].jaql.title.toUpperCase() === title.toUpperCase())
return (dimension[i]);
}
}
function getWidgetById(widgetId) {
var widgets = $$get(widget, 'dashboard.widgets.$$widgets');
for (var i = widgets.length - 1; i >= 0; i--) {
if (widgets[i].oid === widgetId)
return (widgets[i]);
}
}
$(document.body).on('click', 'widget[widgetid= ]', dimClicked);
}); -
We have kind of a new problem with this widget, upgrading from 7.4 to 8.2.3. We've installed version 1.0.1 of this plugin.
Basically, it's breaking our dashboards in a weird way: users get kicked entirely out of Sisense when they try to pull up a dashboard containing this widget. If we look at the browser dev tools, we see a PUT request issued to /api/dashboards/5f171da4f14bf475fc2ee6c8/widgets/5c192249b315da4e20cc3b3d (modulo exact ids, of course). The response to that request is 403 ("Forbidden", meaning *unauthorized as opposed to unauthenticated*, if I understand things correctly), and then the user is kicked out to our portal.
If I delete the widget and create it from scratch, I have no trouble, and it seems to be working properly, so that's a possible solution. However, I'd prefer not to have tell our users they need to go into each dashboard (of which we have many), delete the widget, and recreate it.
So. Has anybody seen this sort of thing? Any ideas on a fix?
(I tried Weinan's suggestion of changing "pluginInfraVersion" to just "version", but that did not help.)
-
Hi Barry Gaffey,
I'm facing the same issue as Sharon where I can't use multiple value formats in my target widget of the measure changer. I tried following your instructions of updating the value formats in the measure changer and inputting the widget script you provided, as shown below:
After saving, I don't see any changes reflected for the value formats as shown here:
Is there anything that looks wrong in the script that I inputted?
Thanks!
Please sign in to leave a comment.
Comments
67 comments