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 */import * as $svgexport from "@amcharts/amcharts5/SvgExport";Variables
FONT_SIZEType
RegExpDefault/^(.*?)\s*(\d*\.?\d+(?:px|pt|pc|in|cm|mm|q|r?em|%|ex|ch|v[wh]))(?:\/\S+)?\s+(.+)$/iimageOpURLsType
WeakMapDefaultnew WeakMap()
Functions
clippedTilesPath(doc:SvgDocument,
ops:Array,
tiles:ITileCopies,
kind:"fill"|"stroke",
dash:Array,
dashOffset:number)Returns
stringclipPolygon(points:Array,
left:number,
top:number,
right:number,
bottom:number)Returns
ArrayclipPolyline(points:Array,
left:number,
top:number,
right:number,
bottom:number)Returns
ArraycopiesPath(ops:Array,
copies:Array,
precision:number)Returns
stringdashPolyline(points:Array,
dash:Array,
offset:number)Returns
ArrayfontAttrs(doc:SvgDocument,
font:string)Returns
stringimageOpURL(g:SceneGraphics,
canvas:HTMLCanvasElement)Returns
stringnamedMarkup(markup:string,
name:string)Returns
stringoffsetSink(sink:IPathSink,
dx:number,
dy:number)Returns
IPathSinkrenderToSVG(target:Root|Sprite|IDisplayObject,
options:ISvgExportOptions)Returns
stringSince 5.21.0A chart as an SVG document, whichever renderer draws it. Leaves out what image export leaves out: elements with
exportable: falseand 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
frameendedevent).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);More info: Exporting to SVGrmation
textFont(doc:SvgDocument,
text:SceneText,
font:string)Returns
stringtextShift(doc:SvgDocument,
text:SceneText,
font:string,
baseline:CanvasTextBaseline)Returns
numberwriteTile(doc:SvgDocument,
tile:SceneGraphics,
copies:Array,
width:number,
height:number,
bounds:IBounds,
out:Array)Returns
void