0👍
✅
Figured it out. I used a function to add all the values for people registered and then passed that to my function that draws the pie chart.
In my case statment:
case 4:
groupData = defineGroupDataArray();
var totalAttendees = 0;
$.each(groupValue.Data,
function(statIndex, statValue) {
groupData.labels.push(statValue.Description);
groupData.datasets[0].data.push(statValue.Count);
groupData.datasets[0].backgroundColor.push(seriesColors[statIndex]);
totalAttendees += statValue.Count;
});
drawAttendeesByAreaChart(animate,totalAttendees);
break;
In the draw chart function:
function drawAttendeesByAreaChart(animate,totalAttendees) {
$("#attendbyarea").remove();
$("#attendbyarea-container").append('<canvas id="attendbyarea"></canvas>');
$("#attendbyarea-header").text("Attendees by Area ("+ $.number(totalAttendees) +")");
...rest of code...
};
Source:stackexchange.com