ListData
Type class
A List that holds a component's data.
More info: Data
Sources
ListData can be used (imported) via one of the following packages.
// Import ListDataimport * as am5 from "@amcharts/amcharts5";
// Create ListDataam5.ListData.new(root, { // ... config if applicable});<!-- Load ListData --><script src="index.js"></script>
<script>// Create ListDataam5.ListData.new(root, { // ... config if applicable});</script>Inheritance
ListData extends List.
ListData is not extended by any other symbol.
Properties
processorType
DataProcessorA
DataProcessorthat processes each data item as it is added or replaced.More info: Data: pre processing data
3 inherited items
eventsType
EventDispatcherDefaultnew EventDispatcher()Inherited fromListlengthType
numberInherited fromListNumber of items in list.
valuesAn array of values in the list.
Don't change this array directly: use methods like
push()andremoveIndex(), which dispatch the list's events.
Methods
21 inherited items
[Symbol.iterator]()Returns
IteratorInherited fromListReturns an ES6 iterator for the list.
clear()Returns
voidInherited fromListRemoves all items from the list.
contains(value:T)Returns
booleanInherited fromListChecks if list contains specific item reference.
copyFrom(source:this)Returns
voidInherited fromListAdds all items of another list to the end of this one.
each(f: (value:T, index:number) =>void)Returns
voidInherited fromListCalls
ffor each item in the list, with the item and its index.eachReverse(f: (value:T, index:number) =>void)Returns
voidInherited fromListCalls
ffor each item in the list, from last to first, with the item and its index.getIndex(index:number)Returns
T|undefinedInherited fromListReturns an item at specified index.
hasIndex(index:number)Returns
booleanInherited fromListChecks if there's a value at specific index.
indexOf(value:T)Returns
numberInherited fromListSearches the list for specific item and returns its index.
insertIndex(index:number,
value:K)Returns
KInherited fromListInserts an item at
index, moving the items from there on one place further.moveValue(value:K,
toIndex?:undefined|number)Returns
KInherited fromListMoves an item to
toIndex, or to the end of the list iftoIndexis not set. An item that is not in the list yet is added.pop()Returns
OptionalInherited fromListReturns the last item from the list, and removes it.
push(value:K)Returns
KInherited fromListAdds an item to the end of the list.
pushAll(values:Array)Returns
voidInherited fromListAdds multiple items to the end of the list.
removeIndex(index:number)Returns
TInherited fromListRemoves a value at specific index.
removeValue(value:T)Returns
voidInherited fromListRemoves all copies of an item from the list.
setAll(newArray:Array)Returns
voidInherited fromListReplaces all items in the list with
newArray.setIndex(index:number,
value:T)Returns
TInherited fromListReplaces the value at
index, which must already exist.shift()Returns
OptionalInherited fromListReturns the first item from the list, and removes it.
swap(a:number,
b:number)Returns
voidInherited fromListSwaps two items in the list.
unshift(value:K)Returns
KInherited fromListAdds an item as a first item in the list.
Events
Add event handlers to ListData object using its events.on() method. Read about adding event handlers.
7 inherited items
clearParam { type:
"clear", target:ListData, oldValues:Array}Inherited fromListAll items were removed, by
clear()orsetAll().insertIndexParam { type:
"insertIndex", target:ListData, index:number, newValue:A}Inherited fromListAn item was inserted at
index.moveIndexParam { type:
"moveIndex", target:ListData, newIndex:number, oldIndex:number, value:A}Inherited fromListAn item was moved from
oldIndextonewIndex.pushParam { type:
"push", target:ListData, newValue:A}Inherited fromListAn item was added to the end of the list.
removeIndexParam { type:
"removeIndex", target:ListData, index:number, oldValue:A}Inherited fromListThe item at
indexwas removed.setIndexParam { type:
"setIndex", target:ListData, index:number, newValue:A, oldValue:A}Inherited fromListThe item at
indexwas replaced.swapParam { type:
"swap", target:ListData, a:A, b:A}Inherited fromListTwo items swapped places.