Skip to content

charton API


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

Function: createImageTool() ​

createImageTool(options): DrawingToolDef

Defined in: packages/core/src/drawing/image-tool.ts:157

The image drawing tool: an image stretched over the box between two points. A drawing keeps only the app's reference to its image, in text, so saved drawings and the clipboard never carry image bytes. Until the image loads the box shows a dashed outline, and a failed load a crossed box. Images of the 256 most recently drawn references are cached. With store, an image pasted on the chart becomes a drawing too.

Parameters ​

options ​

ImageToolOptions

Returns ​

DrawingToolDef

Example ​

ts
chart.drawings.register(createImageTool({ load: (ref) => fetch(ref).then((r) => r.blob()) }));
chart.drawings.add({ type: 'image', pane: 0, points: [a, b], style: {}, text: '/logo.png' });