Forums

Full Version: adding a graph to existing one
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hey everyone!
so i was wondering if anyone could help with this:
i've built a visualisation of an intial graph already, and then i put an eventlistener on one of the nodes such that when u click it, a new graph will be shown.
what i want then is to add an edge between the root of this new graph and the node that triggered this!

any help will be greatly appreciated ! (also note that my code is inspired by the codes posted in this forum !! Big Grin)

thank you very much!
best!
yassine
Good morning Yaszine,

thanks for sharing your source code here in the forum. One question ahead, your two data sets have different schema which makes the "merging" of both graphs more complicated as far as I see. Apart from that it looks like you always create a new visualization object when a node is clicked. As you said you want to add the new data to the existing visualization, so the basic idea I would have is to add the new data always to the very first data set you created and use only one visualization object. At least this is what I do here

http://goosebumps4all.net/34all/bb/showt...hp?tid=153

and it works fine in that case. So maybe you could clarify if you really need to merge to graphs with different schemas and hopefully somebody around can help you further.

cheers

martin
hey !
thanks for ur reply ! it helped a lot ! Big Grin
well i've tried what you told me, but it still doesn't work !
can u please have a look at it once again ! ? when clicking the last node of my initial tree, we should be able to see an adge between this last one and the root of the next tree (graph).
why isn't this happening ?! Big Grin why ?!

thank you very much again,
have a nice day!
yassine!
Good morning Yaszine,

can't see it myself right now, sorry, hope somebody else can help you further

cheers

martin
hey ! so i solved the problem ! Big Grin
thank you anyways ! Big Grin

cheers !
Yassine
congrats!

could you share the solution source code with us?

thanks

martin
here is the code !!
i simply made it explicit to redo the visualisation for the nodes that were just added ! and i added an edge between the node that triggered this and the root node of the new tree!
anyways ! have a look at the code! it's not so complicated ! Big Grin
cheers!
yassine
great, thanks for sharing, works perfectly
Hi yassine,

thanks for sharing, i just made a few tests with your code. I m also at a point where i'd like to add new data to my graph, maybe i can manage it the same way like you just did it. As far as I can see, you are not using the GraphMLConverter directly like me, you are doing it with "new DataSource("data.xml", graphml");" Is there any advantage to the way i m using it right now? (link to my post at flare forum, SourceCode here)

just tried to change your source from fisheye to radialtree and some strange stuff is happening now, the graph becomes crazy when you click throw the new nodes and they'll be add static and not flowing around, maybe you can see what i messed up.. I just added/changed this code:

Code:
            var lay:RadialTreeLayout =  new RadialTreeLayout();
            lay.useNodeSize = false;
            
            _gdf = new GraphDistanceFilter([root], 2,NodeSprite.TREE_LINKS);
            
            vis.operators.add(_gdf);
            vis.operators.add(lay);

my test in action, => source

greetz,
Dennis
Hi Dennis

you have set
Code:
vis.continuousUpdates = true;
which is not a good idea if you are using the RadialTreeLayout. A quick hack solution should be something like
Code:
loader.addEventListener(Event.COMPLETE, function(evt:Event):void
{
   var ds1:DataSet = loader.data as DataSet;
   var dt:Data = Data.fromDataSet(ds1);
   add(dt);
   data.addEdgeFor(n,data.nodes[i]);
   setupNodes(i,data.nodes.size);
   i = data.nodes.size;
                                
    _gdf.operate();     // new
    updateRoot(n);     // new

});

Calling _gdf.operate() before updating the root is to set the visibility of the new nodes without any transition.

cheers

martin
Pages: 1 2
Reference URL's