AMElement
Type class
A base class for all SVG elements. Provides low-level DOM functionality.
All visual elements extend this class.
Sources
AMElement can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.AMElement */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.AMElement */Inheritance
AMElement does not extend any other symbol.
AMElement is extended by Group.
Properties
contentType
stringElement's SVG contents.
Returns element's contents as SVG markup.
nodeType
SVGSVGElementAn SVG node of the element.
rotationType
numberElement's rotation in degrees.
scaleType
numberElement's scale where 1 is original size.
Setting to 0.5 will reduce element's size by 50%, 2 will make element twice as large, etc.
textContentType
stringText contents of the SVG element.
xType
numberElement's X position in pixels.
yType
numberElement's Y position in pixels.
Methods
addClass(name:string)Returns
voidAdds a class to element.
addStyle(attributes:Object)Returns
AMElementAdds style attributes to element's node.
attr(attributes:ISVGAttribute)Returns
AMElementSets a set of attributes on a element.
attrNS(ns:string,
attribute:string,
value:string)Returns
AMElementSets a single attribute of the element's node using namesspace.
constructor(element:string|SVGSVGElement)Returns
AMElementConstructor creates a new element or uses the one that was passed in.
dispose()Returns
voidDisposes element.
getAttr(attribute:string)Returns
string|nullReturns a value of a node attribute.
getAttrNS(ns:string,
attribute:string)Returns
stringReturns a namespaced attribute value from node.
getBBox()Returns
IRectangleReturns bounding box of the element.
ATTENTION: Bounding box calculations are extremely costly so should be used sparingly and cached whenever possible.
getStyle(attribute:string)Returns
stringReturns style attribute value.
isDisposed()Returns
booleanWas this element already been disposed?
moveTo(point:IPoint)Returns
voidMoves the element to new coordinates.
removeAttr(attribute:string)Returns
voidRemoves an attribute from element.
removeChildNodes()Returns
voidRemoves all element's child nodes, basically leaving it empty.
removeClass(name:string)Returns
voidRemoves a class from element.
removeNode()Returns
voidRemoves element's node from DOM.
removeStyle(attribute:string)Returns
voidRemoves
styleattribute from node.setClass(name:string)Returns
voidSets a class name on element.
Events
AMElement does not have any events.