After going through the code, I think I understand it better. I wasn't able to not get things drawn after the graph from springing (so still have an issue w/ how to get text rendered), but I solved my canvas problem by setting the graph.styles.default.background = None (and the g.s.d.depth to None as well) - the Graph2 library seems to always pass the g.s.d.bg (hard-coded?)
I also believe that I figured out the nodes - that I can just add iterations and make it not done and it'll continue animating? My early workaround, since this was for a simple viz I was doing was just to kick off a new graph when the old one was done.
Hi Leonard,
If you're drawing other things after having drawn the graph, use the reset() command first. This has been fixed in the latest release of the Graph library.
Also in the latest release, check the documentation for the graph.layout.refresh() method, which "buys some new iteration time". Call it after you add a new node.
Graph Questions (Drawing in combination with other layers (ie, coreimage.canvas))
Posted by Leonard Lin on May 13, 2008Sorry if this is a repeat, I did a search but wasn't able to search specifically in the forums so I may have missed something.
I'm new to Nodebox and I'm working on a visualization with the Graph2 library and had a few questions...
Firstly, I'm trying to put a logo in the bottom right corner of the rendering. I'm using coreimage to create a canvas, but if I draw it (after the graph.draw) it seems attached to the spring/graph? (I'm not calling an append or anything, so I'm not sure why it'd be attached to it? unless I'm misunderstanding how the elements work in the draw() function?) If I call the draw before, I don't have that problem, but the background of the graph overlays it.
Also, while I'm at it, I have some questions about how the nodes work? I'd like to dynamically add and remove nodes (I have a DB I'm interacting with that's continually adding more nodes into a render queue), and I'm using the graph.add_node() and graph.add_edge() calls, but that doesn't seem to kick off the springiness when I make changes. What do I need to do to kick off another round of spring calculations? (digging through the code right now, but hoping someone might know offhand)
Are there any examples floating around that are more involved than the ones included w/ the library?