# Interface DiagramRendererOptions

GoJS® Diagramming Components
version 3.0.5
by Northwoods Software®

#### Hierarchy

- DiagramRendererOptions
  - ImageRendererOptions
  - SvgRendererOptions

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

#####
Index

### Properties

background?
callback?
callbackTimeout?
document?
maxSize?
padding?
parts?
position?
scale?
showGrid?
showTemporary?
size?

## Properties

### `Optional` background
: BrushLike

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

### `Optional` callback
: ((result: any) => void)

#### Type declaration

- - (result: any): void

  - 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.

    #### Parameters

    - ##### result: any

    #### Returns void

### `Optional` callbackTimeout
: number

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).

### `Optional` document
: Document

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.

### `Optional` maxSize
: Size

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.

### `Optional` padding
: MarginLike

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`.

### `Optional` parts
: Iterable<Part> | Part[]

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).

### `Optional` position
: Point

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.

### `Optional` scale
: number

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.

### `Optional` showGrid
: boolean

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.

### `Optional` showTemporary
: boolean

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

### `Optional` size
: Size

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.

Copyright © 1998-2024 by Northwoods Software Corporation.