DictionaryTemplate

Type class

A version of a Dictionary that has a "template".

A template is an instance of an object, that can be used to create new elements in the list without actually needing to create instances for those.

When new element is created in the list, e.g. by calling its create() method, an exact copy of the element is created (including properties and other attributes), inserted into the list and returned.

Sources

DictionaryTemplate can be used (imported) via one of the following packages.

// DictionaryTemplate is available in all of the following modules.
// You only need to import one of them.

/**
 * --------------------------------------------------------
 * Import from: "core.ts"
 * Use like: am4core.DictionaryTemplate
 * --------------------------------------------------------
 */
import * as am4core from "@amcharts/amcharts4/core";

// DictionaryTemplate is available in all of the following modules.
// You only need to import one of them.

/**
 * --------------------------------------------------------
 * Include via: <script src="core.js"></script>
 * Access items like: am4core.DictionaryTemplate
 * --------------------------------------------------------
 */

Inheritance

DictionaryTemplate extends Dictionary.

DictionaryTemplate is not extended by any other symbol.

Properties

events
#

Type EventDispatcher < AMEvent < Dictionary < Key, T > , IDictionaryEvents < Key, T > > >

Default new EventDispatcher()

Inherited from Dictionary

Event dispatcher.

template
#

Type T

A "template" object to copy all properties from when creating new list items.

There is 1 inherited item currently hidden from this list.

Methods

constructor(

t: T

)

#

Returns DictionaryTemplate

Constructor

clear()

#

Returns void

Inherited from Dictionary

Removes all items from the dictionary.

copyFrom(

source: this

)

#

Returns void

Copies all elements from other dictionary.

create(

key: Key

)

#

Returns T

Instantiates a new object of the specified type, adds it to specified key in the dictionary, and returns it.

each(

f: ( key: Key, value: T) => void

)

#

Returns void

Inherited from Dictionary

Calls f for each key/value in the dictionary.

getKey(

key: Key

)

#

Returns Optional < T >

Inherited from Dictionary

Returns the value for a specific key.

hasKey(

key: Key

)

#

Returns boolean

Inherited from Dictionary

Returns true if key exists in Dictionary.

insertKey(

key: Key,
value: T

)

#

Returns void

Inherited from Dictionary

Inserts value at specific key.

Will thrown an exception if the key already exists in the dictionary.

iterator()

#

Returns $iter.Iterator < ... >

Inherited from Dictionary

Returns an interator that can be used to iterate through all items in the dictionary.

removeKey(

key: Key

)

#

Returns void

Inherited from Dictionary

Removes value at specific key from dictionary.

setKey(

key: Key,
value: T

)

#

Returns void

Inherited from Dictionary

Adds 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.

There are 8 inherited items currently hidden from this list.

Events

#cleared

Param { type: "cleared",
  target: Dictionary }

Invoked when dictionary is cleared.

#insertKey

Param { type: "insertKey",
  target: Dictionary }

Invoked when insertKey() method is called.

#removeKey

Param { type: "removeKey",
  target: Dictionary }

Invoked when removeKey() method is called.

#removed

Param { type: "removed",
  target: Dictionary }

Invoked when an item is removed from the dictionary.

#setKey

Param { type: "setKey",
  target: Dictionary }

Invoked when setKey() method is called.

Adapters

DictionaryTemplate does not have any adapters.