javascript - Highcharts proper usage of datetime? -
my current setup static xaxis categories , tickinterval(cant see graph without tickinterval).
if change screen resolution looks bad , have x-axis dynamic.
what i've gathered should use data http://www.highcharts.com/samples/data/usdeur.js , xaxis below?
xaxis: { type: 'datetime' }
but example uses yymmdd, use hh:mm:ss.
currently looks this: i.imgur.com/v649otj.png
xaxis: { categories: getjson('date'), tickinterval: 20 }, series: [ {name:'cars', data: getjson('values')}, ]
data:
getjson('date') equals: array [ "2014-11-09 02:36:00", "2014-11-07 07:35:00", "2014-11-08 20:29:00", "2014-11-08 20:30:00", "2014-11-10 11:06:00", "2014-11-08 08:12:00", "2014-11-08 20:31:00", "2014-11-08 20:23:00", "2014-11-08 20:24:00", "2014-11-08 20:25:00", 190 till… ] getjson('values') equals: array [ 13, 209, 209, 19, 0, 209, 15, 13, 13, 19, 190 till… ]
so how make use of data , datetime configuration. somehow push 'date'-data same array 'values' , convert right date format?
edit: current work: http://jsfiddle.net/tws8x0pd/4/
datetime
configuration uses utc
numbers not yymmdd
! should pass datetime data date.utc(year,month,day,hour,minute,second)
in series data
format:
series: [ {name:'...', data: [ [ date.utc(year,month,day,hour,minute,second), value ], [ date.utc(year,month,day,hour,minute,second), value ], ... ] } ]
so should year,month,... out of json
date , put corresponding value in json
values. each in 1 array, not apart in separate arrays.
Comments
Post a Comment