如何将日期时间分配给具有间隔和日期开始的高图

how to assign date time to highchart with intervals and date start

本文关键字:日期 开始 高图 时间 分配      更新时间:2023-09-26

HI在highchart中有没有办法在x轴上显示时间

1)通过启动时间
2)给出一个时间点数组
3)给出时间单位

例如

<>之前开始时间将设置为timeArr pointStart: Date.UTC (timeArr [3], [1], timeArr [2], timeArr [4], timeArr [5])where timeArr[3] -> yeartimeArr[3] -> yeartimeArr[1] -> monthtimeArr[2] ->月的日期timeArr[4] ->小时timeArr[5] -> minute现在按如下方式设置时间间隔数组[0, 60120180240)现在将时间单位设为1000(表示数组中的时间以秒为单位)之前

然后highchart通过从开始日期开始绘制x轴然后从时间数组中选择间隔并添加到开始时间并创建下一个数据点的时间

我问这个问题是因为我们的旧应用程序使用JClass图表而我正在从它转换它在我给出的

逻辑上工作

使用pointStart:

设置初始日期
plotOptions: {
    column: {
        pointStart: Date.UTC(2015, 1, 12) // feb 12, 2015
    }
}

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

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

如果我理解正确,pointInterval就是你要找的:

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

如果这不能满足您的需要,那么就应该解析您的对象以使其满足您的需要…