gpt4 book ai didi

javascript - Highcharts - 无法强制 x 轴在特定日期停止

转载 作者:行者123 更新时间:2023-12-01 00:40:29 25 4
gpt4 key购买 nike

我正在使用 highcharts/highstock 并向客户端发送一些数据。

我尝试了各种设置,但无法强制 x 轴在某个日期停止。

例如,我创建了一个图表,其中包含 2019 年 3 月 20 日到 2019 年 3 月 25 日的数据。间隔必须始终为 5 分钟。

起点是正确的,从2019年3月20日开始。

但最后一点总是多一天。它比 26/3/2019 多了大约 35 个点,而不是停留在 25/3/2019。

*如果这改变了什么,起始点应该是 20/3/2019 00:00 ,但实际上在 highcharts 中它是从 20/3/2019 03:00 开始的。

我的数据是

        { 
time:{
useUTC:false
},
boost: {
enabled: true,
allowForce:true,
usePreallocated:true,
useGPUTranslations: true
},
chart: {
type: "line",
zoomType: 'x'
},
title: {
text: item.title
},
xAxis: {
type: 'datetime',
tickInterval: 5 * 60 * 1000 , /*5 min */
max: pointStop,
labels: {
format:'{value:%H:%M:%S}'
},
dateTimeLabelFormats: {
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%b. %e',
week: '%b. %e',
month: '%b. %y',
year: '%Y'
}
},
yAxis: {
title: {
text: item.title
},
alignTicks:'left',
textAlign:'left',
align:'middle',
opposite:false
},
series: [
{
boostThreshold: 150,
name: item.title,
pointStart: pointStart,
pointInterval: 5 * 60 * 1000,
data: item.array,
dataGrouping:{
approximation: 'average',
enabled:true,
forced:true,
groupAll:true,
groupPixelWidth:20
}
}
]
}

我做错了什么?

谢谢

最佳答案

这听起来像是设置滴答计数的问题。文档指出

If a tickAmount is set, the axis may be extended beyond the set max in order to reach the given number of ticks. The same may happen in a chart with multiple axes, determined by chart. alignTicks, where a tickAmount is applied internally.

关于javascript - Highcharts - 无法强制 x 轴在特定日期停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57757994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com