Skip to content

Layers

Custom layer

You can add layers in the SVG generated by v-network-graph.

To add a layer, define the layer name and insertion position in the layers attribute, and define a named slot with the specified layer name in <v-network-graph> ... </v-network-graph>.

The following insertion positions can be specified.

positiondescription
"paths"above the paths
"node-labels"above the node labels
"nodes"above the nodes
"focusring"above the selection circles of the nodes
"edge-labels"above the edge labels
"edges"above the edges
"base"under all objects
-(When you get SVG text, layers above this will be contained)
"grid"above the grid
"background"under the grid
-(The layer below this is not target to panning/zooming)
"root"the root of the svg element

The default slot and any slots not defined in the layers will be included in the root.

Map

This is an example of adding an image layer to the behind of a network graph.

Node's badge

This is an example of adding an SVG layer to the foreground of the nodes layer.

Change the order of built-in layers

The following is a list of the built-in layers of this library and the layers of which the order can be changed.
The higher layer is on the list, the more it appears in the foreground by default.

layer nameorder changeable
"paths"YES
"node-labels"YES
"nodes"YES
"focusring"YES
"edge-labels"YES
"edges"YES
"grid"NO

To change the order, specify the layer names in configs.view.builtInLayerOrder array in the order you want them in the front. It is not necessary to specify all the built-in layer names. Layer relationships not specified are the same as the default.
For example, if you specify ["node-labels", "paths"], the "node-labels" layer will be configured so that it is directly above the "paths" layer.