在我提供的代码中,我有一个数据序列列,其中数据间隔不均匀,并为xAxis设置了1658086242000的最小值,但在看到图表后,我看到了2个值,在我的最小点之前,为什么呢?我的整个代码:
const simpleData = [ [
1638748800000,
1
],
[
1654387200000,
2
],
[
1670284800000,
3
],
[
1678060800000,
4
],
[
1685923200000,
5
]
];
Highcharts.stockChart('container', {
title: {
text: 'Unevenly X axix data min value'
},
xAxis: [{
type: 'datetime',
min:1658086242000
}],
navigator: {
enabled: true,
maskFill: "rgba(37, 150, 190,0.3)",
series: [{
type: 'column',
name: 'series1',
data: simpleData,
dataGrouping: {
enabled: false
}
}
],
xAxis: {
gridLineColor: 'transparent',
}
},
series: [{
type: 'column',
name: 'series1',
data: simpleData,
showInNavigator: false,
dataGrouping: {
enabled: false,
}
}]
});
字符串
sample code我已尝试startOnTick或pointPlacement,但不起作用
1条答案
按热度按时间ubby3x7f1#
这与
series.pointRange
有关,series.pointRange
是从两个最近的数据点之间的距离计算出来的,因此需要更多的空间。您可以通过更改pointRange
并禁用xAxis.ordinal
选项来解决此问题。字符串
示例演示:https://jsfiddle.net/BlackLabel/8913ge2f/https://jsfiddle.net/BlackLabel/tu7vy80z/
API引用:https://api.highcharts.com/highstock/series.column.pointRangehttps://api.highcharts.com/highstock/xAxis.ordinal