javascript - highcharts: epoch time not properly connected to Xaxis -
javascript - highcharts: epoch time not properly connected to Xaxis -
when have inconsistent info coming in (when illustration server gathers info down) highcharts not plot x correctly. still plots there info on x while there not. should afcouse plot right hr when there data. here fiddle: http://jsfiddle.net/zvwfk/ info variable inconsistant!
can show me how can right error?
$(function () { var chart; $(document).ready(function() { chart = new highcharts.chart({ chart: { renderto: 'container', type: 'spline', margin: [50,130,90,100] }, title: { text: 'weather today' }, credits: { enabled: false }, subtitle: { text: 'test' }, xaxis: { type: 'datetime', datetimelabelformats: { day: '%h:%m' }, tickinterval: 3600 * 1000, labels: { rotation: -45, align: 'right', style: { fontsize: '10px', fontfamily: 'verdana, sans-serif' } } }, yaxis: [{ title: { text: 'temperature c' }, opposite: false, minorgridlinewidth: 0 }, { title: { text: 'humidity %' }, minorgridlinewidth: 0, opposite: true }, { opposite: true, title: { text: 'air pressure level hpa', minorgridlinewidth: 0, }, }], tooltip: { formatter: function() { if(this.series.name === 'temperature') { homecoming ''+ highcharts.dateformat('%h:%m',this.x) +': '+ this.y + ' c'; } if(this.series.name === 'humidity') { homecoming ''+ highcharts.dateformat('%h:%m',this.x) +': '+ this.y + ' %'; } if(this.series.name === 'air pressure') { homecoming ''+ highcharts.dateformat('%h:%m',this.x) +': '+ this.y + ' hpa'; } } }, plotoptions: { spline: { linewidth: 4, states: { hover: { linewidth: 3 } }, marker: { enabled: false, states: { hover: { enabled: true, symbol: 'circle', radius: 3, linewidth: 1 } } } } }, series: [{ name: 'temperature', data: temp, type: 'spline', /* yaxis: 0, */ shadow: true, showinlegend: true, pointinterval: 60 * 1000, /* pointstart: date.utc(2006, 0, 1),*/ dashstyle: 'solid', marker: { enabled: false } } , { name: 'humidity', data: hum, yaxis: 1, shadow: false, showinlegend: true, pointinterval: 60 * 1000, type: 'line', dashstyle: 'dot', marker: { enabled: false } }, { name: 'air pressure', data: bar, yaxis: 2, shadow: false, showinlegend: true, pointinterval: 60 * 1000, type: 'line', dashstyle: 'shortdot', marker: { enabled: false } }], navigation: { menuitemstyle: { fontsize: '6px' } } }); }); });
there 2 ways of specifying time info highcharts , think using wrong way problem. it's sec style should utilize when having gaps in data.
a compact array without gaps containing values each time-point
data: [2, 5, 3, 6, 1] then specify time-point first measure interval. eg:
pointstart: date.utc(2013,1,12), // start point in milliseconds pointinterval: 3600 // interval in milliseconds you cannot have different length between time-points way.
a 2 dimensional array both time-points , measure
data: [[date.utc(2013,1,12), 2], [date.utc(2013,1,12), 5], [date.utc(2013,1,12), 3], ...] this way of specifying array can have gaps there's no data.
see reference here , illustration here.
javascript highcharts
Comments
Post a Comment