我有一个动态数据加载的烛台图表。我正在使用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 series
Highcharts错误#20:http://www.highcharts.com/errors/20
我已将Object语法更改为Array语法,我的问题已经解决。但我无法将更多数据嵌入到我的工具提示中使用的点。 有没有办法使用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]
}]
答案 0 :(得分:0)
根据以下机票(跟进评论),
How to embed more data to candlestick HighChart tooltip?
我发现通过将turboThreshold
设置为0
,我可以忽略此限制。
请注意,您应该将其设置为绘图选项!不是图表选项。
plotOptions: {
candlestick: {
turboThreshold: 0
}