cartercjb
01-24-2022ETL
DONUT CHART DATA LABELS
Hello Sisense Community!
Any suggestions on how to make the data labels' percent appear underneath the categories, where the values currently are? In instances where a donut slice is too small (Cat...
- 01-25-2022
cartercjb Try this widget script :
widget.on('processresult', function(se, ev){ ev.result.plotOptions.pie.dataLabels.formatter = function(){ //return (this.key + '<br>' + Math.round(this.percentage) + '%') // to display only percentage in data label return (this.key + '<br>' + this.y + ' / ' + Math.round(this.percentage) + '%') //to display both value and percenatge in data label } })-Hari
- 02-18-2022
Please try this script. Update the variable 'displayTextMapping' with actual text and text you need to replace with. If there is no matching text found, it will take text from 'Default' key
var displayTextMapping = { 'LW' : 'Lori', 'THy' : 'Tracy', 'Default' : 'Carter' } widget.on('processresult', function(se, ev){ ev.result.plotOptions.pie.dataLabels.formatter = function(){ if(!displayTextMapping.hasOwnProperty(this.key)) displayText = displayTextMapping['Default'] else displayText = displayTextMapping[this.key] //return (this.key + '<br>' + Math.round(this.percentage) + '%') // to display only percentage in data label return (displayText + '<br>' + this.y + ' / ' + Math.round(this.percentage) + '%') //to display both value and percenatge in data label } })-Hari