2

I have assigned a specific set of coordinates to create a Group Cell in JGraphX. When I create two vertices to be placed in the group and then group it in the parent cell , the x and y coordinates of the group cell change infact are reduced , due to which the groups aren't properly aligned in the graph . This happens further when I try to create and group more and more vertices in the parent Cell . Any solution to avoid this

          Object vn= graph.insertVertex(graph.getDefaultParent(),null,null,400,500,150,40);//create group

   createGraph(vn); //calling function to create vertices nd then group


       void createGraph(graphGroup)
              {
            for(Object card : cardList)
              {
                int x=400 ,y=500;
            graph.createGroupCell(new Object[] { graphGroup });//groupCell

                 try
                   {
                   Object v1 ,v2 = null;

               v1 = graph.insertVertex(graphGroup, null, centerCard, x, y,150,40);
               v2 = graph.insertVertex(graphGroup,null,centerCard.getConnectedCard(), x +50 , y,150,40);
              Object e1 = graph.insertEdge(graphGroup, null, "", v1, v2);
                graph.groupCells(graphGroup, 125, new Object[] { v1, v2 });
                }
                 mxCompactTreeLayout treel = new mxCompactTreeLayout(graph,false);
                treel.execute(graphGroup);
Frodo Baggins
  • 8,290
  • 6
  • 45
  • 55
span
  • 75
  • 6

0 Answers0