Type class
Base class of all visual elements.
Sources
Sprite can be used (imported) via one of the following packages.
// Import Sprite
import * as am5 from "@amcharts/amcharts5";
// Create Sprite
am5.Sprite.new(root, {
// ... config if applicable
});
<!-- Load Sprite -->
<script src="index.js"></script>
<script>
// Create Sprite
am5.Sprite.new(root, {
// ... config if applicable
});
</script>
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. |
|---|---|
|
ariaChecked # |
Type
This setting is ignored unless
|
|
ariaControls # |
Type
|
|
ariaCurrent # |
Type
Click here for more info |
|
ariaHidden # |
Type
|
|
ariaLabel # |
Type Label for the element to use for screen readers. Click here for more info |
|
ariaLive # |
Type
|
|
ariaOrientation # |
Type
|
|
ariaSelected # |
Type
Click here for more info |
|
ariaValueMax # |
Type
|
|
ariaValueMin # |
Type
|
|
ariaValueNow # |
Type
|
|
ariaValueText # |
Type
|
|
blur # |
Type Apply blur filter. Ranges of values in pixels: IMPORTANT: This setting is not supported in Safari browsers. Click here for more info |
|
brightness # |
Type Modifty visual brightness. Range of values: IMPORTANT: This setting is not supported in Safari browsers. Click here for more info |
|
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. |
|
clickAnnounceText # |
Type If set, the text will be read out (announced) by a screen reader when focused element is "clicked" (by pressing ENTER or SPACE). @since 5.10.8 |
|
contrast # |
Type Modify contrast. Range of values: IMPORTANT: This setting is not supported in Safari browsers. Click here for more info |
|
crisp # |
Type Default If set to It will round x/y position so it is positioned fine "on pixel". It will also adjust NOTE: this is might not universally work, especially when set on several objects that are supposed to fit perfectly with each other. @since 5.3.0 |
|
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 |
|
focusable # |
Type Can element be focused, i.e. selected using TAB key. Click here for more info |
|
focusableGroup # |
Type An identifier by which to group common elements into focusable groups. If set, only the first element in he group will be focusable via TAB key. When it is selected, the rest of the elements in the same group can be selected using arrow keys. It allows users to TAB-through chart elements quickly without the need to TAB into each and every element. It's up to implementer of the charts to provide meaningful Click here for more info |
|
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 ( |
|
hoverOnFocus # |
Type Simulate hover on an element when it gains focus, including changing hover appearance and displaying a tooltip if application. Click here for more info |
|
hue # |
Type Rotate HUE colors in degrees. Range of values: IMPORTANT: This setting is not supported in Safari browsers. Click here for more info |
|
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. |
|
ignoreThemes # |
Type Default Inherited from If set to @since 5.15.6 |
|
interactive # |
Type Should this element accept user interaction events? |
|
invert # |
Type Invert colors. Range of values: IMPORTANT: This setting is not supported in Safari browsers. Click here for more info |
|
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. |
|
layerMargin # |
Type Margins for the layer. Can be used to make the layer larger/or smaller than default chart size. @since @5.2.39 |
|
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. |
|
role # |
Type Element's role. Click here for more info |
|
rotation # |
Type Rotation in degrees. |
|
saturate # |
Type Modify saturation. Range of values in pixels:
Click here for more info |
|
scale # |
Type Scale. Setting to a value less than 1 will shrink object. |
|
sepia # |
Type Apply sepia filter. Range of values: IMPORTANT: This setting is not supported in Safari browsers. Click here for more info |
|
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. |
|
tabindexOrder # |
Type An internal order by which focusable elements will be selected within the chart. Click here for more info |
|
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
|
|
tooltipHTML # |
Type HTML content to show in a tooltip when hovered. @since 5.2.11 |
|
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 8 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.
|
focusable # |
Read only
Type If set to @since 5.3.16 |
|---|---|
|
lastTooltipCoords # |
Read only
Type The last point the tooltip was shown at, so it is not shown again at the same place. @since 5.11.3 |
|
showingTooltip # |
Read only
Type
|
|
tooltipTarget # |
Read only
Type An element whose tooltip point and colors the tooltip uses, in place of this element's. |
|
trustBounds # |
Read only
Type Checks that the pointer is within the element's bounds before dispatching It is @since 5.5.0 |
Properties
|
adapters # |
Type Default Inherited from |
|---|---|
|
className # |
Static
Type Default |
|
classNames # |
Static
Type Default |
|
dataItem # |
Type The element's NOTE: data items are assigned automatically in most cases where it matters. Set one only if you know what you are doing. |
|
enableDispose # |
Type Default Inherited from Set to |
|
events # |
|
|
parent # |
Type Parent |
|
root # |
Type Inherited from The @readonly |
|
states # |
Type Default Inherited from |
|
template # |
Type Inherited from A |
|
uid # |
Type Default Inherited from A unique number, given to each object as it is created. |
|
virtualParent # |
Type |
| There are 6 inherited items currently hidden from this list. | |
Methods
|
animate( options: ) |
Returns Inherited from Animates a setting from its current value (or Click here for more info |
|---|---|
|
appear( duration?: ) |
Returns Plays the reveal animation: hides the element at once, then shows it, whether it was hidden or not. |
|
compositeOpacity() |
Returns Returns the element's opacity multiplied by those of all its parents. @since 5.2.11 |
|
compositeRotation() |
Returns Returns the element's rotation plus those of all its parents, in degrees. @since 5.9.2 |
|
compositeScale() |
Returns Returns the element's scale multiplied by those of all its parents. @since 5.9.2 |
|
depth() |
Returns Returns how deep the element is in the tree: the number of parents it has. |
|
dispose() |
Returns Inherited from Disposes the object, freeing everything it holds. A disposed object can't be used again. |
|
get( key: ) |
Returns Inherited from Returns the value of setting Click here for more info |
|
getDateFormatter() |
Returns Returns the Click here for more info |
|
getDurationFormatter() |
Returns Returns the Click here for more info |
|
getNumberFormatter() |
Returns Returns the Click here for more info |
|
getTooltip() |
Returns Returns the element's |
|
has( key: ) |
Returns Inherited from Returns Click here for more info |
|
height() |
Returns Returns the element's height 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 the element's |
|
hover() |
Returns Hovers the element as if the pointer were over it: applies its hover state and shows its tooltip. |
|
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 Returns |
|
isVisible() |
Returns Returns |
|
isVisibleDeep() |
Returns Same as @since 5.2.7 |
|
markDirtyKey( key: ) |
Returns Marks a setting as changed, so the element reads it again, running its adapters, on the next frame. |
|
maxHeight() |
Returns Returns the most height the element may take, in pixels: its |
|
maxWidth() |
Returns Returns the most width the element may take, in pixels: its |
|
new( root: ) |
Static Returns Inherited from Creates an instance of the class. Use it instead of Click here for more info |
|
off( key: ) |
Returns Inherited from Removes a callback added with Click here for more info |
|
offDebounced( key: ) |
Returns Inherited from Removes a callback added with Click here for more info |
|
offDebouncedPrivate( key: ) |
Returns Inherited from Removes a callback added with Click here for more info |
|
offPrivate( key: ) |
Returns Inherited from Removes a callback added with Click here for more info |
|
on( key: ) |
Returns Inherited from Calls Click here for more info |
|
onDebounced( key: ) |
Returns Inherited from Like Click here for more info |
|
onPrivate( key: ) |
Returns Inherited from Calls Click here for more info |
|
onPrivateDebounced( key: ) |
Returns Inherited from Like Click here for more info |
|
once( key: ) |
Returns Inherited from Like Click here for more info |
|
onceDebounced( key: ) |
Returns Inherited from Like Click here for more info |
|
remove( key: ) |
Returns Inherited from Removes the value set for setting Click here for more info |
|
removeAll() |
Returns Inherited from Removes all settings, as Click here for more info |
|
set( key: ) |
Returns Inherited from Sets setting Click here for more info |
|
setAll( settings: ) |
Returns Inherited from Sets several settings at once, from an object of key-value pairs. Click here for more info |
|
setTimeout( fn: () => ) |
Returns Inherited from Calls |
|
show( duration?: ) |
Returns Shows the 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 the element's |
|
toBack() |
Returns Moves the element to the start of its parent's children, so it is drawn under its siblings, or, in a layout, placed first. |
|
toFront() |
Returns Moves the element to the end of its parent's children, so it is drawn over its siblings, or, in a layout, placed last. |
|
toGlobal( point: ) |
Returns Converts a point within the element to a point relative to the root. |
|
toLocal( point: ) |
Returns Converts a point relative to the root to a point within the element. |
|
unhover() |
Returns Ends a hover, as if the pointer left the element: hides its tooltip and takes it out of its hover state. |
|
width() |
Returns Returns the element's width in pixels. |
|
x() |
Returns Returns the element's X position in pixels, relative to its parent, without |
|
y() |
Returns Returns the element's Y position in pixels, relative to its parent, without |
| There are 22 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: The element's bounds changed. |
| #click |
Param { type: The element was clicked or tapped. A press and release more than 5 pixels apart is not a click. |
| #dataitemchanged |
Param { newDataItem: The element's data item changed. |
| #dblclick |
Param { type: The element was double-clicked or double-tapped. Also dispatched on its parents. |
| #dragged |
Param { type: The element moved while being dragged. |
| #dragstart |
Param { type: Dragging of the element started: the pointer moved more than 5 pixels after pressing on it. |
| #dragstop |
Param { type: Dragging of the element stopped. |
| #focus |
Param { originalEvent: Invoked when element gains focus. |
| #globalpointerdown |
Param { type: A pointer button was pressed, or a touch started, anywhere in the window, even outside the chart. |
| #globalpointermove |
Param { type: The pointer moved anywhere in the window, even outside the chart. |
| #globalpointerup |
Param { type: A pointer button was released, or a touch ended, anywhere in the window, even outside the chart. |
| #middleclick |
Param { type: The element was clicked with the middle mouse button. |
| #pointerdown |
Param { type: A pointer button was pressed, or a touch started, over the element. Also dispatched on its parents. |
| #pointerout |
Param { type: The pointer left the element. |
| #pointerover |
Param { type: The pointer moved over the element. |
| #pointerup |
Param { type: A pointer button was released, or a touch ended, over the element. |
| #positionchanged |
Param { type: The element's position changed. |
| #rightclick |
Param { type: The element was clicked with the right mouse button. |
| #wheel |
Param { originalEvent: The mouse wheel turned while the pointer was over the element. Also dispatched on its parents. |