Closed ibnesayeed closed 11 years ago
@ibnesayeed Do you have a link to reproduce the problem?
PS: Are you trying to make all nodes fixed or you need some of them to be positioned by vivagraph?
I have a JSON file that has pre-calculated X and Y positions of each node as well as color and other attributes are encoded in JSON itself. I want to apply one node at a time from JSON to the graph. The nature of my need is such that I cannot pre-render all the nodes in advance. Hence, all the nodes will be added dynamically on a constant layout. I will try to write a small example code that can reproduce this issue and I will post it here soon.
Thanks for the help!
Here is a fiddle http://jsfiddle.net/HE7tb/
Three nodes were supposed to be panted while only one node is being painted in this fiddle. and it throws error saying, "Uncaught TypeError: Cannot read property 'x' of undefined"
Fixed. If your example reflects what you are doing, you might also want to add a fake node before call to the renderer.run, and remove it afterwards. This trick will auto-center the graph: http://jsfiddle.net/HE7tb/2/
Thanks for the fix. You were really very helpful. And thanks again for the additional trick to auto-center the graph. I am closing this bug report. :-)
I am trying to use constant layout to specify node placement myself. I also want to dynamically add or remove nodes/edges in the graph periodically. I am getting two types of errors while doing this.
Any help please!