gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 18:09:28 25 4
gpt4 key购买 nike

图表初始化后如何更改 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);
}
}
}
});

关于javascript - 图表初始化后如何更改 highcharts 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19827167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com