vis.js网络:节点z-index

3

是否有与CSS z-index相当的vis.js节点属性?

假设我有两种节点(在禁用物理引擎的图表中):圆和矩形。当它们重叠时,我希望矩形始终显示在圆的上方。

2个回答

3

0
根据提到的问题,更精确的答案是:没有记录设置z-index的方法(也没有这样的概念),但您可以使用(有可能在某些更新中出现问题)的是节点按照定义的顺序绘制。来自评论

I used the following test nodes:

var nodes = [
    {id: 'a', label: 'a', shape: 'dot'},
    {id: 'b', label: 'b', shape: 'dot'},
    {id: 'c', label: 'c', shape: 'dot'},
    {id: 'd', label: 'd', shape: 'dot'}
];

When not selected, these will draw in the node order:

enter image description here

Now, let's change the order:

var nodes = [
    {id: 'c', label: 'c', shape: 'dot'},
    {id: 'b', label: 'b', shape: 'dot'},
    {id: 'd', label: 'd', shape: 'dot'},
    {id: 'a', label: 'a', shape: 'dot'}
];

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接