JavaScript & React libraryAPI

Interface: TypeColorLegendConfigInterface

Extends

Properties

noDataMessage?

optional noDataMessage: string | false

Text to display when there is no data. When set to false, this message will not be displayed.

Default

'No data'

Inherited from

DisplayStateConfigInterface.noDataMessage


loadingMessage?

optional loadingMessage: string | false

Text to display when data is loading. When set to false, this message will not be displayed.

Default

'Data loading...'

Inherited from

DisplayStateConfigInterface.loadingMessage


disableStateMessages?

optional disableStateMessages: boolean

Whether to disable all messages in the DisplayState element.

Default

false

Inherited from

DisplayStateConfigInterface.disableStateMessages


allowPointerEvents?

optional allowPointerEvents: boolean

Whether to allow pointer events on the DisplayState element when message is visible.

Default

false

Inherited from

DisplayStateConfigInterface.allowPointerEvents


hidden?

optional hidden: boolean

Whether to hide the legend. Default: false


label?

optional label: string

The label for the color legend.

Default

undefined

items?

optional items: TypeColorLegendItem[]

An array of color legend items, where each item has a color and a label. These items will be displayed in the legend, with each item showing its color and label.

Default

[]

alignRight?

optional alignRight: boolean

Whether to align the color legend items to the right. When true, the legend items will be right-aligned within their container.

Default

false

maxDisplayedItems?

optional maxDisplayedItems: number

The maximum number of color legend items to display. When exceeded, a “show more” button will appear to display additional items.

Default

15

labelFormatter()?

optional labelFormatter: (n) => string

The label formatter function to format the legend labels.

Parameters

ParameterTypeDescription
nstringThe label string to format

Returns

string

The formatted label string


enableEvents?

optional enableEvents: boolean

Whether to enable event handling for the color legend. When true, click and hover events will be active on legend items.

Default

true

expanded?

optional expanded: boolean

Whether the color legend list (if “show more” is active) is expanded or not.

Default

false

onClick()?

optional onClick: (e, item?) => void

Callback function that is called when a color legend item is clicked.

Parameters

ParameterTypeDescription
eEventThe click event object
item?TypeColorLegendItemThe color legend item that was clicked, or undefined if no item was clicked

Returns

void


onHover()?

optional onHover: (e, item?) => void

Callback function that is called when the mouse hovers over a color legend item.

Parameters

ParameterTypeDescription
eEventThe hover event object
item?TypeColorLegendItemThe color legend item that was hovered over, or undefined if no item is being hovered

Returns

void


onShowMoreClick()?

optional onShowMoreClick: (expanded) => void

Callback function that is called when the “show more” button is clicked.

Parameters

ParameterTypeDescription
expandedbooleanWhether the list is expanded or collapsed

Returns

void