Skip to main content
  1. Index

Resizing Diagrams

Sometimes it may be necessary to resize the div that contains a GoJS Diagram. Recent browsers let GoJS detect changes to the div's size on their own, but some older browsers do not, in which case Diagram.requestUpdate is neccessary.

Using Diagram.requestUpdate to resize a div

The following example has a button that changes the width Diagram's div without calling Diagram.requestUpdate. When it is clicked, the div is visibly resized and the document is moved to be visible.

In this case there is a delay when resizing the div. This is because these changes are debounced, or effectively delayed, by defaualt. When you want the Diagram to resize immediately after its div does, add a call to Diagram.requestUpdate after you have resized the div.

Below is nearly identical code, except that a call to Diagram.requestUpdate has been added.