vis-network: Edge color updating bug.

Hi Everyone,

I am trying to update edges’ color by providing an array of edges (every single edge has different color), but it updated all edges’ color. But if I update just one edge it works correct, other edges remain the same, if number of updated data is more than one it updates all colors, basically sets the last element’s color.

Is this bug or I am not doing it in a right way?

Here is how I update edge data dataSetsObject.update(edges);

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 30 (12 by maintainers)

Most upvoted comments

I’m just supposed to just know what’s the content of edges by looking into my crystal ball or what?

Hi @Thomaash, just wanted you to know that I solved the issue. So let me provide some details just in case if somebody has the same issue.

  1. First of all I use vis.js in Vue environment and problem is in Vue not in the vis.js library. Vue adds proxies to all member variables of all objects. Detailed explanation of this issue you can find here.

  2. Solution is pretty straightforward. Move the options and graph object out of the data() method of Vue.js. See below example:

export default{
    data() {
      return { <some_reactive_data> }
    },
    // Static data
    // You can access to this variable like this this.$options.graph in your code.
    graph: null,
}

Somewhere in your code you should initialized graph value like this: this.$options.graph = new vis.Network(document.querySelector('.graph'), network_data, network_options);

More details explanation of the solution you can find here.

Thank you very much @Thomaash, you helped me to look the problem in the right direction. I am closing this issue.