2013-06-05 182 views
2

HI在highchart有任何方法,得到时间上的x轴,如下如何分配日期时间间隔和日期highchart开始

1)通过开始时间
2)得到的时间点的数组
3)得到的时间单位

例如

 
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) 

然后通过从开始日期开始highchart绘制在x轴上,然后从时间阵列拾取间隔,并加入到启动TI我和接下来的数据点

我问这个问题,因为我们的旧应用程序使用JCLASS图表,我从转换和工作在我给

+0

请选择一个有效的答案,如果任何问题的答案为你工作。 –

回答

1

如果我理解正确的逻辑创建时间,pointInterval是你是什么寻找:

http://api.highcharts.com/highcharts#plotOptions.series.pointInterval

如果没有你所需要的,那么它应该只是解析你的对象得到它你需要什么样的问题?

+0

其实我也想给出一系列数据系列的秒数。并且该数组将用于所有数据系列。因此,对于每个数据系列点,秒将从该数组中取出并将添加到开始时间 –

+0

因此,您可以使用pairs [x,y],其中x是时间戳记和y值。 –

+0

是的,这是手动选项,但我只是在看API的选项,如只给予时间arrray,开始日期一次,API将绘制所有系列的图表。 –

4

设置在itial日期pointStart:

plotOptions: { 
    column: { 
     pointStart: Date.UTC(2015, 1, 12) // feb 12, 2015 
    } 
} 

设置间隔在x轴:

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) 
} 

测试:http://jsfiddle.net/ppazos/jjn7noqg/

相关问题