Type class
A List class is used to hold a number of indexed items of the same type.
Sources
List can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.List * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.List * -------------------------------------------------------- */
Inheritance
List does not extend any other symbol.
List is extended by ListTemplate
.
Properties
events # |
Type Default Event dispatcher. |
---|---|
length # |
Type Number of items in list. @readonly |
values # |
Type An array of values in the list. Do not use this property to add values. Rather use dedicated methods, like @readonly |
Methods
[Symbol.iterator]() |
Returns Returns an ES6 iterator for the list. |
---|---|
clear() |
Returns Removes all items from the list. |
constructor( initial: ) |
Returns Constructor |
contains( value: ) |
Returns Checks if list contains specific item reference. |
copyFrom( source: ) |
Returns Copies and adds items from abother list. |
each( f: ( value: ) |
Returns Calls |
getIndex( index: ) |
Returns Returns an item at specified index. |
hasIndex( index: ) |
Returns Checks if there's a value at specific index. |
indexOf( value: ) |
Returns Searches the list for specific item and returns its index. |
insertIndex( index: ) |
Returns Adds an item to the list at a specific index, which pushes all the other items further down the list. |
iterator() |
Returns Returns a list iterator. |
moveValue( value: ) |
Returns Moves an item to a specific index within the list. If the index is not specified it will move the item to the end of the list. |
pop() |
Returns Returns the last item from the list, and removes it. |
push( value: ) |
Returns Adds an item to the end of the list. |
pushAll( values: ) |
Returns Adds multiple items to the list. |
removeIndex( index: ) |
Returns Removes a value at specific index. |
removeValue( value: ) |
Returns Removes specific item from the list. |
setAll( newArray: ) |
Returns Sets multiple items to the list. All current items are removed. |
setIndex( index: ) |
Returns Sets value at specific index. If there's already a value at the index, it is overwritten. |
shift() |
Returns Returns the first item from the list, and removes it. |
sort( order: ( left: ) |
Returns Reorders list items according to specific ordering function. |
swap( a: ) |
Returns Swaps indexes of two items in the list. |
unshift( value: ) |
Returns Adds an item as a first item in the list. |
Events
#insertIndex |
Param { index: Invoked when |
---|---|
#inserted |
Param { newValue: Invoked when item is added to the list. @todo remove this later? |
#removeIndex |
Param { index: Invoked when item is removed. |
#removed |
Param { oldValue: Invoked when item is removed from the list. @todo remove this later? |
#setAll |
Param { newArray: Invoked when |
#setIndex |
Param { index: Invoked when |
Adapters
List does not have any adapters.