Modifying the ‘Others’ Slice in the Pie Chart
By default, the 'Others' slice of the Pie Chart is set to include all categories below 3%.
You can manually change this to another value. The change will be applied to all the Pie Charts.
Solution:
- Open the following file with a Notepad editor. (Create a backup first.):
For V7.1 and earlier: C:\Program Files\Sisense\PrismWeb\client\js\app-main.js.
For V7.2 and later: C:\Program Files\Sisense\app\client\js\app-main.js. - Search for the following attribute: pieMinimumSliceAngle and change its value as needed, then save:
- After the configuration, clear the browser cache for the new script to apply.
- Run IISRESET in the command line.
Before:
After:
-
This is great, but is there a way to manually choose which values get grouped into 'Others' instead of the dynamic percentage?
I have a client with a list of 6 values they want to see and everything else is grouped into Others. One of the values they want to see is Executive w/ only 0.43%, but they do not want to see Company or Accountant so a percentage threshold will not work.
-
Hey Jessica,
There are a few solutions that could work in this case. The easiest would be to create a new field in the backend that is either the name of one of the 6 required values, or will default to Others if not one of the 6. Then you can group off of that new field, and everything that is Others will get grouped there.
Another option would be to add a widget script that goes through the series and starts regrouping the categories that are in other. First would be to leverage the plugin to make the minimum slice % 0. Then another widget script which would be something like this:
var displayCategories = ["Andrew Green", "Ben Franklin", "Rahul Patel"];
widget.on('processresult', (el, args) => {
//args.result.series[0].data.push();
var newSeries = Object.assign({}, args.result.series[0]);
newSeries.data = [];
var series = Object.assign({}, args.result.series[0]);
var otherCategory = Object.assign({}, series.data[0]);
otherCategory.queryResultIndex = series.data.length;
otherCategory.sliced = false;
otherCategory.x = series.data.length;
otherCategory.name = 'Others';
otherCategory.y = 0; //Temporarily store 0 as the value
otherCategory.selectionData = {};
otherCategory.color = 'black';
otherCategory.content = [];
otherCategory.drilldown = 'Others';
var dataPoints = 0;
series.data.forEach((item, index) => {
if(displayCategories.indexOf(item.name) === -1) {
otherCategory.y += item.y;
otherCategory.selectionData[dataPoints] = item.name;
otherCategory.content.push(item);
dataPoints += 1;
} else {
newSeries.data.push(item);
}
});
newSeries.data.push(otherCategory);
args.result.series[0] = newSeries;
});This is definitely a work in progress, but illustrates the idea that you can group things in any way you want.
Hope this gives you a good framework for solving this usecase.
Best, Elliott
Please sign in to leave a comment.
Comments
3 comments