Programmatic Diagram viewport services

The following Diagram viewport services are available:
  • centerOnNode(object,options?): centers the viewport on an object of the graph.
    It does not change the zoom level. The options argument is the viewport kwArgs. If options is {animate:true}, the viewport is moved in an animation until it reaches the destination centered on the object.
  • visualizeBounds(object,options?): makes the bounds of a graph object visible, giving them an extra air between the area and the borders of the viewport, if possible. The view can be zoomed out if required, but it is never zoomed in.
    object: the Node, Link, or Subgraph to make visible in the viewport.
    options: the viewport options object with an additional parameter for this operation named expandCurrent. If expandCurrent is false (the default), the viewport area is centered. If it is true, the viewport is expanded to include the bounds of the target object.
For example:
dijit.byId("myDiagram").visualizeBounds(aNode,{expandCurrent:true});