Dictionary
Type class
A Dictionary is collection where values of some type can be mapped to string keys.
You might call it an "associative list" or "associative array".
Sources
Dictionary can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.Dictionary */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.Dictionary */Inheritance
Dictionary does not extend any other symbol.
Dictionary is extended by DictionaryTemplate.
Properties
eventsType
EventDispatcher<AMEvent<Dictionary<Key,T>,IDictionaryEvents<Key,T>>>Defaultnew EventDispatcher()Event dispatcher.
Methods
[Symbol.iterator]()Returns
Iterator<...>Returns an ES6 iterator for the keys/values of the dictionary.
clear()Returns
voidRemoves all items from the dictionary.
constructor()Returns
DictionaryConstructor
copyFrom(source:this)Returns
voidCopies items from another Dictionary.
each(f: (key:Key, value:T) =>void)Returns
voidCalls
ffor each key/value in the dictionary.getKey(key:Key)Returns
Optional<T>Returns the value for a specific key.
hasKey(key:Key)Returns
booleanReturns
trueif key exists in Dictionary.insertKey(key:Key,
value:T)Returns
voidInserts value at specific key.
Will thrown an exception if the key already exists in the dictionary.
iterator()Returns
Iterator<...>Returns an interator that can be used to iterate through all items in the dictionary.
removeKey(key:Key)Returns
voidRemoves value at specific
keyfrom dictionary.setKey(key:Key,
value:T)Returns
voidAdds or updates key/value into dictionary.
If the key already exists, the old value will be overwritten.
If the new value is exactly the same as the old value (using ===), it won't do anything.
Events
clearedParam { type:
"cleared", target:Dictionary}Invoked when dictionary is cleared.
insertKeyParam { type:
"insertKey", target:Dictionary, key:Key, newValue:Value}Invoked when
insertKey()method is called.removedParam { type:
"removed", target:Dictionary, oldValue:Value}Invoked when an item is removed from the dictionary.
removeKeyParam { type:
"removeKey", target:Dictionary, key:Key, oldValue:Value}Invoked when
removeKey()method is called.setKeyParam { type:
"setKey", target:Dictionary, key:Key, newValue:Value, oldValue:Value}Invoked when
setKey()method is called.