Type class
A base class for all visual elements.
Sources
Sprite can be used (imported) via one of the following packages.
// Sprite is available in all of the following modules. // You only need to import one of them. /** * -------------------------------------------------------- * Import from: "index.ts" * Use like: am5.Sprite * -------------------------------------------------------- */ import * as am5 from "@amcharts/amcharts5";
// Sprite is available in all of the following modules. // You only need to import one of them. /** * -------------------------------------------------------- * Include via: <script src="index.js"></script> * Access items like: am5.Sprite * -------------------------------------------------------- */
Inheritance
Sprite extends Entity.
Sprite is extended by Graphics, Container, Picture.
Settings
Set these settings on a Sprite object using its set() and setAll() methods.
Read about settings concept.
|
active # |
Type Indicates if element is currently active. |
|---|---|
|
centerX # |
Type X coordinate of the center of the element relative to itself. Center coordinates will affect placement as well as rotation pivot point. |
|
centerY # |
Type Y coordinate of the center of the element relative to itself. Center coordinates will affect placement as well as rotation pivot point. |
|
cursorOverStyle # |
Type A named mouse cursor style to show when hovering this element. Click here for more info |
|
dateFormatter # |
Type An instance of Click here for more info |
|
disabled # |
Type Indicates if element is disabled. |
|
draggable # |
Type If set to |
|
durationFormatter # |
Type An instance of Click here for more info |
|
dx # |
Type Horizontal shift in pixels. Can be negative to shift leftward. |
|
dy # |
Type Vertical shift in pixels. Can be negative to shift upward. |
|
exportable # |
Type If set to |
|
forceHidden # |
Type If set to |
|
forceInactive # |
Type If set to @since 5.0.21 |
|
height # |
Type Element's absolute height in pixels (numeric value) or relative height to parent ( |
|
id # |
Type Inherited from A custom string ID for the element. If set, element can be looked up via Will raise error if an element with the same ID already exists. |
|
interactive # |
Type Should this element accept user interaction events? |
|
isMeasured # |
Type If set to |
|
layer # |
Type Numeric layer to put element in. Elements with higher number will appear in front of the ones with lower numer. If not set, will inherit layer from its ascendants. |
|
marginBottom # |
Type Bottom margin in pixels. |
|
marginLeft # |
Type Left margin in pixels. |
|
marginRight # |
Type Right margin in pixels. |
|
marginTop # |
Type Top margin in pixels. |
|
maxHeight # |
Type Maximum allowed height in pixels. |
|
maxWidth # |
Type Maximum allowed width in pixels. |
|
minHeight # |
Type Minimum allowed height in pixels. |
|
minWidth # |
Type Minimum allowed width in pixels. |
|
numberFormatter # |
Type An instance of Click here for more info |
|
opacity # |
Type Opacity. 0 - fully transparent; 1 - fully opaque. |
|
position # |
Type Positioning of the element. |
|
rotation # |
Type Rotation in degrees. |
|
scale # |
Type Scale. Setting to a value less than 1 will shrink object. |
|
showTooltipOn # |
Type Default Defines when tooltip is shown over the element. Available options:
Click here for more info |
|
stateAnimationDuration # |
Type Inherited from Duration of transition from one state to another. |
|
stateAnimationEasing # |
Type Inherited from Easing of transition from one state to another. |
|
templateField # |
Type Allows binding element's settings to data. Click here for more info |
|
themeTags # |
Type Inherited from Tags which can be used by the theme rules. Click here for more info |
|
themeTagsSelf # |
Type Inherited from Tags which can be used by the theme rules. These tags only apply to this object, not any children. Click here for more info |
|
themes # |
Type Inherited from A list of themes applied to the element. |
|
toggleKey # |
Type If set, element will toggle specified boolean setting between |
|
tooltip # |
Type
|
|
tooltipPosition # |
Type Tooltip position. |
|
tooltipText # |
Type Text to show in a tooltip when hovered. |
|
tooltipX # |
Type Tooltip pointer X coordinate relative to the element itself. |
|
tooltipY # |
Type Tooltip pointer Y coordinate relative to the element itself. |
|
userData # |
Type Inherited from A storage for any custom user data that needs to be associated with the element. |
|
visible # |
Type Is element visible? |
|
wheelable # |
Type If set to |
|
width # |
Type Element's absolute width in pixels (numeric value) or relative width to parent ( |
|
x # |
Type X position relative to parent. |
|
y # |
Type Y position relative to parent. |
| There are 7 inherited items currently hidden from this list. | |
Private settings
These are read-only settings accessible from a Sprite object using its getPrivate() method.
Read about private settings.
|
showingTooltip # |
Read only
Type Is element currently showing a tooltip? |
|---|---|
|
tooltipTarget # |
Read only
Type An element tooltip should inherit its colors from. |
Properties
|
adapters # |
Type Default Inherited from |
|---|---|
|
className # |
Static
Type Default |
|
classNames # |
Static
Type Default |
|
dataItem # |
Type A NOTE: data item is being assigned automatically in most cases where it matters. Use this accessor to set data item only if you know what you're doing. |
|
events # |
|
|
parent # |
Type Parent |
|
root # |
Type Inherited from An instance of @readonly |
|
states # |
Type Default Inherited from |
|
template # |
Type Inherited from @todo needs description |
|
uid # |
Type Default Inherited from Unique ID. |
| There are 5 inherited items currently hidden from this list. | |
Methods
|
animate( options: ) |
Returns Inherited from Animates setting values from current/start values to new ones. Click here for more info |
|---|---|
|
appear( duration?: ) |
Returns Plays initial reveal animation regardless if element is currently hidden or visible. |
|
depth() |
Returns Returns depth (how deep in the hierachy of the content tree) of this element. |
|
dispose() |
Returns Inherited from Disposes this object. |
|
get( key: ) |
Returns Inherited from Returns settings value for the specified If there is no value, Click here for more info |
|
getDateFormatter() |
Returns Returns an instance of If this element does not have it set, global one form Click here for more info |
|
getDurationFormatter() |
Returns Returns an instance of If this element does not have it set, global one form Click here for more info |
|
getNumberFormatter() |
Returns Returns an instance of If this element does not have it set, global one form Click here for more info |
|
getTooltip() |
Returns Returns |
|
height() |
Returns Returns height of this element in pixels. |
|
hide( duration?: ) |
Returns Hides the element and returns a series.hide().then(function(ev) {
console.log("Series finished hiding");
})
series.hide().then(function(ev) {
console.log("Series finished hiding");
})
|
|
hideTooltip() |
Returns Hides element's |
|
hover() |
Returns Simulate hover over element. |
|
isDisposed() |
Returns Inherited from Returns |
|
isDragging() |
Returns Returns |
|
isFocus() |
Returns Returns |
|
isHidden() |
Returns Returns |
|
isHiding() |
Returns Returns |
|
isHover() |
Returns Returns |
|
isShowing() |
Returns Returns |
|
isType( type: ) |
Returns Inherited from Checks if element is of certain class (or inherits one). |
|
maxHeight() |
Returns Returns maximum allowed height of this element in pixels. |
|
maxWidth() |
Returns Returns maximum allowed width of this element in pixels. |
|
new( root: ) |
Static Returns Inherited from Use this method to create an instance of this class. Click here for more info |
|
on( key: ) |
Returns Inherited from Sets a callback function to invoke when specific key of settings changes or is set. Click here for more info |
|
remove( key: ) |
Returns Inherited from Removes a setting value for the specified Click here for more info |
|
removeAll() |
Returns Inherited from Removes all keys; Click here for more info |
|
set( key: ) |
Returns Inherited from Sets a setting Click here for more info |
|
setAll( settings: ) |
Returns Inherited from Sets multiple settings at once. Click here for more info |
|
setTimeout( fn: () => ) |
Returns Inherited from Creates and returns a "disposable" timeout. |
|
show( duration?: ) |
Returns Shows currently hidden element and returns a series.show().then(function(ev) {
console.log("Series is now fully visible");
})
series.show().then(function(ev) {
console.log("Series is now fully visible");
})
|
|
showTooltip( point?: ) |
Returns Shows element's |
|
toBack() |
Returns Moves sprite to the beginning of the parent's children array. Depending on |
|
toFront() |
Returns Moves sprite to the end of the parent's children array. Depending on |
|
toGlobal( point: ) |
Returns Converts X/Y coordinate within this element to a global coordinate. |
|
toLocal( point: ) |
Returns Converts global X/Y coordinate to a coordinate within this element. |
|
unhover() |
Returns Simulate unhover over element. |
|
width() |
Returns Returns width of this element in pixels. |
|
x() |
Returns Returns element's actual X position in pixels. |
|
y() |
Returns Returns element's actual Y position in pixels. |
| There are 12 inherited items currently hidden from this list. | |
Events
Add event handlers to Sprite object using its events.on() method.
Read about adding event handlers.
| #blur |
Param { originalEvent: Invoked when element loses focus. |
|---|---|
| #boundschanged |
Param { type: Invoked when element's bounds change due to any manipulation to it. |
| #click |
Param { type: Invoked when element is clicked or tapped. |
| #dataitemchanged |
Param { newDataItem: Invoked when element's data item changes. |
| #dblclick |
Param { type: Invoked when element is doubleclicked or tapped twice quickly. |
| #dragged |
Param { type: Invoked when element ois being dragged. |
| #dragstart |
Param { type: Invoked when element dragging starts. |
| #dragstop |
Param { type: Invoked when element dragging stops. |
| #focus |
Param { originalEvent: Invoked when element gains focus. |
| #globalpointermove |
Param { type: Invoked when pointer is moving anywhere in the window, even outside of the element or even chart area. |
| #globalpointerup |
Param { type: Invoked when pointer button is released or touch stops in the window, even outside of the element or even chart area. |
| #middleclick |
Param { type: Invoked when element is clicked with the middle mouse button. |
| #pointerdown |
Param { type: Invoked when pointer button is pressed or touch starts over the element. |
| #pointerout |
Param { type: Invoked when pointer moves outside the element. |
| #pointerover |
Param { type: Invoked when pointer moves over the element. |
| #pointerup |
Param { type: Invoked when pointer button is released or touch stops over the element. |
| #positionchanged |
Param { type: Invoked when element's position (X/Y) changes. |
| #rightclick |
Param { type: Invoked when element is clicked width the right mouse button. |
| #wheel |
Param { originalEvent: Invoked when mouse wheel is spinned while pointer is over the element. |