为什么在使用 400 个数据点时出现“无法读取未定义的 属性 'isValid'”?
Why do I get 'Cannot read property 'isValid' of undefined' when using 400 data points?
我正在尝试使用 highcharts 时间线可视化 400 多个数据点,但我得到 Cannot read property 'isValid' of undefined
Fiddle: https://jsfiddle.net/0fv2kxqb/
const test = [];
for (let i = 0; i < 400; i++) {
test.push({
x: Date.UTC(1900 + i, 9, 4),
name: 'test'
});
}
Highcharts.chart('container', {
chart: {
zoomType: 'x',
type: 'timeline'
},
xAxis: {
type: 'datetime',
visible: false
},
yAxis: {
gridLineWidth: 1,
title: null,
labels: {
enabled: false
}
},
legend: {
enabled: false
},
title: {
text: 'Timeline of Space Exploration'
},
subtitle: {
text: 'Info source: <a href="https://en.wikipedia.org/wiki/Timeline_of_space_exploration">www.wikipedia.org</a>'
},
tooltip: {
style: {
width: 300
}
},
series: [{
dataLabels: {
allowOverlap: false,
format: '<span style="color:{point.color}">● </span><span style="font-weight: bold;" > ' +
'{point.x:%d %b %Y}</span><br/>{point.label}'
},
marker: {
symbol: 'circle'
},
data: test
}]
});
#container {
min-width: 400px;
max-width: 600px;
margin: 0 auto;
}
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/timeline.js"></script>
<div id="container"></div>
它适用于约 300 个数据点
它不适用于大量数据点吗?
该问题是一个错误,已在此处报告:https://github.com/highcharts/highcharts/issues/11116
可能的解决方法:
- 设置
cropThreshold
大于数据长度:https://jsfiddle.net/BlackLabel/rtkj5xd7/
- 启用
getExtremesFromAll
:https://jsfiddle.net/BlackLabel/rtkj5xd7/2/
我正在尝试使用 highcharts 时间线可视化 400 多个数据点,但我得到 Cannot read property 'isValid' of undefined
Fiddle: https://jsfiddle.net/0fv2kxqb/
const test = [];
for (let i = 0; i < 400; i++) {
test.push({
x: Date.UTC(1900 + i, 9, 4),
name: 'test'
});
}
Highcharts.chart('container', {
chart: {
zoomType: 'x',
type: 'timeline'
},
xAxis: {
type: 'datetime',
visible: false
},
yAxis: {
gridLineWidth: 1,
title: null,
labels: {
enabled: false
}
},
legend: {
enabled: false
},
title: {
text: 'Timeline of Space Exploration'
},
subtitle: {
text: 'Info source: <a href="https://en.wikipedia.org/wiki/Timeline_of_space_exploration">www.wikipedia.org</a>'
},
tooltip: {
style: {
width: 300
}
},
series: [{
dataLabels: {
allowOverlap: false,
format: '<span style="color:{point.color}">● </span><span style="font-weight: bold;" > ' +
'{point.x:%d %b %Y}</span><br/>{point.label}'
},
marker: {
symbol: 'circle'
},
data: test
}]
});
#container {
min-width: 400px;
max-width: 600px;
margin: 0 auto;
}
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/timeline.js"></script>
<div id="container"></div>
它适用于约 300 个数据点
它不适用于大量数据点吗?
该问题是一个错误,已在此处报告:https://github.com/highcharts/highcharts/issues/11116
可能的解决方法:
- 设置
cropThreshold
大于数据长度:https://jsfiddle.net/BlackLabel/rtkj5xd7/ - 启用
getExtremesFromAll
:https://jsfiddle.net/BlackLabel/rtkj5xd7/2/