Display Sum in Chart

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
I'm attempting to modify my charts to export the SUM of the slice when exporting.  

I have a pie chart that shows the various products a customer has purchased. I have a series that sums the revenue and then splits it up by name.

This is great for when the user is viewing the chart in skuid, but when they export it, the SUM values are not displayed since it ONLY displays on mouse over.

I attempted to modify the code from this post:
https://community.skuid.com/skuid/topics/show-percentage-lables-in-charts

I can't seem to figure out how to display the split. I can get it to display the total for the series but not by slice.  



How do I modify the following JS snippet to display the sums of the individual slices and not the sum of all slices? 


var chartObj = arguments[0],
$ = skuid.$; $.extend(true, chartObj.plotOptions,{ pie: { dataLabels: { enabled: true, formatter: function () { return this.point.name + ' ' + this.point.total; } } } }); $.extend(chartObj,{ tooltip: { enabled:false } });
Photo of Will Koscielny

Will Koscielny

  • 212 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Will Koscielny

Will Koscielny

  • 212 Points 100 badge 2x thumb
Does anyone have any ideas on this?
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,210 Points 5k badge 2x thumb
Will~

Is this what you are trying to do: show values on the different slices of a pie chart?


If so, here is what the back end looks like:

Create a JavaScript resource on your page, here I named it ChartSnippet: 


Here is what the Snippet Body has in it: 


var chartObj = arguments[0], $ = skuid.$;
$.extend(true, chartObj.plotOptions,{
        pie: {
            dataLabels: {
                enabled: true,
                formatter: function (){
                    return this.point.name+ ' $'+this.y;
                }
            }
        }
});
$.extend(chartObj,{
    tooltip: {
        enabled:false
    }    
});

Call on this snippet from the chart: 


Let me know if this works or not for you.

Thanks!
Karen