SvgExport

Type module

Sources

Items from SvgExport can be imported/included and used via following ways.

/**
 * --------------------------------------------------------
 * Import via: SvgExport.ts
 * Access items like: $svgexport.myVariable
 *                    $svgexport.myFunction()
 * --------------------------------------------------------
 */
import * as $svgexport from "@amcharts/amcharts5/SvgExport";

Variables

imageOpURLs
#

Type WeakMap

Default new WeakMap()

Functions

imageOpURL(

g: SceneGraphics,
canvas: HTMLCanvasElement

)

#

Returns string

renderToSVG(

target: Root | Sprite | IDisplayObject,
options: ISvgExportOptions

)

#

Returns string

A chart as an SVG document, whichever renderer draws it. Leaves out what image export leaves out: elements with exportable: false and pictures from other domains without CORS. Fully transparent elements, such as hit areas and a hidden logo, are left out too.

It is the chart as last drawn: changes made in the same tick appear once the chart has drawn them (e.g. call it from the Root's frameended event).

Drawing the chart first may fire hover events for the pointer's position.

Pass an element, such as a series, to export just that element, where it sits on the chart.

const svg = am5.renderToSVG(root);
const pixels = am5.renderToSVG(pixelSeries.pixels);
var svg = am5.renderToSVG(root);
var pixels = am5.renderToSVG(pixelSeries.pixels);

Click here for more information
@since 5.21.0