繁体   English   中英

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

[英]How can I change highcharts events after the chart has been initialized

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

<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);
}

我想覆盖上面的mouseOver事件,但似乎没有影响。 对于任何人都可以提供帮助,我会非常感激。

不支持实时更新plotOptions。 jsFiddle

您可以通过这种方式更新单系列选项:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM