Stop Highcharts Networkgraph from redrawing the markers when hovering

匆匆过客 提交于 2019-12-13 02:52:47

问题


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.

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.

I added in

addClass('hide-tree-element')

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

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!


回答1:


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

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);
});

Demo:

  • https://jsfiddle.net/BlackLabel/zrL8w067/


来源:https://stackoverflow.com/questions/57173646/stop-highcharts-networkgraph-from-redrawing-the-markers-when-hovering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!