英文:
how to solve the problem with markers overlapping each other when hovering the mouse in highmaps(highcharts)?
问题
如何使默认情况下标记 "莫斯科" 放置在标记 "图拉" 的后面,以及当悬停在标记 "莫斯科" 上时,它仍然位于标记 "图拉" 的后面并部分突出显示?
我的代码:演示
您可以考虑其他放置标记在地图上的方法。
英文:
how to make the marker "moscow" by default be placed behind the marker "tula", and also when hovering over the marker "moscow" it remains behind the marker "tula" and is partially highlighted?
my code: demo
you can consider other approaches to placing markers on the map
答案1
得分: 0
要实现这一点,您需要在图表的load
事件、onMouseOver()
和onMouseOut()
函数中覆盖莫斯科(moskva)或图拉(tula)标记的图形元素。
以下是您可以基于的示例修改:
当您遍历点时,添加以下条件:
if (el.id === "tula") {
el.graphic.attr({
zIndex: 100,
});
}
在mouseOver
和mouseOut
函数中,以下是带有透明度更改的修改:
if (this.id === "moskva") {
this.graphic.attr({
opacity: 0.5,
zIndex: -100,
});
}
英文:
To achieve that you need to overwrite the graphic element of the moskva or tula markers at chart load
event, onMouseOver()
and onMouseOut()
functions as well.
Here is the example modification you can base on:
When you loop throught the points add the conditional as follows:
if (el.id === "tula") {
el.graphic.attr({
zIndex: 100,
});
}
And at the mouseOver/mouseOut functions the following modification with the opacity change:
if (this.id === "moskva") {
this.graphic.attr({
opacity: 0.5,
zIndex: -100,
});
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论