Skip to content

charton API


charton API / @chart-on/core / index / ScreenshotOptions

Interface: ScreenshotOptions ​

Defined in: packages/core/src/chart.ts:763

What chart.captureImage captures and how: the layers to include, image type and scale, background, padding, theme and an optional caption.

Extended by ​

Properties ​

annotations? ​

optional annotations?: boolean

Defined in: packages/core/src/chart.ts:783

Include annotations: markers, price lines, trade lines and their axis labels. Default true.


background? ​

optional background?: string

Defined in: packages/core/src/chart.ts:789

What fills the image behind the chart: a CSS color, or 'transparent' for an image with an alpha channel (PNG or WebP; JPEG has none and shows black). Default: the theme background. A color the chart cannot read falls back to the theme background.


caption? ​

optional caption?: string | boolean

Defined in: packages/core/src/chart.ts:803

A header line above the chart. true: the symbol, the interval, the newest bar's values and the export time in the chart timezone. A string: that text instead. Default false.


crosshair? ​

optional crosshair?: boolean

Defined in: packages/core/src/chart.ts:767

Include the crosshair and its labels. Default false.


drawings? ​

optional drawings?: boolean

Defined in: packages/core/src/chart.ts:781

Include drawings. Default true.


legend? ​

optional legend?: boolean

Defined in: packages/core/src/chart.ts:765

Paint the series legend onto the image. Default: follows the legend feature flag.


padding? ​

optional padding?: number

Defined in: packages/core/src/chart.ts:791

Empty margin around the chart in CSS pixels, filled with the background. Default 0.


quality? ​

optional quality?: number

Defined in: packages/core/src/chart.ts:771

Encoder quality from 0 to 1 for lossy types such as image/jpeg or image/webp.


scale? ​

optional scale?: number

Defined in: packages/core/src/chart.ts:777

Image pixels per CSS pixel. Default: the device pixel ratio. Above it the chart is redrawn at this ratio for the capture and the screen is restored afterwards, so scale: 2 gives a sharp image from a standard display. Lowered so that no side exceeds 8192 pixels.


theme? ​

optional theme?: ChartTheme | "dark" | "light"

Defined in: packages/core/src/chart.ts:798

Draw the image in another theme: a whole ChartTheme, or 'light' / 'dark' for the built-in light and dark themes with the chart's own fonts. The screen keeps its theme: the capture swaps it and puts it back in the same task, before the browser paints, also when drawing fails. No theme:change event is emitted. Default: the chart's theme.


type? ​

optional type?: string

Defined in: packages/core/src/chart.ts:769

Image MIME type passed to canvas.toBlob. Default: image/png.


watermark? ​

optional watermark?: boolean

Defined in: packages/core/src/chart.ts:779

Include the watermark and the attribution (features.attributionLogo). Default true (they show when the chart shows them).