Selection

18 Nov 202517 minutes to read

The Selection module handles the selection of chart elements.

Methods

addOrRemoveIndex

Adds or removes an index from the provided array of indexes.

Returns void

applyStyles

Applies styles to the specified elements.

Parameter Type Description
elements Element[] The elements to which styles will be applied.

Returns void

blurEffect

Applies a blur effect to a specific chart or legend.

Parameter Type Description
chartId string The ID of the chart or legend.
visibleSeries Series[] The collection of visible series in the chart.
isLegend boolean Indicates whether the blur effect should be applied to a legend. Defaults to false.
index number The index of the series or legend item to which the blur effect should be applied. Defaults to 0.

Returns void

calculateDragSelectedElements

Calculates the elements selected by dragging a rectangle on the chart.

Parameter Type Description
chart Chart The chart instance.
dragRect Rect The rectangle representing the selection area.
isClose (optional) boolean Flag indicating whether the selection should be close.

Returns void

calculateSelectedElements

Calculates the selected elements based on the target element and event type.

Parameter Type Description
targetElement HTMLElement The target element for which to calculate selected elements.
eventType string The type of event (e.g., ‘mouse move’, ‘touch move’).
pointClick (optional) boolean Selection of series points.

Returns void

checkSelectionElements

Checks and updates the selection state of elements based on the provided criteria.

Parameter Type Description
element Element The element to check for selection.
className string The class name used for selecting elements.
visibility boolean The visibility state of the element.
isLegend boolean Indicates whether the element is a legend. Defaults to true.
series number The index of the series associated with the element. Defaults to 0.
legendStrokeColor string The stroke color of the legend. Defaults to ‘#D3D3D3’.

Returns void

clusterSelection

Handles the selection logic for clustered data points in the chart.

Parameter Type Description
chart Chart The chart instance.
index Index The index of the selected clustered data point.

Returns void

completeSelection

Completes the selection process.

Parameter Type Description
target HTMLElement The target element where the selection is completed.
eventType string The type of event that triggered the selection completion.

Returns void

dragStart

Initiates the drag operation.

Parameter Type Description
chart Chart The chart instance where the drag operation is initiated.
seriesClipRect Rect The clipping rectangle of the series.
mouseDownX number The X-coordinate where the mouse was pressed down.
mouseDownY number The Y-coordinate where the mouse was pressed down.
event Event The event object associated with the mouse down event.

Returns void

draggedRectMoved

Updates the position of the dragged rectangle.

Returns void

drawDraggingRect

Draws the dragging rectangle on the chart.

Parameter Type Description
chart Chart The chart instance.
dragRect Rect The rectangle representing the dragging area.

Returns void

findElements

Finds the elements in the chart corresponding to the specified series and data point index.

Returns Element[]

findTrackballElements

Finds the elements within the selected elements that match the specified class name.

Parameter Type Description
selectedElements Element[] | NodeListOf The elements to search within.
className string The class name to search for.

Returns void

getClusterElements

Retrieves the DOM elements corresponding to the cluster of data points at the specified index.

Parameter Type Description
chart Chart The chart instance.
index Index The index object specifying the series and point indexes.

Returns Element[]

getElementByIndex

Retrieves the DOM elements corresponding to the specified data point index.

Returns Element[]

getSelectionClass

Gets the CSS class for selection based on the provided identifier.

Parameter Type Description
id string The identifier used to determine the selection class.

Returns string

getSeriesElements

Retrieves the SVG elements associated with a particular series in the chart.

Parameter Type Description
series SeriesModel The series for which to retrieve the SVG elements.

Returns Element[]

highlightChart

Highlights the specified chart element.

Parameter Type Description
target Element The target element to highlight.
eventType string The type of event triggering the highlighting.

Returns void

indexFinder

Finds the index associated with a particular element ID.

Parameter Type Description
id string The ID of the element to find the index for.

Returns Index

invokeSelection

Method to select the point and series.

Parameter Type Description
chart Chart The chart instance.

Returns void

isAlreadySelected

Checks if the target element is already selected for the specified event type.

Parameter Type Description
targetElem Element The target element to check.
eventType string The type of event (e.g., ‘mouse move’, ‘touch move’).

Returns boolean

legendSelection

Handles selection on legend item click.

Parameter Type Description
chart Chart The chart instance.
series number The index of the series.
targetElement Element The target element clicked.
eventType string The type of event triggered.

Returns void

mouseMove

Handles the mouse move event.

Parameter Type Description
event PointerEvent | TouchEvent The pointer event or touch event associated with the mouse move.

Returns void

pattern

To create the pattern for series/points.

Returns string

performSelection

Performs selection based on the provided index and chart.

Returns void

rangeColorMappingEnabled

Checks if range color mapping is enabled for the chart.

Returns boolean

redrawSelection

Redraws the selection or highlight on the chart.

Parameter Type Description
chart Chart The chart instance.
oldMode SelectionMode | HighlightMode The previous selection or highlight mode.
chartRedraw (optional) boolean Specifies whether to redraw the entire chart.

Returns void

removeMultiSelectElements

Removes the multi-selected elements from the chart.

Parameter Type Description
chart Chart The chart instance.
index Index[] The indices of the multi-selected elements to be removed.
currentIndex Index The index of the current selected element.
seriesCollection SeriesModel[] The collection of series in the chart.

Returns void

removeStyles

Removes styles from the provided elements.

Parameter Type Description
elements Element[] The elements from which styles will be removed.

Returns void

resizingSelectionRect

Updates the selection rectangle during resizing.

Returns void

selectDataIndex

Selects data points in the chart based on the provided indexes.

Parameter Type Description
chart Chart The chart instance.
indexes Index[] An array of Index objects specifying the series and point indexes to be selected.

Returns void

selection

Handles the selection logic for the chart.

Parameter Type Description
chart Chart The chart instance.
index Index The index of the selected data point.
selectedElements Element[] The elements representing the selected data point.

Returns void

selectionAndDrag

Handles the selection and dragging functionality for the chart.

Parameter Type Description
chart Chart The chart instance.
target Element The target element involved in the selection or dragging action.
eventType string The type of event triggering the selection or dragging action.

Returns void

selectionComplete

Completes the selection process based on the provided index and selection mode.

Parameter Type Description
chart Chart The chart instance.
index Index The index for which the selection is completed.
selectionMode SelectionMode | HighlightMode The selection mode.

Returns void

toEquals

Checks if two Index objects are equal.

Parameter Type Description
first Index The first Index object.
second Index The second Index object.
checkSeriesOnly boolean Specifies whether to check series properties only.

Returns boolean