How to redraw SpaceTree

271 views
Skip to first unread message

Rach

unread,
Nov 17, 2009, 8:38:40 PM11/17/09
to JavaScript Information Visualization Toolkit
On my page web page, there's a dropdown and based on the selection I
want to "redraw" the SpaceTree. I'm resetting the "infovis" div but it
still doesn't work.

$("#infovis").html("");

The part doesn't work, is, when I reset the json object & call the
"init()" again, it does redraw the SpaceTree but it doesn't call
onCreateLabel method on which I've my customization.

What am I missing? Is there any method that basically can redraw the
SpaceTree just like it was initialized when first time it was created.

Rach

unread,
Nov 19, 2009, 9:07:50 AM11/19/09
to JavaScript Information Visualization Toolkit
Wow...it's been 2 days no response! Anybody? :)

Rach

unread,
Nov 19, 2009, 12:03:07 PM11/19/09
to JavaScript Information Visualization Toolkit
To simply my original description of the problem, add the following
HTML lines in the SpaceTree Example1.htm file.
...
<div style="text-align:center;"><a href="example1.js">See the Example
Code</a>

<p>

<input type="button" value="Redraw" id="redraw"
onclick="document.getElementById('infovis').innerHTML = '';init();" />

</p>

</div>

</div>

<div id="center-container">

<div id="infovis"></div>

</div>
...

What you'll see if you click on the "Redraw" button, the re-drawing
doesn't populate the labels. How to fix this?

Nico Garcia Belmonte

unread,
Nov 19, 2009, 12:57:38 PM11/19/09
to javascript-information...@googlegroups.com
Hi,

I'd recommend you to not delete the canvas or visualization containers.
Just delete all labels from the current visualization:

        for(var id in viz.fx.labels)
                viz.fx.disposeLabel(id);
                delete viz.fx.labels[id];
        }

and then *reuse* the same canvas instance to create a new instance of
a new visualization:

    viz = new ST(canvas, ...);


You can find more information in a previous thread:

http://groups.google.com/group/javascript-information-visualization-toolkit/browse_thread/thread/e128b5166a03b04f/f255efc2d8e486b6?#f255efc2d8e486b6

--

You received this message because you are subscribed to the Google Groups "JavaScript Information Visualization Toolkit" group.
To post to this group, send email to javascript-information...@googlegroups.com.
To unsubscribe from this group, send email to javascript-information-visua...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascript-information-visualization-toolkit?hl=.





--
I would never die for my beliefs because I might be wrong.

Bertrand Russell
Reply all
Reply to author
Forward
0 new messages