如何将日期时间分配给间隔和日期开始的高图 [英] how to assign date time to highchart with intervals and date start
问题描述
1)通过开始时间
2)给出一个在x轴上有时间的方法时间点数组
3)给出时间单位例如
<$ p $
开始时间将设置为
pointStart:Date.UTC(timeArr [3],timeArr [1],timeArr [2],timeArr [4],timeArr [5])
其中timeArr [3] - >年份
timeArr [3] - >年份
timeArr [1] - >月份
timeArr [2] - >月份日期
timeArr [4 ] - >小时
timeArr [5] - >分钟
现在设定时间间隔阵列如下
[0,60,120,180,240]
现在给单位的时间为1000(它告诉时间在数组中是以秒为单位)
然后highchart从开始日期开始绘制x轴,然后从时间数组中选择时间间隔并添加到开始时间并为下一个数据点创建时间
我问这个问题是因为我们的旧应用程序使用JClass图表,我正在转换,它适用于我给出的逻辑
plotOptions:{
列:{
pointStart:Date.UTC(2015,1,12)// 2015年2月12日
}
}
在xAxis中设置时间间隔:
xAxis :{
type:'datetime',
dateTimeLabelFormats:{
second:'%H:%M:%S',
分钟:'%H:%M',
小时:'%H:%M',
日:'%e。 %b',
星期:'%e。 %b',
month:'%b \'%y',
year:'%Y'
},
tickInterval:24 * 3600 * 1000 // interval 1天(在你的情况下= 60)
}
测试: http://jsfiddle.net/ppazos/jjn7noqg/
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
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/
这篇关于如何将日期时间分配给间隔和日期开始的高图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!