React Chart Data Point Selection

Demonstrates how to Select Data Points on a chart using SciChart.js, High Performance JavaScript Charts

Selected Points

Series Name
X Value
Y Value

Fullscreen

Edit

 Edit

Docs

drawExample.ts

Copy to clipboard
Minimise
Fullscreen
1// Loading ... 

React Chart Data Point Selection

Overview

This example demonstrates a React implementation of a high performance SciChart.js chart that enables interactive data point selection. The chart renders multiple spline line series with customizable point markers and annotations. Users can select individual or multiple data points and see real-time updates reflected in a separate list rendered alongside the chart. For futher details please see the DataPoint Selection Documentation.

Technical Implementation

The chart is initialized using the <SciChartReact/> component, which is integrated into the React framework via an initChart callback. This callback, defined in the drawExample.ts file, sets up numeric axes, multiple SplineLineRenderableSeries, and customizes data point appearance using the DataPointSelectionPaletteProvider. To capture user interactions, the example adds a DataPointSelectionModifier to the chart that triggers a selectionChanged event. This event is then synchronized with React state using the useState hook, ensuring that selected points are displayed timely. Developers can learn more about integrating SciChart.js with React in the Creating a SciChart React Component from the Ground Up guide as well as the React Charts with SciChart.js: Introducing “SciChart React” article.

Features and Capabilities

The core features of this example include interactive data point selection, customized palette styling for selected data points (denoted by metadata.isSelected), and dynamic annotations providing immediate feedback. The use of advanced series components like SplineLineRenderableSeries and point marker customization through EPointMarkerType enhances the chart's visual interactivity. For additional technical insights, the React Chart Data Point Selection - SciChart.js Demo offers a live example, and the DataPointSelectionModifier Documentation provides detailed API guidance.

Integration and Best Practices

Efficient React integration is achieved through the use of hooks such as useState and useRef, ensuring responsive layouts and optimal state management. The example demonstrates how to synchronize chart events with React state updates, enabling seamless user interactions and real-time data displays. This approach aligns with best practices for creating high-performance, interactive charts in React, as discussed in the React Charts with SciChart.js: Introducing “SciChart React” article. Moreover, the example highlights how to effectively manage component responsiveness and event handling, ensuring the chart adapts cleanly to various display sizes.

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL.