Example:
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("LayOutShapesInCompactTreeStyle.vdx");
// set layout options
compactTreeOptions = new aspose.diagram.LayoutOptions();
compactTreeOptions.setLayoutStyle(aspose.diagram.LayoutStyle.COMPACT_TREE);
compactTreeOptions.setEnlargePage(true);
// set layout direction as DownThenRight and then save
compactTreeOptions.setDirection(aspose.diagram.LayoutDirection.DOWN_THEN_RIGHT);
diagram.layout(compactTreeOptions);
diagram.save("out-sample_down_right.vdx", aspose.diagram.SaveFileFormat.VDX);
// set layout direction as DownThenLeft and then save
diagram = new aspose.diagram.Diagram("LayOutShapesInCompactTreeStyle.vdx");
compactTreeOptions.setDirection(aspose.diagram.LayoutDirection.DOWN_THEN_LEFT);
diagram.layout(compactTreeOptions);
diagram.save("out-sample_down_left.vdx", aspose.diagram.SaveFileFormat.VDX);
// set layout direction as RightThenDown and then save
diagram = new aspose.diagram.Diagram("LayOutShapesInCompactTreeStyle.vdx");
compactTreeOptions.setDirection(aspose.diagram.LayoutDirection.RIGHT_THEN_DOWN);
diagram.layout(compactTreeOptions);
diagram.save("out-sample_right_down.vdx", aspose.diagram.SaveFileFormat.VDX);
// set layout direction as LeftThenDown and then save
diagram = new aspose.diagram.Diagram("LayOutShapesInCompactTreeStyle.vdx");
compactTreeOptions.setDirection(aspose.diagram.LayoutDirection.LEFT_THEN_DOWN);
diagram.layout(compactTreeOptions);
diagram.save("out-LayOutShapesInCompactTreeStyle.vdx", aspose.diagram.SaveFileFormat.VDX);