Menu

RadialTreeLayout + CollapsedSubtreeLayout

Help
2008-07-18
2013-05-29
  • Gerald Meazell

    Gerald Meazell - 2008-07-18

    I have a working RadialTreeLayout graph and now I want to collapse the nodes so that my graph is not overpopulated. I have been copying what I can ascertain are the relevant parts of the TreeView demo (the CollapsedSubtreeLayout layout and the VisibilityAnimator) but it is still not working. I figure I have one of two problems:

    1) I don't see in the TreeView demo where the visibility of the nodes is be flipped on or off. My hope was that merely having a CollapsedSubtreeLayout would take care of this for me. However, I could be missing something obvious.

    2) I have not set up any parent/child relationships between the Nodes. In fact, I cannot figure out how to set up these relationships. The Node class has methods for getting it's parent and children, but no method to set those.  It would make sense that the CollapsedSubtreeLayout would automatically collapse children into their parents, but not if it doesn't know about them.

    Any ideas? Am I on the right path here or have I completely missed the boat on how to make nodes collapse?

    Thanks,

     
    • Tri N

      Tri N - 2008-07-21

      I dont know if this is the best you to solve your problem but a simple FisheyeTreeFilter may help overpopulated problem.

      FisheyeTreeFilter fish = new FisheyeTreeFilter(tree, 2);
      filter.add(fish);

      Just a thought.  Hope it helps.

      Tri

       
    • Gerald Meazell

      Gerald Meazell - 2008-07-21

      Thanks for the response, Tri, but when I tried that, most of my nodes ended up stacked on top of one another in the center of the screen. I'm trying to get the nice, gentle expand and collapse action of the TreeView demo in a RadialTreeLayout.

      Like you, I think I'm missing something simple but I've been beating my head against it for three days and still haven't come up with anything. I've retrofitted my class with just about everything from the TreeView demo, but it is still not working.

       
    • xcraptor

      xcraptor - 2008-07-28

      I do not think I can help you with the layout problem but I can tell you my observations about parents and children ;)

      What do you do to add some edge to a graph (using prefuse...)?
      You say something like: graph.addEdge(node1, node2);

      That means you tell the graph: add an edge between node1 and node2 to your edge tables. This implies the nodes can later on access the edge table and extract their parents and children. Adding edges (implicating to add parents/childrens) is not the business of the nodes.

      Now I wonder how you initiated the radial graph. I never worked with that. Did you read it from a file or manually created the (test) tree hard coded?

       
    • Gerald Meazell

      Gerald Meazell - 2008-08-01

      xcraptor,

      Thanks for the response. To answer your questions:

      Yes, I added the edges in the way you suggested: graph.addEdge(node, node);

      I created the graph manually. I am reading data out of a database and creating nodes and edges according to the relationships found therein.

      Here's another possibility of my missing something obvious: In the TreeView demo, the children don't appear unless you click on the parent. Looking through the code, I don't see where in that demo it sets up clicking on the nodes. I used the RadialGraphView demo as the basis for my code, and it does not have mouse click functionality built in to it. Again, I would have assumed that having a collapsed subtree would have automatically set that up, but I could be wrong. If someone could point out where in the TreeView this expand/collapse action is being set up, that might help me figure out how to make it happen in the RadialGraph.

      Thanks,

       
      • xcraptor

        xcraptor - 2008-08-01

        Hi gmeazell,

        have a look at the filter creation:

        -> filter.add(new FisheyeTreeFilter(tree, 2));

        If you look into the code what it does: it marks nodes as expanded (or unmarks them...) if they are in a given group.
        But you are right, there seems to be a control that handels the group according to some mouse events and here it is:

        -> addControlListener(new FocusControl(1, "filter"));

        I think not it´s better understandable what you need. You need a FishEyeFilter in some filter action and the FocusControl listener.

        Hope this helps.

        Marcus

         
        • xcraptor

          xcraptor - 2008-08-01

          This forum is ridiculous, I want an edit function...

          Of course with

          -> I think not it´s better understandable

          I meant

          -> I think now it´s better understandable

          This is a realy nasty typo :(

          Greetings Marcus

           
    • Gerald Meazell

      Gerald Meazell - 2008-08-01

      Marcus,

      Thanks for the reply. When I add the FishEyeFilter, most of the elements are initially stacked on top of each other on the graph. The ones that are not appear to be the last children in each chain. The stacked ones can be moved around the graph. The unstacked ones only move if their parent is dragged far away.

      If you would be willing, I can send you my class for you to look at. You won't be able to compile it since you won't have the access to the DB, but maybe your more experienced eye could see something I'm missing.

       
      • xcraptor

        xcraptor - 2008-08-01

        Hi,
        sure you might send it to me but I don´t know if I can find the problem.
        I never used that radial layout but I think it´s worth a try.

         
        • xcraptor

          xcraptor - 2008-08-06

          Ah now I understand the problem.

          I had a look at the code and it looked good so I decided to take out everything that can´t be resolved and loading just some demo data in.
          Since I have destroyed anything with the visualization I didn't try further. It looked realy wrecked ;)

          So I manipulated the RadialGraphView and then I saw what you meant.

          I wasn´t able to find the problem yet and I´m out of time for bigger problems at the moment, so I suggest you find a work around.
          As a first idea I reimplemented the filter to work with the distance and not with the DOI and it worked but due to some problems I decided to give it a try as a control instead a filter.

          You can get the wirking control from
          http://goosebumps4all.net/34all/bb/showthread.php?tid=178

          It´s a pre alpha, since I didn´t get the point why the VisibilityAnimator doesn't manage the visibility. Nodes/edges are just visible or not. Flop ;)
          Maybe you can continue there or try to reimplement a more simple FishEyeFilter yourself.

          Greetings Marcus

           
          • Gerald Meazell

            Gerald Meazell - 2008-08-08

            Marcus,

            Thanks for your help. I understand the time constraints. Although management wanted the Radial tree, I may quickly pop out one based on the tree view. That will give them something and if you get time to figure out what's going on later, I can redo it as a radial tree then.

             
            • xcraptor

              xcraptor - 2008-08-11

              I still have no solution at this time but I found the following excerpt in the RadialtreeLayout while I was searching for an opportunity to sort children...

              RadialTreeLayout, method sortedChildren(final NodeItem n), line 252:

                      // TODO: this is hacky and will break when filtering
                      // how to know that a branch is newly expanded?
                      // is there an alternative property we should check?
                      if ( !c.isStartVisible() ) {
                          // use natural ordering for previously invisible nodes
                          return n.children();
                      }

              I checked the cvs version for changes but this is still contained in the code.
              This wrecks your layout I guess.

              Greetings,
              Marcus

               

Log in to post a comment.