Highmaps-需要使数据标签可单击
我正在使用Highmaps中的美国小型地图,我想要每个状态,并且在单击时,它的数据标签可以打开一个新的URL。我有国家在工作,但标签行不通。
这就是我尝试的:
plotOptions: {
series: {
allowPointSelect: true,
point: {
events: {
click: function(e) {
const url = e.target.point.value;
window.open(url);
}
}
},
datalabels: {
events: {
click: function(e) {
const url = e.target.point.value;
window.open(url);
}
}
}
}
},
请参阅用于代码。
I'm using the small U.S. map in HighMaps and I want each state and it's datalabel to open up a new URL when clicked. I have the state working, but the label does not work.
this is what I tried:
plotOptions: {
series: {
allowPointSelect: true,
point: {
events: {
click: function(e) {
const url = e.target.point.value;
window.open(url);
}
}
},
datalabels: {
events: {
click: function(e) {
const url = e.target.point.value;
window.open(url);
}
}
}
}
},
Please see https://jsfiddle.net/sfjeld/zcsxobfa/12/ for the code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
this.value
而不是e.target.point.point.value
:demo:
https://jsfiddle.net/blacklabel/6gpl57nf/
Use the
this.value
instead ofe.target.point.value
:Demo:
https://jsfiddle.net/BlackLabel/6gpL57nf/
在您的示例中,您可以使用:
从点击点获取值。
代码:
您可以使用以下路径检查其他值:
完整代码在
In your example, you could use:
For get the value from the clicked point.
Code:
You can check other values using this path:
The full code is in this forked jsfiddle