score:2

Two way of adding series to your chart:

  1. Create the whole chart when ajax call ends successfully (thus creating series prior to invoke new Highcharts.Chart), see code below
  2. Programmatically adding points to the (already) rendered chart

Example 1 (didn't try this, i'm just remembering the chart struncture):

// Create the options object without calling New Highcharts.Chart
var Options = { chart: { renderTo: 'container' } };

$.get('Newchart.aspx', function(data) {
   var fulldata = document.getElementById("MyHiddenField").value;
   var lines = fulldata.split('$');

   var series = []; // Array of series to be filled

   // Then loop each line and create one series for each line
   $.each(lines, function(lineno, line) {
      // Extract name and x/y values (e.g. [[x1, y1], [x2, y2]] from current line
      var name, values; 
      var current = { name : name, data : values };
      series.push(current); // Push current series
   });

   // Inizialize the chart
   Options.series = series;
   var chart = new Highcharts.Chart(Options);
});

Example 2: take a look here. Basically create a new instance of the chart and then call addSeries() inside success function.


Related Query

More Query from same tag