visjs笔记-将edges(边)分开(防止重叠)

Posted IT1995

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了visjs笔记-将edges(边)分开(防止重叠)相关的知识,希望对你有一定的参考价值。

也就是从这个效果:

变成这种效果:

代码是从这样的:

      let edges = new vis.DataSet([
                
                    from: 1,
                    to: 2,
                    label: '<b>①用户提交表单</b>'
                ,
                
                    from: 2,
                    to: 3,
                    label: '<b>②验证并提交数据</b>'
                ,
                
                    from: 3,
                    to: 4,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>③分析数据调用模块</b>'
                ,
                
                    from: 4,
                    to: 3,
                    label: '<b>④结果以Base64返回</b>'
                ,
                
                    from: 3,
                    to: 2,

                    label: '<b>⑤结果以Json形式返回</b>'
                ,
                
                    from: 2,
                    to: 1,
                    label: '<b>⑥头像返回给用户</b>'
                
            ]);

改成这样的:

      let edges = new vis.DataSet([
                
                    from: 1,
                    to: 2,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>①用户提交表单</b>'
                ,
                
                    from: 2,
                    to: 3,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>②验证并提交数据</b>'
                ,
                
                    from: 3,
                    to: 4,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>③分析数据调用模块</b>'
                ,
                
                    from: 4,
                    to: 3,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>④结果以Base64返回</b>'
                ,
                
                    from: 3,
                    to: 2,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>⑤结果以Json形式返回</b>'
                ,
                
                    from: 2,
                    to: 1,
                    smooth: type: 'curvedCW', roundness: 0.5,
                    label: '<b>⑥头像返回给用户</b>'
                
            ]);

 其实就是添加好roundness和curvedCW即可。

以上是关于visjs笔记-将edges(边)分开(防止重叠)的主要内容,如果未能解决你的问题,请参考以下文章

使元素与 js 时间轴重叠

如何防止imageview重叠?

如何使用 python opencv 将重叠的卡片彼此分开?

算法笔记--图的存储之链式前向星

networkx学习笔记

将对象的边缘相互对齐并防止重叠