Closed Clarkclk closed 5 years ago
OK, now I set all node fixed after initial setOption method, but if I drag a node then this node becomes unfixed again (though other nodes remain fixed). So my question changes to how echarts make a node fixed property changed. If it has to use a method like setoption to render the whole graph? Or is there an inner interface to change a node property like fixed and axis easily? I think rendering the whole graph is time-consuming. So what is the inner method to change a node property? 中文:我在初始setOption之后会将所有节点设置为fixed,但如果我去拖动一个顶点,该顶点会重新变成unfixed(其他顶点保持fixed)。我的问题是,echarts内部是怎么改变一个顶点的属性的?如果也是类似于setOption一样的方法去重新渲染整个图太浪费时间了,或者有一个内部接口可以很方便的更改顶点属性值,比如fixed属性和坐标?
After scanning the source code, I found the mouseup and drag action defined in echarts, and cancel the setUnfixed action in drag function. Then the node still fixed after dragging. 中文:查了下源码,找到了echarts中对于mouseup和drag事件的定义。取消了drag函数中的setUnfixed操作,实现了拖拽后顶点保持fixed的功能。 @pissang 希望能添加顶点fixed的接口。
beautiful
I am using echarts 4.1.0 to display a big social network in force graph type. I found that I have to reuse the setoption method even when I want to make one data fixed (change the fixed property to true in node array and merge the whole array with setoption method). It is not convinent for very big graph. I want to know if there any other way to fix a node without setoption? I found this question have been asked many times, but still not answered explicitly. 中文:我在用echarts4.1.0的力导向图来展示一个大的社交网络图。我发现只能使用setoption方法来固定一个节点(改变节点数组中该节点的fixed属性为true,重新使用setOption加载整个数组),这对于大图来说很不方便。我想知道有没有其他比较方便的方法来固定一个点。我发现这个问题已经被问了好多次了,但始终没有一个明确的答案。