Code With Yd

Code With Yd

CodeWithYd

Oct 26th, 2024

How to install and use to Apex chart in React

How to install and use to Apex chart in React

ApexChart is a React charting library for creating interactive, responsive visualizations with various chart types and features like tooltips and legends.

ApexChart is a powerful charting library for React that allows developers to create interactive and responsive visualizations with ease. With support for various chart types—such as line, bar, and pie—ApexChart provides a rich set of features, including tooltips, legends, and animations. Its seamless integration with React and straightforward API make it ideal for building dynamic dashboards and data-driven applications.


How to install Apex chart:

npm install apexcharts 


Here’s a simple example of an Apex chart:

import Chart from 'react-apexcharts';


const SimpleLineChart = () => {
  const options = {
    chart: {
      type: 'line',
      zoom: { enabled: false },
    },
    xaxis: {
      categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
    },
    title: {
      text: 'Monthly Revenue',
    },
  };


  const series = [
    {
      name: 'Revenue',
      data: [30, 40, 35, 50, 49],
    },
  ];


  return <Chart options={options} series={series} type="line" height={350} />;
};


export default SimpleLineChart;


Apex chart link: https://apexcharts.com/


For more demos visit this link: https://apexcharts.com/javascript-chart-demos/