Collapse - Expanded Nodes

5 views
Skip to first unread message

Sridhar Ch

unread,
Nov 16, 2009, 9:19:55 AM11/16/09
to Ontology Online
Hai David Decraene,

One of my requirement is to Collapse expanded nodes, may i know how
can we do this

http://66.145.203.25/NEDM_Alpha/Visualization/XMLVisualization.aspx

-----------------------
Sridhar. Ch

ontologyonline

unread,
Nov 16, 2009, 2:22:58 PM11/16/09
to Ontology Online
Hi Sridhar,

very nice implementation!

I assume you could implement a toggle like click behaviour:
click once, show child nodes, click once again, hide child nodes,
click again, show child nodes etc etc

the addition of the nodes (all at once in your case) is done by:
if(c){touchGraph.addjOWLChildren(c, -1);}

the model containing the nodes, for the touchgraph, is available
through:
touchGraph.Model and is an associative array with key == jOWL concept
name

hence touchGraph.Model["Event"] will give you the data for the "event"
node.
touchGraph.Model["Event"].node.el provides access to the jquery
element for that node.
touchGraph.Model["Event"].ch gives you an array of strings, containing
the id's of the child nodes (e.g.: will contain "transaction",
touchGraph.Model["Transaction"] gives you the data..)

touchGraph.Model["Event"].node.el.hide(); //jquery call to hide the
node

var edge = toughGraph.Egdes.get("Event", "Transaction"] == data for
the connection between nodes.
edge.el = jquery element for the line (edge.el.hide())....

Now collapsing a node may not always be trivial, if there are
additional expanded child nodes then one would need to collapse those
as well....

The logic you will need to implement is:
1.Click: did I add the nodes already, if not add
2. Click: hide the children of the selected node + their lines, if
children of children are expanded, hide those as well
3. Click: show the children of the selected node + their lines, etc
etc...
that is functionality that is currently not part of the script...
Unfortunately I have very little time lately to implement it myself,
even though the behaviour would be interesting to add, but perhaps
with these directions, you might be able to add it yourself for your
implementation.
Reply all
Reply to author
Forward
0 new messages