react-graph-vis icon indicating copy to clipboard operation
react-graph-vis copied to clipboard

Nodes do not update correctly (edges do)

Open chriscarex opened this issue 7 years ago • 6 comments

Hi, when clicking on a node, I would like to change the color and background properties of the clicked nodes and neighbours (including connecting edges)

The nodes change properties correctly, while the nodes do not seem to change, unless I redraw the canvas.

Any ideas on why that's the case? Workarounds, suggestions, etc?

chriscarex avatar Jul 03 '18 17:07 chriscarex

Hi, I'm facing the same problem. In my case, when I add or remove nodes, the graph updates without any problem. But when I'm changing properties of an exiting node (e.g. it's label or value), the graph remains same.

A quick update. When I manually call setData() method, the graph gets updated.

ahas36 avatar Jul 13 '18 03:07 ahas36

I confirm that setData() works, but it redraws the graph, which is a thing I would like to avoid. any updates?

chriscarex avatar Jul 18 '18 12:07 chriscarex

What's worse is that setData() doesn't REALLY work because of #22 - the zoom and pan get reset, which is hardly ideal behaviour.

matttk avatar Jul 19 '18 14:07 matttk

hi guys how to do manually call set data?

LukeDefeo avatar Nov 13 '18 16:11 LukeDefeo

render a component like this: <Graph getNetwork={network => this.setState({ network })} graph={graphData} options={options} events={events} />

then in your methods, add const {network} = this.state; network.setData(nodesEdges);

chriscarex avatar Nov 15 '18 11:11 chriscarex

Hi! Facing the same issue and am curious of you have ever found a good solution here?

I confirm that setData() works, but it redraws the graph, which is a thing I would like to avoid. any updates?

bennofatius avatar Aug 25 '22 06:08 bennofatius