Diagram Position
The targetBounds parameter of the VsdxIO.addGraph
method controls the exact position and size of the diagram on the VSDX page. This method scales
the diagram such that it fits into the target bounds. It preserves the aspect ratio, centering the diagram
along the shorter axis. Note that the targetBounds are given in VSDX page coordinates, meaning in inches and
with the y-axis pointing up. The x and y coordinates define the bottom left corner.
const vsdxIO = VsdxIO.createDefault()
// create a page and set its dimensions
const page = vsdxIO.vsdxPackage.pages.createPage('Page')
page.pageWidth = Value.scalar(8)
page.pageHeight = Value.scalar(10)
// define the target bounds in page coordinates
const targetBounds = new Rect(1, 4, 6, 5)
await vsdxIO.addGraph({ graphComponent, page, targetBounds })