A column chart splits the data by one or more dimensions and we have to manually sum up or create a separate widget to find total value of each dimensions.
The script below displays total value of each dimensions/items along with legend
Steps:
Create a bar/column/line/area chart
Add below script to widget
Save the script and refresh widget
widget.on('processresult', function(se, ev){
ev.result.legend.labelFormatter = function(){
legendSeries = ev.result.series.find(el=>el.name == this.name)
totalValue = 0
$.each(legendSeries.data, function(index, value){
totalValue = totalValue + value.y
})
myItem = se.metadata.panels[1].items[0]
myMask = $$get(myItem, "format.mask", {})
var numberFormatter = prism.$injector.get('$filter')('numeric');
formattesValue = numberFormatter(totalValue, myMask);
return this.name + '<span style="color:#838584; font-size:12.5px"> <b> (' + formattesValue + ')</b></span>'
}
})
Comments