vis.js - How to resize nodes at runtime

I would like to resize nodes of a vis.js network at runtime. My goal is to create a slidercontrol to expand all nodes (an labels) or collapse them.

First, I've tried to manipulate the Scaling values.

var options = {nodes: {scaling: {label: {max: 180 , maxVisible: 180}}}};
network.setOptions(options); 

But there are no results.

My second idea was to manipulate the value of every single node.

function IncNodeSize(Increment) {
    var CurrentNodes = nodesDS.get();
    for (var i = 0; i < CurrentNodes.length; i++) {
        CurrentNodes[i].value = CurrentNodes[i].value + 100;
    }
  }        
nodesDS.update(CurrentNodes); 
}

But this didn't work either.

Has anyone an idea how to resize nodes at runtime?

Answers:

Answer

With the help of the Developer Community I have solved the issue. At first I had to change the options and than I had to update the nodes (with no datachange) This two things together changed the sizes.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.