Reputation: 537
I'm using the pie chart and just have a question. I'm filling a couple of arrays with json data like this...
for (var i = 0; i < json.results.length; i++) {
r = json.results[i];
a_dataPerct.push(r.Percentage);
a_dataOptionName.push(r.OptionName);
}
In the series: data: property of the chart (I'm assuming this is where it would go??) when I just do this...
data: a_dataPerct
the percentages show up fine on the chart and the chart displays, but it says "Slice" for each section.
I want the a_dataOptionName values to be the names there instead of "Slice". How do I do that? I thought it might be like this...
data: a_dataOptionName,a_dataPerct
but it didn't like that.
Upvotes: 0
Views: 1950
Reputation: 1
series: [{ type: 'pie', name: '', data:
}],
x:[{
data:<?php echo $jastudentcount; ?>
}]
formatter: function() { return ''+ this.point.name +': '+'('+ this.y +')'+ Highcharts.numberFormat(this.percentage, 2)+' %'; }
Upvotes: 0
Reputation: 890
The pie charts data is a twodimentional array with [name, number], like this:
for (var i = 0; i < json.results.length; i++) {
r = json.results[i];
a_dataPerct.push([r.OptionName, r.Percentage]);
}
Upvotes: 2