charton API / @chart-on/core / index / iconTool
Variable: iconTool
consticonTool:DrawingToolDef
Defined in: packages/core/src/drawing/icon-tools.ts:63
The icon drawing tool: inline SVG markup from the app (the drawing's text) drawn centred on its point, fitted into a square of fontSize css px at angle degrees clockwise, so it reads the same at any zoom. currentColor in the markup takes the text color. The SVG is drawn as an image, never inserted into the page: scripts in it do not run and it loads nothing it references. A strict content security policy needs data: in img-src. While selected, a corner handle sets the size and a handle above it the angle. Not one of the built-in tools: register it to offer it.
Example
ts
const chart = createChart(el, { plugins: [drawingTools([...builtinTools, iconTool])] });
const star = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2l3 7h7l-6 4 2 8-6-5-6 5 2-8-6-4h7z"/></svg>';
chart.drawings.add({ type: 'icon', pane: 0, points: [point], style: { fontSize: 24, textColor: '#e0a030' }, text: star });