The graph in this example consists of four nodes, only three of which are visible
in the initial viewport. The fourth node is initially outside the viewport.
Calling fitGraphBounds adjusts the
viewport of the GraphComponent to contain the complete graph.
void graphComponent.fitGraphBounds()
The zoom and
viewPoint can also be set manually. In
this sample, we use both to reset the viewport to the initial state.
graphComponent.zoom = 1
graphComponent.viewPoint = Point.ORIGIN
graphComponent.updateContentBounds()
await graphComponent.fitContent()
Fitting the graph bounds can also be animated using the optional parameters of the
fitGraphBounds method.
await graphComponent.fitGraphBounds({ animated: true })