0

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.

2 Answers 2

2

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]);
}
0
0

series: [{ type: 'pie', name: '', data:

            }],
        x:[{        

                data:<?php echo $jastudentcount; ?> 
                }]

formatter: function() { return ''+ this.point.name +': '+'('+ this.y +')'+ Highcharts.numberFormat(this.percentage, 2)+' %'; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.