Reputation: 2456
HI In highchart is there any way to give time on x-axis as below
1) pass start time
2) give an array of time points
3) give unit of time
for example
start time will set as pointStart: Date.UTC(timeArr[3],timeArr[1],timeArr[2],timeArr[4],timeArr[5]) where timeArr[3] -> year timeArr[3] -> year timeArr[1] -> month timeArr[2] -> day of month timeArr[4] -> hour timeArr[5] -> minute now set time intervals array as below [0,60,120,180,240] now give unit of time as 1000(which tells time in array is in seconds)
And then highchart plot the x-axis by starting from start date and then pick interval from time array and add to start time and create time for next datapoint
I ask this question because our old application uses JClass chart and I am converting from that and that works on the logic I give
Upvotes: 3
Views: 11402
Reputation: 3216
Set the initial date with pointStart:
plotOptions: {
column: {
pointStart: Date.UTC(2015, 1, 12) // feb 12, 2015
}
}
Set the interval in the xAxis:
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%e. %b',
week: '%e. %b',
month: '%b \'%y',
year: '%Y'
},
tickInterval: 24 * 3600 * 1000 // interval of 1 day (in your case = 60)
}
Test: http://jsfiddle.net/ppazos/jjn7noqg/
Upvotes: 5
Reputation: 17791
If I understand correctly, pointInterval is what you are looking for:
http://api.highcharts.com/highcharts#plotOptions.series.pointInterval
If that doesn't do what you need, then it should just be a matter of parsing your object to get it do what you need...
Upvotes: 2