网络图悬停以隐藏链接标签



下面是一个我有点问题的小提琴:https://jsfiddle.net/vewur7jf/2/我正在使用上面的代码自定义非活动状态:

series: [{
states: {
inactive: {
enabled: true,
linkOpacity: 0,
opacity: 1,
}
}
]

我首先担心的是,states.inactive.ocapacity没有得到应用。我已尝试使用0和1,但只应用默认值。

我还遇到了另一个关于linkOpacity的问题。它可以正确地控制线条的不透明度,但如何将其应用于链接的标签?正如您在示例中看到的,如果您将鼠标悬停在";斜体";(橙色部分的第一个节点(,则所有隐藏链接的标签都将保留在屏幕上
我希望能够完全隐藏悬停时不活动的两个(节点之间的标签和节点本身(。

致问候,

看看这个解决方案:

point: {
events: {
mouseOver() {
console.log(this)
this.series.nodes.forEach(node => {
console.log(node.state)
if (node.state === 'inactive') {
node.dataLabel.hide()
}
});
this.series.points.forEach(p => {
if (p.state === 'inactive') {
p.dataLabel.hide()
}
})
},
mouseOut() {
this.series.points.forEach(p => {
p.dataLabel.show();
})
this.series.nodes.forEach(node => {
node.dataLabel.show();
})
}
}
},

但我担心,只有在最初的动画完成后,这才能正常工作。负责放置标记的功能必须完成,否则,我们无法控制它,因为它仍在更新。

API:https://api.highcharts.com/highcharts/series.networkgraph.point.events.mouseOver

最新更新