Interface DiagramRendererOptions

GoJS® Diagramming Components
version 3.0.15
by Northwoods Software®

Hierarchy (view full)

Used for the options arguments to Diagram.makeImage, Diagram.makeImageData, and Diagram.makeSvg.

Index

Properties

A valid CSS color to replace the default (transparent) canvas background. Any padding area is also colored.

The function to call when an image is finished creation. It has one argument, which is of the type specified by the value of the ImageRendererOptions.returnType or SVG DOM. If provided, call the callback when finished instead of returning immediately. This can be useful if you need to wait for image assets to load. This also respects the callbackTimeout. This argument is necessary if the ImageRendererOptions.returnType is "blob", however a callback can be used with any ImageRendererOptions.returnType. See the Minimal Image Blob Download sample for an example usage, which also demonstrates downloading an image file without involving a web server.

Type declaration

    • (result: any): void
    • Parameters

      • result: any

      Returns void

If a callback is specified, the additional amount of time in milliseconds a call will wait before completeing. Right now, it will only wait if image assets in the Diagram are not yet loaded. Default is 300 (milliseconds).

An HTML Document, defaulting to window.document (or the root object in other contexts) This may be useful to set if you intend your Image or SVG to be opened in a new window.

The maximum size of the created image, as a Size. The default value is (Infinity, Infinity) for SVG and (2000, 2000) for images. This is typically used when scale is specified and helps prevent accidental excessive memory usage, which is especially needed in limited-memory environments. You cannot use Infinity when providing a maximum size for an image -- consider calling Diagram.makeSvg instead.

A Margin (or number) to pad the image with. If a size is specified, the padding will not increase the image size, it will only offset the Diagram contents within the image. The default value is a padding of 1.

An iterator of GraphObjects, typically Parts, such as one from Diagram.selection or Layer.parts. If GraphObjects are specified their containing Part will be drawn. By default all Parts are drawn except temporary parts (see showTemporary).

The position of the diagram, as a Point. By default this is the position of Diagram.documentBounds with the Diagram.padding removed. If a specific parts collection is used, by default this is the top-left diagram position of their collective bounds. If you set a position, you should also set a size.

The scale of the diagram. If scale is specified and size is not, the resulting image will be sized to uniformly fit the space needed for the given scale. Can be constrained by the maxSize property. A scale value of NaN will automatically scale to fit within the maxSize, but may be smaller, with a maximum computed scale of 1.

A boolean value, defaulting to the value of showTemporary, that determines whether or not the Grid Layer (containing Diagram.grid) is included in the image regardless of the value of showTemporary. This is useful if you want to include the grid but not adornments, or vice versa.

A boolean value, defaulting to false, that determines whether or not temporary objects such as adornments are included in the image.

The size of the created image, as a Size, limited by the maxSize property. If no scale or position is specified then the diagram will be scaled to fit the given size. If you set a size, you should also set a position. If you are scaling the diagram, you may also want to scale the size.