Show count of records on graph data label?

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
I attempted to search for this but could not find much about this.

Below I attached a screenshot of a chart I made, but a request has been made to show the number of records that represent each piece of the pie, is this possible to show on the data label itself (ex. "Corporate (8)", "Franchise (30)")?

Photo of Tyler Neal

Tyler Neal

  • 760 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Mansour

Mansour

  • 1,932 Points 1k badge 2x thumb
Very possible (see screenshot).
You will have to add a Javascript snippet, and add that snippet to the chart in the advanced section.

var chartObj = arguments[0],
	$ = skuid.$;
$.extend(true, chartObj.plotOptions,{
        pie: {        
                dataLabels: {
                   format: "{point.name} - {point.y:,.0f} ",
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'black',
            }
        }        
});
(Edited)
Photo of Tyler Neal

Tyler Neal

  • 760 Points 500 badge 2x thumb
This worked perfectly!  Thank you!