This is a migrated thread and some comments may be shown as answers.

[Solved] Populating pie chart at runtime

0 Answers 33 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pallab
Top achievements
Rank 1
Pallab asked on 02 Jul 2012, 03:18 AM
I am trying to populate a pie chart with a json call at runtime. I am successfully able to do so in a bar chart with code similar to this (found on another thread):
success: function (data) {
 
                // if the returned (echoed) ajaxId is the latest the client submitted then do something. If not then ignore
                var thechart = chart.data("tChart");
                // remove existing series
                while (thechart.options.series.length > 0) {
                    thechart.options.series.pop();
                }
 
                var categories = "";
                var colorIndex = 0;
                // Loop through the selected values and submit AJAX queries
                for (var i = 0; i < data.series.length; i++) {
                    //debugger;
                    thechart.options.series.push({
                        //color: colors[colorIndex],
                        name: data.series[i].seriesName,
                        type: "column",
                        data: data.series[i].seriesValue.split(',')
                    });
 
                }
 
                thechart.options.categoryAxis.categories = data.categories; //.split(',');
                thechart.refresh();
                thechart.rebind(data);
                
            }
However, I am not able to use this option for the pie chart. How can it be done?
Tags
Chart
Asked by
Pallab
Top achievements
Rank 1
Share this question
or