如何修复 HighChart 错误 #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 error #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]
    }]
钥匙扣

根据以下票证(跟进评论),

如何在烛台 HighChart 工具提示中嵌入更多数据?

我发现我可以通过设置turboThreshold0.

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

plotOptions: {
    candlestick: {
        turboThreshold: 0
    }

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章