Search results

Legend API in React Chart API component

Legend module is used to render legend for the chart.

Methods

LegendClick

Handles the click event for a legend item.

Parameter Type Description
index number The index of the clicked legend item.
event Event | PointerEvent The click event.

Returns void

click

Handles the click event for showing tooltip on trimmed text in legend.

Parameter Type Description
event Event | PointerEvent The click event.

Returns void

getLegendBounds

Calculates the legend bounds based on the available size and legend settings.

Parameter Type Description
availableSize Size The available size for the legend.
legendBounds Rect The current bounds of the legend.
legend LegendSettingsModel The legend settings.

Returns void

getLegendHeight

Calculates the height of the legend based on the legend options, settings, and available space.

Parameter Type Description
legendOption LegendOptions The legend options.
legend LegendSettingsModel The legend settings.
legendBounds Rect The current bounds of the legend.
rowWidth number The width of the legend rows.
legendHeight number The current height of the legend.
padding number The padding around the legend items.

Returns void

getLegendOptions

Retrieves the legend options based on the visible series collection and chart.

Parameter Type Description
visibleSeriesCollection Series[] The collection of visible series.
chart Chart The chart instance.

Returns void

getRenderPoint

Calculates the rendering point for the legend item based on various parameters.

Parameter Type Description
legendOption LegendOptions The legend options.
start ChartLocation The starting location for the legend.
textPadding number The padding around the legend text.
previousLegend LegendOptions The options of the previous legend item.
rect Rect The bounding rectangle for the legend.
count number The count of legend items.
firstLegend number The index of the first legend item.

Returns void