tell when canviz is done rendering?

24 views
Skip to first unread message

Rockpsl76

unread,
Jul 26, 2010, 4:35:50 PM7/26/10
to canviz
Is there any way to tell when canviz is done? It keeps resizing my
div on me. I put in code to return the div back to the proper width
(via the resize callback), but if I call this at the end of my paint
routine, it still happens too quickly. Is there anyway to tell when
canviz is done painting, and its safe to resize the output div?

Ryan Schmidt

unread,
Jul 26, 2010, 8:08:34 PM7/26/10
to can...@googlegroups.com

Interesting question. First, which divs are we talking about? Looking in the draw method, the only resizing I see is that the width and height of the canvas element are set to the graph dimensions, and also the enclosing div's width is set (but not the height, for reasons I don't remember). The intention is that if you load one graph, then load a second graph into the same Canviz instance that has different dimensions, you'll still see the whole graph. Is this resizing inconvenient for your case?

As for when Canviz is done, the obvious answer is it's done when the draw method finishes. There isn't a built-in way to receive notification of when that is (via, say, a callback). I think my intention was that if your needs are simple and you just want to see a graph, you do something like what the hello world example does and just call:

var myCanviz = new Canviz('canvizDivId', 'xdotFile.gv');

This makes a new Canviz instance, begins the AJAX request to load the graph file, and parses and draws it when it's received.

If you need more control, you can create an empty Canviz instance, and do your own AJAX loading and post-processing. See the discussion in the thread linked from issue 52 for sample code:

http://code.google.com/p/canviz/issues/detail?id=52


Rockpsl76

unread,
Jul 30, 2010, 4:35:02 PM7/30/10
to canviz
I was talking about the enclosing div. Canviz is one of several
components in my layout, so I have a set size that I want it to
take. Don't worry though. I grew a brain and enclosed the enclosing
div in another div, so it doesn't resize anymore. So its working as
desired now. I just needed to use my brain a little ;-) Without the
resizing issue, I no longer need to know when canviz is done, but
the AJAX stuff is good information for the future *tucking away*
Reply all
Reply to author
Forward
0 new messages