悬停时阻止Highcharts Networkgraph重绘标记 [英] Stop Highcharts Networkgraph from redrawing the markers when hovering

查看:199
本文介绍了悬停时阻止Highcharts Networkgraph重绘标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究网络图,有人帮助我达到了可以单击节点时隐藏/显示节点的地步.但是,似乎有默认行为,当您完全移动鼠标时会重新绘制节点.

I'm working on a network graph and somebody helped get me to the point where I can hide/show nodes when clicking on them. However, there seems to be default behaviour which redraws the nodes when you move the mouse at all.

这是小提琴: https://jsfiddle.net/oLbkpsag/.您会看到单击节点会隐藏其子节点,但是,如果单击后单击鼠标,则会重新出现该节点.

Here is the fiddle: https://jsfiddle.net/oLbkpsag/. You'll see that clicking a node hides its children, however if you mouse the mouse after clicking then the node reappears.

我加入了

addClass('hide-tree-element')

对dataLabel有所帮助,但是标记或图形"每次都会重绘.

which has helped on the dataLabel, but the marker or "graphic" redraws every time.

当悬停 https://时,似乎有默认行为暗淡其他系列" github.com/highcharts/highcharts/issues/9899 .我认为可能会影响到它.我尝试禁用它,但似乎不起作用.

It seems that there is default behaviour to "dim other series" when hovering https://github.com/highcharts/highcharts/issues/9899. Which I thought might be affecting it. I've tried disabling that but it doesn't seem to work.

将不胜感激地收到任何帮助!

Any help would be gratefully received!

推荐答案

您是对的,处于非活动状态会重绘mouseOut事件上的每个点.

You're right, the inactive state redraws each point on mouseOut event.

要更改此默认行为,您可以简单地包装Highcharts.Series.prototype.onMouseOut方法并删除负责删除非活动状态功能的代码段(在此处添加:

To change this default behavior you can simply wrap Highcharts.Series.prototype.onMouseOut method and remove the piece of code responsible for removing inactive state functionality (added here: https://github.com/highcharts/highcharts/commit/f86f50f80160f078bd185e8e5db1251f317f9fff#diff-12c0e234e06f670ee77d64cce2a9205dL768):

// Reset all inactive states
chart.series.forEach(function (series) {
   series.setState('', true);
});

演示:

这篇关于悬停时阻止Highcharts Networkgraph重绘标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆