Search code examples
vis.jsvis.js-network

Is it possible to add custom properties to edges?


I have tried to add additional information to the edges of the network, but it seems I can't do it.

I've tried to do it in multiple ways, but while everything works perfectly fine with nodes, it doesn't work with edges.

The simplest example would be:

edgesDataSet.update({id: "someId", customProperty: "someValue"})

After running this code, I can't find customProperty anywhere, though if I run the same code for nodes I will find it under in the options property.

Could you please help me with that? (I was trying to find a question that and read the documentation on edges, but hasn't found anything relevant, haven't checked the library code yet, thought I will ask first)

UPDATE

It turns out it is possible to do it, with the exact code I've posted (tested it on a completely clean setup), but there was another thing in our project affecting network edges.

To be even more clear: if edge is accessed through network.body.edges, then they will contain only edges-specific options, if edge is accessed through the dataset - it can contain all the properties (including custom ones)


Solution

  • It turns out it is possible to do it, with the exact code I've posted (tested it on a completely clean setup), but there was another thing in our project affecting network edges.

    Sorry for disturbance.