Skip to content Skip to sidebar Skip to footer

Incrementing The Size Of Nodes In Cytoscape.js By A Specific Value

I am using following json content for specifying the size of each node: 'data': { 'id': 'Name', 'name': 'NameID', 'faveColor': '#86B342', 'size': 120 } Once the graph is gener

Solution 1:

You are trying to add a int with string which won't seem to work. Instead try to get the property value and then add the input value to it.

You can edit the data value by passing a second argument to nodes().data('element', 'value')

Your code would look something like this:

cy.nodes().forEach(function(node){
  node.data('size', parseInt(node.data('size')) + 10); 
  console.log(node.data('size'))
});

Post a Comment for "Incrementing The Size Of Nodes In Cytoscape.js By A Specific Value"