Remove N/A category from chart
Sometimes we have N/A category with no information related or unnecessary visualization.
Here is a quick way to remove N/A category with data attached:
here is such an example:
when we drill down by region we will get N/A column which we don't care about.
1. copy and paste the following script in the widget script
widget.on('render', function(se, ev){
var removeCategory = 'N\\A';
var categories = se.queryResult.xAxis.categories; // get the categories
var series = se.queryResult.series; // get the series
var catIndex = categories.indexOf(removeCategory); // find N/A category
if(catIndex != -1){ // if N/A category found
categories.splice(catIndex, 1); // remove it from category list
// remove data at the same index
_.each(series, function(ser){
ser.data.splice(catIndex, 1);
})
}
})
this script can be used to remove any other category by changing the string 'removeCategory'.
result:
removeNAFromChart.js
Please sign in to leave a comment.
Comments
0 comments