Reputation: 1995
Is there an equivalent of the CSS z-index for vis.js nodes?
Suppose that I have 2 kinds of nodes (in a graph with physics disabled): Circles and rectangles. I would like the rectangles to always be displayed over the circles when they are overlapping.
Upvotes: 3
Views: 1351
Reputation: 8316
Judging by the mentioned issue, a more precise answer would be: there's no documented way to set z-index (and there's no such concept), but what you can use (with a risk of getting this broken at some update) is nodes are drawn in the same order they are defined. From comment:
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:
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'} ];
Upvotes: 0
Reputation: 163
Kind of a late reply but the short answer is: no
See this issue: https://github.com/almende/vis/issues/3146
Upvotes: 3