Introduction
In this article, I will show you steps to create an area chart component in React js functional component using Apexcharts and Bootstrap libraries. Apexcharts is an open-source JavaScript-based charting library. It allows web developers to build attractive, visually appealing graphs and charts. This library was developed using a jQuery web development library, and it uses Scalable Vector Graphics to render charts UI. We can build single charts, line charts, bar charts, column charts, pie charts, donut charts, scatter charts, and heatmap charts using Apexcharts.
Apexcharts key features
- Customizable options available for each chart include colors, labels, tooltips, animations, and responsive design.
- Easy integration with front-end frameworks, including React, Angular, and Vue.
- Rich and high-level documentation and community support, including demos, examples, and tutorials.
Prerequisite
- Node.js (install it from >> https://nodejs.org/en)
- npm
- Code editor - VS Code
Step 1. Steps to Build React Project
Create path i.e. D:\EmployeeManagement\React\1
Navigate to the location where you want to download the React app and make sure to invoke the command below.
D:\EmployeeManagement\React\1\>npx create-react-app my-react-app
Enter in the project directory.
D:\EmployeeManagement\React\1> cd my-react-app
The React project structure is shown below.

Step 2. Install Apexcharts and bootstrap libraries
D:\EmployeeManagement\React\1\my-react-app> npm i react-apexcharts apexcharts bootstrap --legacy-peer-deps
Apexcharts library can be found in the project under the node_modules folder.

Step 3. Build React Functional Component
Create a new folder component under the src folder and then create the ApexAreaChart.js file.
Code in ApexAreaChart.js
import React from "react";
import Chart from "react-apexcharts";
const data = {
series: [
{
name: "Employees",
data: [10, 41, 35, 51, 49, 62, 69, 91, 148,230,320,340],
},
],
options: {
chart: {
height: 350,
type: "line",
zoom: {
enabled: false,
},
},
dataLabels: {
enabled: false,
},
stroke: {
curve: "straight",
},
title: {
text: "Employees Count by Month",
align: "left",
},
grid: {
row: {
colors: ["#f3f3f3", "transparent"],
opacity: 0.5,
},
},
xaxis: {
categories: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
},
},
};
function ApexAreaChart() {
return (
<>
<Chart
options={data.options}
series={data.series}
type="area"
height={350}
/>
</>
);
}
export default ApexAreaChart;
Code Description
Import the Chart from react-apexcharts package, it allows you to define the Chart component in functional class.
import Chart from "react-apexcharts";
Define data in a const variable, and this data will help us visualize the basic area chart in React in relation to the Apexcharts module. To customize the look and feel of the area chart, you can define properties in the Chart component.
React component called ApexAreaChart() where we can get options and series properties from data as a const variable.
function ApexAreaChart() {
return (
<>
<Chart
options={data.options}
series={data.series}
type="area"
height={350}
/>
</>
);
}
The series section is shown below.
series: [
{
name: "Employees",
data: [10, 41, 35, 51, 49, 62, 69, 91, 148,230,320,340],
},
],
The options section is shown below.




Join the conversation! Your thoughts help the community grow.