javascript - Plotting the below json in a HighChart -


following json object in json format 1.1

    {        "jsonversion":1.1,        "databehaviour":"timebased",        "measurementunit":"mb",        "error":"",        "dataseries":[           {              "name":"availablembytes",              "data":[                 {                    "x":1396602300000,                    "y":"1156"                 },                 {                    "x":1396605900000,                    "y":"1137.05"                 }              ]           }        ] } 

is possible plot data in high chart? code this, doesn't show output.

$(document).ready(function() {     var options = {         chart: {             renderto: 'container',             type: 'spline'         },         series: [{}]     };      $.getjson('data.json', function(data1) {         options.series[0].data = data1.data;         var chart = new highcharts.chart(options);          });  }); 

if array shown in question , iterate on here link working demo

the json need have number instead strings:

{    "jsonversion":1.1,    "databehaviour":"timebased",    "measurementunit":"mb",    "error":"",    "dataseries":[       {          "name":"availablembytes",          "data":[             {                "x":1396602300000,                "y":1156              },             {                "x":1396605900000,                "y":1137.05             }          ]       }    ] } 

and charting code

$.getjson('data.json', function(data1) {      options.series[0].data = data1.dataseries[0].data;     options.series[0].name = data1.dataseries[0].name;     var chart = new highcharts.chart(options);      }); 

you can directly put "item" in series has name data in it.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -