Closed lorinerosenberg closed 3 years ago
I had the same problem and could figure it out. So here is my solution:
The Graph component has a prop that gives you the actual network as a callback.
<Graph graph={this.state.graph} options={options} events={events} getNetwork={this.setNetworkInstance.bind(this) }/>
So, just simply set it as a state of your component and now you can acces these funktions directly.
this.state.network.selectNodes(toSelect, true);
Here is an es6 demo
state = { network: {} };
<Graph
getNetwork={network =>
this.setState({network }) }
/>
Indeed it works like this, thanks!
In vis.js I would resize my graphs on each render using network.fit(). How would I call the .fit function using the react-graph-vis component or are there any alternate ways of doing this?
Thanks!