Class: SizeLegend
The SizeLegend
class is responsible for rendering a size legend UI component. It provides methods to set the configuration, show/hide the legend, and handle user interactions.
The legend displays a visual representation of the size scale, with minimum and maximum size indicators. It also supports optional labels and event handlers for click and hover interactions.
The class takes a container node and an optional configuration object in the constructor. The configuration can be updated at any time using the setConfig
method.
Extends
Constructors
Constructor
new SizeLegend(
containerNode
,config?
):SizeLegend
Constructs a new SizeLegend
instance with the provided container node and optional configuration.
Parameters
Parameter | Type | Description |
---|---|---|
containerNode | HTMLElement | The HTML element that will contain the size legend. |
config? | SizeLegendConfigInterface | An optional configuration object that will be used to initialize the size legend. |
Returns
SizeLegend
Overrides
DisplayStateManager
.constructor
Accessors
sizeElements
Get Signature
get sizeElements():
null
| {min
:HTMLElement
;max
:HTMLElement
; }
Gets the min and max size elements used in the size legend.
Returns
null
| { min
: HTMLElement
; max
: HTMLElement
; }
The min and max size elements, or null if they have not been created yet.
config
Get Signature
get config():
SizeLegendConfigInterface
Gets the current configuration for the size legend.
Returns
The size legend configuration.
isHidden
Get Signature
get isHidden():
boolean
Gets whether the size legend is currently hidden.
Returns
boolean
true
if the size legend is hidden, false
otherwise.
Methods
extractConfig()
static
extractConfig(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
hide()
hide():
void
Hides the size legend by removing the āenabledā class and adding the ādisabledā class to the legend element.
Returns
void
show()
show():
void
Shows the size legend by removing the ādisabledā class and adding the āenabledā class to the legend element.
Returns
void
setConfig()
setConfig(
config?
):void
Sets the configuration for the size legend.
Parameters
Parameter | Type | Description |
---|---|---|
config? | SizeLegendConfigInterface | An optional configuration object that will be used to update the size legend. |
Returns
void
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
destroy()
destroy():
void
Destroys the size legend by removing event listeners and removing the legend and fallback message elements from the container node.
Returns
void