Datetime axis label in highcharts -
i have plot getting data form mssql table in json format datetime axis labels shows 1 point. datetime format in json epoc format [1325397600000,1325484000000,1325570400000,1325656800000,1325743200000,1325829600000].
what possibly problem?
here code using:
$(document).ready(function() { var options = { chart: { renderto: 'container', type: 'line', marginright: 130, marginbottom: 60 }, title: { text: 'pressure , temperature', x: -20 //center }, subtitle: { text: '', x: -20 }, xaxis: { categories: [] type: 'datetime', }, yaxis: { title: { text: 'temperature ' }, plotlines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; } }, legend: { layout: 'vertical', align: 'right', verticalalign: 'top', x: -10, y: 100, borderwidth: 0 }, series: [] } $.getjson("data3.php", function(json) { options.xaxis.categories = json[0]['data']; options.series[0] = json[1]; options.series[1] = json[2]; chart = new highcharts.chart(options); }); });
in these lines:
options.series[0] = json[1]; options.series[1] = json[2];
you try add 2 series, based on json meanas try reference 1 point series, in other words construction means:
options.series[0] = 1325397600000; options.series[1] = 1325484000000;
i advice familiar correct series structure (data array included).
Comments
Post a Comment