My graph doesn't show scrollbars if I reset the X and Y of the vertices. But scrollbars appear when I zoom in.

public class DisplayGraph extends mxGraph {

....

//here I put my nodes

private ArrayList<object> mxGraphNodes = new ArrayList<object>();

....

public void ScalingGraph(double ds) {

    getModel().beginUpdate();

    try {
        for (Object obj : mxGraphNodes) {
            mxCell cell = (mxCell) obj;
            mxGeometry geometry = cell.getGeometry();

            geometry.setX(ds * geometry.getX());
            geometry.setY(ds * geometry.getY());
            cell.setGeometry(geometry);
        }

        this.refresh();

    } finally {
        getModel().endUpdate();
    }
}

....

}

When I call this method, the vertices get their new postions of which some vertices may be out of the viewport (the graphBounds is changed), but no scrollbar is showing up. But in case of zooming it works fine.

asked 26 May '12, 04:32

shiblicse's gravatar image

shiblicse
33
accept rate: 0%

edited 26 May '12, 04:35


This is the wrong code for setting the cell geometry. See examples/manual.

link

answered 27 May '12, 02:23

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

Thanks a lot.

resizeCell(cell, bounds) works as expected.

Is this the right way?

(27 May '12, 05:16) shiblicse
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×11
×9

Asked: 26 May '12, 04:32

Seen: 1,169 times

Last updated: 27 May '12, 05:16