如何在图表初始化后更改高图表事件


初始化

图表后如何更改高图表事件?

<div id='report'></div>
var chart = $('#container').highcharts({
        chart: {
        },
        xAxis: {
        },
        plotOptions: {
            series: {
                point: {
                    events: {
                        mouseOver: function() {
                            $reporting.html('inner x: '+ this.x +', y: '+ this.y);
                        }
                    }
                },
                events: {
                    mouseOut: function() {                        
                        $reporting.empty();
                    }
                }
            }
        },
        tooltip: {
            enabled: false
        },
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]        
        }]
    });
chart.options.plotOptions.series.point.events.mouseOver = function() {
$('#report').html('outer x: ' + this.x + ', y: ' + this.y);
}

我想如上所述覆盖鼠标悬停事件,但它似乎没有受到影响。我会非常感激任何人可以提供帮助。

不支持实时更新绘图选项。 jsFiddle。

您可以通过以下方式更新一个系列选项:

chart.series[0].update({
  point: {
    events: {
      mouseOver: function() {
        $('#report').html('outer x: ' + this.x + ', y: ' + this.y);
      }
    }
  } 
});

最新更新