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
| Parameter | Type | Description |
|---|---|---|
containerNode | HTMLElement | The HTML element that will contain the legend. |
config? | TypeColorLegendConfigInterface | Optional 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()
staticextractConfig(config,defaultConfig):DisplayStateConfigInterface
Parameters
| Parameter | Type |
|---|---|
config | DisplayStateConfigInterface |
defaultConfig | DisplayStateConfigInterface |
Returns
Inherited from
DisplayStateManager.extractConfig
showState()
showState(
text?):void
Shows the DisplayState element with the specified text
Parameters
| Parameter | Type | Description |
|---|---|---|
text? | string | Optional text to display, defaults to noDataMessage |
Returns
void
Inherited from
hideState()
hideState():
void
Hides the DisplayState element
Returns
void
Inherited from
setDisplayStateConfig()
setDisplayStateConfig(
config):void
Updates the DisplayState configuration
Parameters
| Parameter | Type |
|---|---|
config | DisplayStateConfigInterface |
Returns
void
Inherited from
DisplayStateManager.setDisplayStateConfig
setConfig()
setConfig(
config?):void
Sets the configuration for the TypeColorLegend instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
config? | TypeColorLegendConfigInterface | Optional 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
| Parameter | Type | Description |
|---|---|---|
item? | TypeColorLegendItem | The 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
setLoadingState()
setLoadingState():
void
Sets the text content of the fallback div to āData loadingā¦ā to indicate that data is currently being loaded.
Returns
void