gpt4 book ai didi

Highcharts:可点击区域

转载 作者:行者123 更新时间:2023-12-03 06:52:20 25 4
gpt4 key购买 nike

我有一个区域 Highchart 图表。向图表添加点击事件,如下所示:

plotOptions: {
area: {
marker: {
enabled: false
},
cursor: 'Pointer',
stacking: 'normal',
events: {
click: function(event) {
alert("hi there");
}
}
}
}

效果很好。问题是你只能点击离线很近的地方,而不能点击线下方的区域,它是不可点击的。

是否有我忽略的设置?

最佳答案

您可以使用这个trackByArea: true plotOptions 中的区域函数

trackByArea: Boolean

Since 1.1.6 Whether the whole area or just the line should respond to mouseover tooltips and other mouse or touch events. Defaults to false.

将此与 click event 结合起来

click: Function

Fires when the series is clicked. The this keyword refers to the series object itself. One parameter, event, is passed to the function. This contains common event information based on jQuery or MooTools depending on which library is used as the base for Highcharts. Additionally, event.point holds a pointer to the nearest point on the graph.

例如:

plotOptions: { area: { **trackByArea: true**, marker: { enabled: false },..

关于Highcharts:可点击区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8091841/

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