Getting started with React Chart

To create a new Vite project, refer to the Vite documentation. Once that Vite project is ready to run with default settings, let’s add the React Chart component to the project.

Prerequisites

  • Node.js 20 or later.
  • The application is compatible with macOS, Windows, and Linux operating systems.

Installing Syncfusion® React packages

To use the chart component, install the @syncfusion/react-charts package:

Adding Chart component

To include the Chart component in your application, import the Chart from @syncfusion/react-charts package in App.tsx.

Add the Chart component in application as shown in below code example.

Chart title

Use the text property of the ChartTitle component to display a chart title that provides users with a quick understanding of the data being visualized.

Marker

Data markers are used to provide information about the data points in a series. You can add a shape to visually enhance each data point. To display markers on the chart, set the visible property to true in the ChartMarker component.

DataLabel

Data labels in a chart provide additional information about individual data points in the series. To enable labels for the data points, set the visible property to true in the ChartDataLabel component.

Tooltip

The chart displays details about data points through tooltips when the mouse hovers over them. You can enable this feature by setting the enable property to true in the ChartTooltip component.

Run the project

To run the project, use the following command:

After run the project, we have to show the chart.

Loading...