Type class
A chart as an HTML element: <am5-chart>, built from a JSON config.
<am5-chart themes="Animated" style="height: 400px" config='{ "type": "PieChart", ... }'></am5-chart>
The config is given with the config attribute or property (an object or a JSON string), or loaded from a URL with src. Themes are not part of a config: set them with the themes property (theme classes), or with the themes attribute (names, for the script version, where each theme is a global). renderer="svg" draws the chart as SVG.
With script tags, load index.js, plugins/json.js and element.js, and then the chart types the config uses, e.g. percent.js.
The element dispatches ready when the chart is built, with root and chart in its detail, and error when it could not be. A config given in the page can be built before a script adds its listener: whenReady() works whenever it is called.
Without a height of its own, from CSS or its parent, the element is 400 pixels high.
Click here for more information
Click here for the config format
@since 5.21.0
Sources
ChartElement can be used (imported) via one of the following packages.
// Import ChartElement
import * as am5element from "@amcharts/amcharts5/element";
// Create ChartElement
am5element.ChartElement.new(root, {
// ... config if applicable
});
<!-- Load ChartElement -->
<script src="element.js"></script>
<script>
// Create ChartElement
am5element.ChartElement.new(root, {
// ... config if applicable
});
</script>
Inheritance
ChartElement extends HTMLElement.
ChartElement is not extended by any other symbol.
Settings
ChartElement does not have any settings.
Private settings
ChartElement does not have any private settings.
Properties
|
ATTRIBUTE_NODE # |
Type Inherited from |
|---|---|
|
CDATA_SECTION_NODE # |
Type Inherited from node is a CDATASection node. |
|
COMMENT_NODE # |
Type Inherited from node is a Comment node. |
|
DOCUMENT_FRAGMENT_NODE # |
Type Inherited from node is a DocumentFragment node. |
|
DOCUMENT_NODE # |
Type Inherited from node is a document. |
|
DOCUMENT_POSITION_CONTAINED_BY # |
Type Inherited from Set when other is a descendant of node. |
|
DOCUMENT_POSITION_CONTAINS # |
Type Inherited from Set when other is an ancestor of node. |
|
DOCUMENT_POSITION_DISCONNECTED # |
Type Inherited from Set when node and other are not in the same tree. |
|
DOCUMENT_POSITION_FOLLOWING # |
Type Inherited from Set when other is following node. |
|
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC # |
Type Inherited from |
|
DOCUMENT_POSITION_PRECEDING # |
Type Inherited from Set when other is preceding node. |
|
DOCUMENT_TYPE_NODE # |
Type Inherited from node is a doctype. |
|
ELEMENT_NODE # |
Type Inherited from node is an element. |
|
ENTITY_NODE # |
Type Inherited from |
|
ENTITY_REFERENCE_NODE # |
Type Inherited from |
|
HTMLElement # |
Static
Type { prototype: |
|
NOTATION_NODE # |
Type Inherited from |
|
PROCESSING_INSTRUCTION_NODE # |
Type Inherited from node is a ProcessingInstruction node. |
|
TEXT_NODE # |
Type Inherited from node is a Text node. |
|
accessKey # |
Type Inherited from |
|
accessKeyLabel # |
Type Inherited from |
|
assignedSlot # |
Type Inherited from |
|
attributes # |
Type Inherited from |
|
autocapitalize # |
Type Inherited from |
|
baseURI # |
Type Inherited from Returns node's node document's document base URL. |
|
chart # |
Type What the config built, usually the chart, once it is built. |
|
childElementCount # |
Type Inherited from |
|
childNodes # |
Type Inherited from Returns the children. |
|
children # |
Type Inherited from Returns the child elements. |
|
classList # |
Type Inherited from Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. |
|
className # |
Type Inherited from Returns the value of element's class content attribute. Can be set to change it. |
|
clientHeight # |
Type Inherited from |
|
clientLeft # |
Type Inherited from |
|
clientTop # |
Type Inherited from |
|
clientWidth # |
Type Inherited from |
|
config # |
Type The chart's JSON config: an object, or a JSON string. Setting it builds the chart again. |
|
contentEditable # |
Type Inherited from |
|
dataset # |
Type Inherited from |
|
dir # |
Type Inherited from |
|
draggable # |
Type Inherited from |
|
firstChild # |
Type Inherited from Returns the first child. |
|
firstElementChild # |
Type Inherited from Returns the first child that is an element, and null otherwise. |
|
Type Inherited from |
|
|
id # |
Type Inherited from Returns the value of element's id content attribute. Can be set to change it. |
|
innerHTML # |
Type Inherited from |
|
innerText # |
Type Inherited from |
|
inputMode # |
Type Inherited from |
|
isConnected # |
Type Inherited from Returns true if node is connected and false otherwise. |
|
isContentEditable # |
Type Inherited from |
|
lang # |
Type Inherited from |
|
lastChild # |
Type Inherited from Returns the last child. |
|
lastElementChild # |
Type Inherited from Returns the last child that is an element, and null otherwise. |
|
localName # |
Type Inherited from Returns the local name. |
|
namespaceURI # |
Type Inherited from Returns the namespace. |
|
nextElementSibling # |
Type Inherited from Returns the first following sibling that is an element, and null otherwise. |
|
nextSibling # |
Type Inherited from Returns the next sibling. |
|
nodeName # |
Type Inherited from Returns a string appropriate for the type of node. |
|
nodeType # |
Type Inherited from Returns the type of node. |
|
nodeValue # |
Type Inherited from |
|
nonce # |
Type Inherited from |
|
offsetHeight # |
Type Inherited from |
|
offsetLeft # |
Type Inherited from |
|
offsetParent # |
Type Inherited from |
|
offsetTop # |
Type Inherited from |
|
offsetWidth # |
Type Inherited from |
|
onabort # |
Type ( this: Inherited from Fires when the user aborts the download. @param The event. |
|
onanimationcancel # |
Type ( this: Inherited from |
|
onanimationend # |
Type ( this: Inherited from |
|
onanimationiteration # |
Type ( this: Inherited from |
|
onanimationstart # |
Type ( this: Inherited from |
|
onauxclick # |
Type ( this: Inherited from |
|
onblur # |
Type ( this: Inherited from Fires when the object loses the input focus. @param The focus event. |
|
oncancel # |
Type ( this: Inherited from |
|
oncanplay # |
Type ( this: Inherited from Occurs when playback is possible, but would require further buffering. @param The event. |
|
oncanplaythrough # |
Type ( this: Inherited from |
|
onchange # |
Type ( this: Inherited from Fires when the contents of the object or selection have changed. @param The event. |
|
onclick # |
Type ( this: Inherited from Fires when the user clicks the left mouse button on the object @param The mouse event. |
|
onclose # |
Type ( this: Inherited from |
|
oncontextmenu # |
Type ( this: Inherited from Fires when the user clicks the right mouse button in the client area, opening the context menu. @param The mouse event. |
|
oncopy # |
Type ( this: Inherited from |
|
oncuechange # |
Type ( this: Inherited from |
|
oncut # |
Type ( this: Inherited from |
|
ondblclick # |
Type ( this: Inherited from Fires when the user double-clicks the object. @param The mouse event. |
|
ondrag # |
Type ( this: Inherited from Fires on the source object continuously during a drag operation. @param The event. |
|
ondragend # |
Type ( this: Inherited from Fires on the source object when the user releases the mouse at the close of a drag operation. @param The event. |
|
ondragenter # |
Type ( this: Inherited from Fires on the target element when the user drags the object to a valid drop target. @param The drag event. |
|
ondragexit # |
Type ( this: Inherited from |
|
ondragleave # |
Type ( this: Inherited from Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. @param The drag event. |
|
ondragover # |
Type ( this: Inherited from Fires on the target element continuously while the user drags the object over a valid drop target. @param The event. |
|
ondragstart # |
Type ( this: Inherited from Fires on the source object when the user starts to drag a text selection or selected object. @param The event. |
|
ondrop # |
Type ( this: Inherited from |
|
ondurationchange # |
Type ( this: Inherited from Occurs when the duration attribute is updated. @param The event. |
|
onemptied # |
Type ( this: Inherited from Occurs when the media element is reset to its initial state. @param The event. |
|
onended # |
Type ( this: Inherited from Occurs when the end of playback is reached. @param The event |
|
onerror # |
Type Inherited from Fires when an error occurs during object loading. @param The event. |
|
onfocus # |
Type ( this: Inherited from Fires when the object receives focus. @param The event. |
|
onfullscreenchange # |
Type ( this: Inherited from |
|
onfullscreenerror # |
Type ( this: Inherited from |
|
ongotpointercapture # |
Type ( this: Inherited from |
|
oninput # |
Type ( this: Inherited from |
|
oninvalid # |
Type ( this: Inherited from |
|
onkeydown # |
Type ( this: Inherited from Fires when the user presses a key. @param The keyboard event |
|
onkeypress # |
Type ( this: Inherited from Fires when the user presses an alphanumeric key. @param The event. |
|
onkeyup # |
Type ( this: Inherited from Fires when the user releases a key. @param The keyboard event |
|
onload # |
Type ( this: Inherited from Fires immediately after the browser loads the object. @param The event. |
|
onloadeddata # |
Type ( this: Inherited from Occurs when media data is loaded at the current playback position. @param The event. |
|
onloadedmetadata # |
Type ( this: Inherited from Occurs when the duration and dimensions of the media have been determined. @param The event. |
|
onloadend # |
Type ( this: Inherited from |
|
onloadstart # |
Type ( this: Inherited from Occurs when Internet Explorer begins looking for media data. @param The event. |
|
onlostpointercapture # |
Type ( this: Inherited from |
|
onmousedown # |
Type ( this: Inherited from Fires when the user clicks the object with either mouse button. @param The mouse event. |
|
onmouseenter # |
Type ( this: Inherited from |
|
onmouseleave # |
Type ( this: Inherited from |
|
onmousemove # |
Type ( this: Inherited from Fires when the user moves the mouse over the object. @param The mouse event. |
|
onmouseout # |
Type ( this: Inherited from Fires when the user moves the mouse pointer outside the boundaries of the object. @param The mouse event. |
|
onmouseover # |
Type ( this: Inherited from Fires when the user moves the mouse pointer into the object. @param The mouse event. |
|
onmouseup # |
Type ( this: Inherited from Fires when the user releases a mouse button while the mouse is over the object. @param The mouse event. |
|
onpaste # |
Type ( this: Inherited from |
|
onpause # |
Type ( this: Inherited from Occurs when playback is paused. @param The event. |
|
onplay # |
Type ( this: Inherited from Occurs when the play method is requested. @param The event. |
|
onplaying # |
Type ( this: Inherited from Occurs when the audio or video has started playing. @param The event. |
|
onpointercancel # |
Type ( this: Inherited from |
|
onpointerdown # |
Type ( this: Inherited from |
|
onpointerenter # |
Type ( this: Inherited from |
|
onpointerleave # |
Type ( this: Inherited from |
|
onpointermove # |
Type ( this: Inherited from |
|
onpointerout # |
Type ( this: Inherited from |
|
onpointerover # |
Type ( this: Inherited from |
|
onpointerup # |
Type ( this: Inherited from |
|
onprogress # |
Type ( this: Inherited from Occurs to indicate progress while downloading media data. @param The event. |
|
onratechange # |
Type ( this: Inherited from Occurs when the playback rate is increased or decreased. @param The event. |
|
onreset # |
Type ( this: Inherited from Fires when the user resets a form. @param The event. |
|
onresize # |
Type ( this: Inherited from |
|
onscroll # |
Type ( this: Inherited from Fires when the user repositions the scroll box in the scroll bar on the object. @param The event. |
|
onsecuritypolicyviolation # |
Type ( this: Inherited from |
|
onseeked # |
Type ( this: Inherited from Occurs when the seek operation ends. @param The event. |
|
onseeking # |
Type ( this: Inherited from Occurs when the current playback position is moved. @param The event. |
|
onselect # |
Type ( this: Inherited from Fires when the current selection changes. @param The event. |
|
onselectionchange # |
Type ( this: Inherited from |
|
onselectstart # |
Type ( this: Inherited from |
|
onstalled # |
Type ( this: Inherited from Occurs when the download has stopped. @param The event. |
|
onsubmit # |
Type ( this: Inherited from |
|
onsuspend # |
Type ( this: Inherited from Occurs if the load operation has been intentionally halted. @param The event. |
|
ontimeupdate # |
Type ( this: Inherited from Occurs to indicate the current playback position. @param The event. |
|
ontoggle # |
Type ( this: Inherited from |
|
ontouchcancel # |
Type ( this: Inherited from |
|
ontouchend # |
Type ( this: Inherited from |
|
ontouchmove # |
Type ( this: Inherited from |
|
ontouchstart # |
Type ( this: Inherited from |
|
ontransitioncancel # |
Type ( this: Inherited from |
|
ontransitionend # |
Type ( this: Inherited from |
|
ontransitionrun # |
Type ( this: Inherited from |
|
ontransitionstart # |
Type ( this: Inherited from |
|
onvolumechange # |
Type ( this: Inherited from Occurs when the volume is changed, or playback is muted or unmuted. @param The event. |
|
onwaiting # |
Type ( this: Inherited from Occurs when playback stops because the next frame of a video resource is not available. @param The event. |
|
onwheel # |
Type ( this: Inherited from |
|
outerHTML # |
Type Inherited from |
|
ownerDocument # |
Type Inherited from Returns the node document. Returns null for documents. |
|
parentElement # |
Type Inherited from Returns the parent element. |
|
parentNode # |
Type Inherited from Returns the parent. |
|
prefix # |
Type Inherited from Returns the namespace prefix. |
|
previousElementSibling # |
Type Inherited from Returns the first preceding sibling that is an element, and null otherwise. |
|
previousSibling # |
Type Inherited from Returns the previous sibling. |
|
root # |
Type The chart's root element, once it is built. |
|
scrollHeight # |
Type Inherited from |
|
scrollLeft # |
Type Inherited from |
|
scrollTop # |
Type Inherited from |
|
scrollWidth # |
Type Inherited from |
|
shadowRoot # |
Type Inherited from Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. |
|
slot # |
Type Inherited from Returns the value of element's slot content attribute. Can be set to change it. |
|
spellcheck # |
Type Inherited from |
|
style # |
Type Inherited from |
|
tabIndex # |
Type Inherited from |
|
tagName # |
Type Inherited from Returns the HTML-uppercased qualified name. |
|
textContent # |
Type Inherited from |
|
themes # |
Type Themes for the chart, as theme classes, e.g. Setting them builds the chart again. |
|
title # |
Type Inherited from |
|
translate # |
Type Inherited from |
| There are 173 inherited items currently hidden from this list. | |
Methods
|
addEventListener( type: ) |
Returns |
|---|---|
|
after( nodes: ) |
Returns Inherited from Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. |
|
animate( keyframes: ) |
Returns Inherited from |
|
append( nodes: ) |
Returns Inherited from Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes. Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. |
|
appendChild( newChild: ) |
Returns Inherited from |
|
attachShadow( init: ) |
Returns Inherited from Creates a shadow root for element and returns it. |
|
before( nodes: ) |
Returns Inherited from Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes. Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. |
|
blur() |
Returns Inherited from |
|
click() |
Returns Inherited from |
|
cloneNode( deep?: ) |
Returns Inherited from Returns a copy of node. If deep is true, the copy also includes the node's descendants. |
|
closest( selector: ) |
Returns Inherited from Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. |
|
compareDocumentPosition( other: ) |
Returns Inherited from Returns a bitmask indicating the position of other relative to node. |
|
contains( other: ) |
Returns Inherited from Returns true if other is an inclusive descendant of node, and false otherwise. |
|
dispatchEvent( event: ) |
Returns Inherited from Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. |
|
focus( options?: ) |
Returns Inherited from |
|
getAnimations() |
Returns Inherited from |
|
getAttribute( qualifiedName: ) |
Returns Inherited from Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. |
|
getAttributeNS( namespace: ) |
Returns Inherited from Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. |
|
getAttributeNames() |
Returns Inherited from Returns the qualified names of all element's attributes. Can contain duplicates. |
|
getAttributeNode( name: ) |
Returns Inherited from |
|
getAttributeNodeNS( namespaceURI: ) |
Returns Inherited from |
|
getBoundingClientRect() |
Returns Inherited from |
|
getClientRects() |
Returns Inherited from |
|
getElementsByClassName( classNames: ) |
Returns Inherited from Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. |
|
getElementsByTagName( qualifiedName: ) |
Returns Inherited from |
|
getElementsByTagNameNS( namespaceURI: ) |
Returns Inherited from |
|
getRootNode( options?: ) |
Returns Inherited from Returns node's root. |
|
hasAttribute( qualifiedName: ) |
Returns Inherited from Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise. |
|
hasAttributeNS( namespace: ) |
Returns Inherited from Returns true if element has an attribute whose namespace is namespace and local name is localName. |
|
hasAttributes() |
Returns Inherited from Returns true if element has attributes, and false otherwise. |
|
hasChildNodes() |
Returns Inherited from Returns whether node has children. |
|
hasPointerCapture( pointerId: ) |
Returns Inherited from |
|
insertAdjacentElement( position: ) |
Returns Inherited from |
|
insertAdjacentHTML( where: ) |
Returns Inherited from |
|
insertAdjacentText( where: ) |
Returns Inherited from |
|
insertBefore( newChild: ) |
Returns Inherited from |
|
isDefaultNamespace( namespace: ) |
Returns Inherited from |
|
isEqualNode( otherNode: ) |
Returns Inherited from Returns whether node and otherNode have the same properties. |
|
isSameNode( otherNode: ) |
Returns Inherited from |
|
lookupNamespaceURI( prefix: ) |
Returns Inherited from |
|
lookupPrefix( namespace: ) |
Returns Inherited from |
|
matches( selectors: ) |
Returns Inherited from Returns true if matching selectors against element's root yields element, and false otherwise. |
|
msGetRegionContent() |
Returns Inherited from |
|
normalize() |
Returns Inherited from Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes. |
|
prepend( nodes: ) |
Returns Inherited from Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes. Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. |
|
querySelector( selectors: ) |
Returns Inherited from Returns the first element that is a descendant of node that matches selectors. |
|
querySelectorAll( selectors: ) |
Returns Inherited from Returns all element descendants of node that match selectors. |
|
releasePointerCapture( pointerId: ) |
Returns Inherited from |
|
remove() |
Returns Inherited from Removes node. |
|
removeAttribute( qualifiedName: ) |
Returns Inherited from Removes element's first attribute whose qualified name is qualifiedName. |
|
removeAttributeNS( namespace: ) |
Returns Inherited from Removes element's attribute whose namespace is namespace and local name is localName. |
|
removeAttributeNode( attr: ) |
Returns Inherited from |
|
removeChild( oldChild: ) |
Returns Inherited from |
|
removeEventListener( type: ) |
Returns |
|
replaceChild( newChild: ) |
Returns Inherited from |
|
replaceWith( nodes: ) |
Returns Inherited from Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes. Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. |
|
requestFullscreen( options?: ) |
Returns Inherited from Displays element fullscreen and resolves promise when done. When supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to "show", navigation simplicity is preferred over screen space, and if set to "hide", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value "auto" indicates no application preference. |
|
requestPointerLock() |
Returns Inherited from |
|
scroll( options?: ) |
Returns Inherited from |
|
scrollBy( options?: ) |
Returns Inherited from |
|
scrollIntoView( arg?: ) |
Returns Inherited from |
|
scrollTo( options?: ) |
Returns Inherited from |
|
setAttribute( qualifiedName: ) |
Returns Inherited from Sets the value of element's first attribute whose qualified name is qualifiedName to value. |
|
setAttributeNS( namespace: ) |
Returns Inherited from Sets the value of element's attribute whose namespace is namespace and local name is localName to value. |
|
setAttributeNode( attr: ) |
Returns Inherited from |
|
setAttributeNodeNS( attr: ) |
Returns Inherited from |
|
setPointerCapture( pointerId: ) |
Returns Inherited from |
|
toggleAttribute( qualifiedName: ) |
Returns Inherited from If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName. Returns true if qualifiedName is now present, and false otherwise. |
|
webkitMatchesSelector( selectors: ) |
Returns Inherited from |
|
whenReady() |
Returns Returns a promise of the built chart. It resolves at once if the chart is already built, or once it is, and rejects if the build fails or the element is removed first. A new config makes a new chart and a new promise. |
| There are 67 inherited items currently hidden from this list. | |
Events
ChartElement does not have any events.