Zoom to card

Using the OrgChart, we are connecting to the page with GoogleAuth

Is is possible to zoom/focus on the users card based on that?

You have to know what node you want to zoom to.

    // and center it and select it
    diagram.centerRect(node.actualBounds);
    diagram.select(node);

Or

    diagram.zoomToRect(node.actualBounds);

But getting a reference to the node depends on the information you have.

Sure. Just find the Node and then call Diagram.centerRect. Something like:

  var n = myDiagram.findNodeForKey(...);
  if (n) myDiagram.centerRect(n.actualBounds);

Be sure to only call centerRect if the Node has a real bounds. So if you have just added a node, you need to wait until after the layout has happened. That’s normally done in a “LayoutCompleted” DiagramEvent listener.

There are several samples that do something like this. See for example State Chart in the addNodeAndLink function. Or how the user can step through all of the highlighted nodes chosen by a search: Org Chart Static.

Awesome,

So if I understand correctly.

var nodeDataArray = [
    {"key": 25279035767, ... }];
var n = myDiagram.findNodeForKey(25279035767);
   if (n) myDiagram.centerRect(n.actualBounds);