How to parse JSON into HighCharts line graph? How to parse JSON into HighCharts line graph? json json

How to parse JSON into HighCharts line graph?


As far as I can tell your data seems to be well formed. So, this should do it:

var chart;$.getJSON('http://localhost:8080/UDPver/tagdiscover', function(data) {  // Populate series  options.series = data;      // Create the chart  chart = new Highcharts.Chart(options);});


The problems is that the chart then is redrawn. So if you have other lines that is disabled (from legend), it will be visible agian when you do a update.I have 5 lines in my graph. It is updated every second. From the legend I can disable/remove some of the lines from the graph.But using this method above (it works) the complete graph is redrawn and all lines is visible again. Is it possible to just update the series (lines) and not the paramaters?

Like this (not working):

function doAjaxData() {            AjaxLoadingIcon(1);            $.ajax({                url: getAjaxUrl(1),                dataType: 'json',                cache: false,                async: true,                success: function (json) {                    AjaxLoadingIcon(0);                    gchartOptions.series = [];                    gchartOptions.series = json;                    // gchart = new Highcharts.Chart(gchartOptions);                    gchart.render();                    _updateTimer = window.setTimeout("doAjaxData()", 1000);                    }                }            });        }


Atma.You just should write just dataitem instead of dataitem[i] and it will work.

  $.each(data, function(i,item){    alert(item.name);    series.name = item.name;    $.each(item.data, function(j,dataitem){      alert(dataitem);      series.data.push(parseFloat(dataitem[i]));                      });  });