JavaScript & React libraryAPI Generated Docs

Class: TypeColorLegend

Represents a TypeColorLegend component that displays a legend for color types. The legend can be configured with various options, such as the list of items to display, the maximum number of items to display, and event handlers for item clicks and hovers. The legend can be expanded or collapsed to show more or fewer items.

Extends

Constructors

Constructor

new TypeColorLegend(containerNode, config?): TypeColorLegend

Constructs a new TypeColorLegend instance with the provided container node and optional configuration.

Parameters

ParameterTypeDescription
containerNodeHTMLElementThe HTML element that will contain the legend.
config?TypeColorLegendConfigInterfaceOptional configuration object for the legend.

Returns

TypeColorLegend

Overrides

DisplayStateManager.constructor

Accessors

config

Get Signature

get config(): TypeColorLegendConfigInterface

Gets the configuration object for the TypeColorLegend instance.

Returns

TypeColorLegendConfigInterface


legendItems

Get Signature

get legendItems(): HTMLElement

Gets the HTML element that contains the legend items.

Returns

HTMLElement


isExpanded

Get Signature

get isExpanded(): boolean

Gets the expanded state of the TypeColorLegend instance.

Returns

boolean

Methods

extractConfig()

static extractConfig(config, defaultConfig): DisplayStateConfigInterface

Parameters

ParameterType
configDisplayStateConfigInterface
defaultConfigDisplayStateConfigInterface

Returns

DisplayStateConfigInterface

Inherited from

DisplayStateManager.extractConfig


showState()

showState(text?): void

Shows the DisplayState element with the specified text

Parameters

ParameterTypeDescription
text?stringOptional text to display, defaults to noDataMessage

Returns

void

Inherited from

DisplayStateManager.showState


hideState()

hideState(): void

Hides the DisplayState element

Returns

void

Inherited from

DisplayStateManager.hideState


setDisplayStateConfig()

setDisplayStateConfig(config): void

Updates the DisplayState configuration

Parameters

ParameterType
configDisplayStateConfigInterface

Returns

void

Inherited from

DisplayStateManager.setDisplayStateConfig


setConfig()

setConfig(config?): void

Sets the configuration for the TypeColorLegend instance.

Parameters

ParameterTypeDescription
config?TypeColorLegendConfigInterfaceOptional configuration object for the legend. If not provided, the existing configuration will be used.

Returns

void


setSelectedItem()

setSelectedItem(item?): void

Sets the selected item in the TypeColorLegend instance.

Parameters

ParameterTypeDescription
item?TypeColorLegendItemThe TypeColorLegendItem to set as the selected item, or undefined to clear the selection.

Returns

void


resetList()

resetList(): void

Resets the scroll position of the legend container to the top and clears the selected item. This updates the visible items in the legend.

Returns

void


getConfig()

getConfig(): TypeColorLegendConfigInterface

Gets the configuration object for the TypeColorLegend instance.

Returns

TypeColorLegendConfigInterface

The configuration object for the TypeColorLegend instance.


show()

show(): void

Shows the legend container by removing the ā€˜disabled’ class and adding the ā€˜enabled’ class to the scroll container.

Returns

void


hide()

hide(): void

Hides the legend container by removing the ā€˜enabled’ class and adding the ā€˜disabled’ class to the scroll container.

Returns

void


destroy()

destroy(): void

Destroys the TypeColorLegend instance by removing the scroll event listener and clearing the container node’s HTML.

Returns

void

Overrides

DisplayStateManager.destroy


setLoadingState()

setLoadingState(): void

Sets the text content of the fallback div to ā€˜Data loading…’ to indicate that data is currently being loaded.

Returns

void

Overrides

DisplayStateManager.setLoadingState