Menu

Timer Animation in Graph view

Help
2008-08-03
2013-05-29
  • Neil Pradhan

    Neil Pradhan - 2008-08-03

    I had graphview demo which shows first level children of the parent node. This is done using the graphdistance filter and setting hops = 1. In this when I click on a node it becomes the parent and its first level children are shown.

    I wanted to implement this functionality as an animation over time. So instead of mouse click the parent node should be set automatically after a certain time and then its first level children should be shown. Similarly other nodes can be selected in a round robin way and its children be displayed.

    I had made a timer with javax.swing which prints a sentence on console after some amount of time. How can I integrate this with the graphview demo? Any suggestions?

    Thanks,

    Neil

     
    • xcraptor

      xcraptor - 2008-08-03

      Hi Neil,

      I´m not sure if you want to HIDE nodes and only show them if a connected node is selected or if you just want to HIGHLIGHT those but they are visible all time.

      If you want to HIDE nodes my suggestion is to use your timer to add/remove nodes to a group like Visualization.FOCUS_ITEMS.
      (That´s the group the FisheyeFilter accesses if no other is given...)
      The rest should be done by the FisheyeFilter.

      If you want to mark nodes then use your timer to choose a node. Then you can simply set its predecessors and successors on setHighLighted(true).
      (Don´t forget to cast from VisualItem to Node.)
      Another way would be not setting them highlighted but adding them to some group and using an InGroupPredicate in your nodeColorAction to set any attribute like fill color, stroke color.

      Hope this helps,
      Marcus

       
      • xcraptor

        xcraptor - 2008-08-03

        Oh, I just saw it doesn't use the FisheyeFilter but the GraphDistanceFilter but anyways, it´s the same way.

        Somehow I had the time to modify the demo a little, have a look at
        http://goosebumps4all.net/34all/bb/showthread.php?tid=171&pid=441#pid441

        Greetings,
        Marcus

         
    • Neil Pradhan

      Neil Pradhan - 2008-08-03

      Hi Marcus,

      Thanks a lot for posting the code. It was very useful!

      I was looking at the way the nodes are selected:

      Graph g = (Graph)m_vis.getGroup(graph);
                  int nodecount = g.getNodeCount();
                  int numberOfNode = rand.nextInt(nodecount);
                  int counter = 0;
                  Iterator<Node> nodes = g.nodes();
                  Node selectedNode = null;
                  while (++counter<numberOfNode) {
                      nodes.next();
                  }
                  selectedNode = nodes.next();

      The code considers all nodes in the graph while selecting. I was thinking if it is possible to take into consideration only the "previously focussed nodes" for selecting the next node:

      eg. A -> parent

          B -> first child of A

          C -> first child of A

          D,E,F,G,H -> other nodes...

      The random selection to be done only from the first child of A (Parent) and not all nodes..

      Thanks for the help,

      Neil

       
    • xcraptor

      xcraptor - 2008-08-03

      Hey Neil,
      I only implemented the random function because I needed something to emulate the behavior.
      Furthermore I did not know how you wanted to select the next node.
      I thought you are doing something like a slideshow and insert the node order by some input file or something like that.

      In your case I suggest you follow more or less this way:
      - the first node is selected randomly like in my demo (from all nodes)
      - then you create a new focus group and while you set the highlighting flag you can put the highlighted nodes into this tupleset/group
      - in the following iterations you access the set exactly like I did it with the whole graph group and randomly select a node of that group

      Hope this helps you.

      Greetings,
      Marcus

       

Log in to post a comment.