如何修复高图表错误#20?



>我有一个带有动态数据加载的烛台图。我正在使用addPint API来添加新点。由于我需要在工具提示中使用一些自定义数据,因此我将点设置为"对象",如下所示:

chart.series[0].addPoint({
x: time, 
low: lowValue, 
high: highValue, 
open: openValue, 
close: closeValue, 
customParameter: myCustomPramameter
});

但我收到此错误,上面写着:Can't add object point configuration to a long data seriesHighcharts错误#20:http://www.highcharts.com/errors/20

我已将对象语法更改为数组语法,我的问题已解决。但是我无法将任何进一步的数据嵌入到要在工具提示中使用的点。 有没有办法使用 Array 语法来解决此问题,并且我可以在其中嵌入自定义数据以在我的工具提示点中使用?

这是我当前的图表选项:

chart: {
renderTo: 'chart-container',
marginRight: 10,
zoomType: 'x'
},
title: {
text: 'My Chart'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%b - %H:%M:%S',
second: '%b - %H:%M:%S'
}
},
yAxis: {
tickInterval: 0.25,
opposite: false
},
navigator: {
adaptToUpdatedData: false
},
scrollbar: {
liveRedraw: false
},
rangeSelector: {
buttons: [{
count: 1,
type: 'minute',
text: '1M'
}, {
count: 5,
type: 'minute',
text: '5M'
}, {
count: 15,
type: 'minute',
text: '15M'
}, {
count: 30,
type: 'minute',
text: '30M'
}, {
count: 60,
type: 'minute',
text: '60M'
}, {
count: 2,
type: 'hour',
text: '2H'
}, {
count: 4,
type: 'hour',
text: '4H'
}, {
count: 8,
type: 'hour',
text: '8H'
}, {
count: 1,
type: 'day',
text: '1D'
}, {
count: 2,
type: 'day',
text: '2D'
}, {
count: 3,
type: 'day',
text: '3D'
}, {
count: 4,
type: 'day',
text: '4D'
}, {
count: 5,
type: 'day',
text: '5D'
}, {
count: 6,
type: 'day',
text: '6D'
}, {
count: 7,
type: 'day',
text: '7D'
}, {
type: 'all',
text: 'All'
}],
inputEnabled: false,
selected: 0
},
tooltip: {
formatter: function (e) {
var point = this.points[0].point;
return '<div><b>#: </b><span>' + point.barNumber + '</span></div><br /><div><b>Open: </b><span>' + point.open + '</span></div><div><b> Close: </b><span>' + point.close + '</span></div><br /><div><b>High: </b><span>' + point.high + '</span></div><div><b> Low: </b><span>' + point.low + '</span></div><br /><div><b>Custom Param: </b><span>' + point.customParam + '</span></div>'
}
},
legend: {
enabled: false
},
exporting: {
enabled: false
},
series: [
{
name: 'My Chart',
type: 'candlestick',
data: []
},
{
name: 'Average',
type: 'spline',
data: [],
marker: {
lineWidth: 2,
lineColor: Highcharts.getOptions().colors[3],
fillColor: 'white'
},
color: Highcharts.getOptions().colors[3]
}]

根据以下票证(后续评论(,

如何将更多数据嵌入到烛台高图表工具提示?

我发现我可以通过将turboThreshold设置为0来忽略此限制。

请注意,您应该为绘图选项设置它!不是图表选项。

plotOptions: {
candlestick: {
turboThreshold: 0
}

最新更新