react-apexcharts vs react-chartjs-2 vs react-highcharts vs recharts
React Charting Libraries
react-apexchartsreact-chartjs-2react-highchartsrechartsSimilar Packages:

React Charting Libraries

React charting libraries provide developers with tools to create interactive and visually appealing data visualizations within React applications. These libraries simplify the process of integrating charts and graphs, allowing for dynamic data representation and enhancing user engagement. Each library has its unique features, strengths, and design philosophies, catering to different use cases and developer preferences.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-apexcharts01,39542.3 kB186 days agoSEE LICENSE IN LICENSE
react-chartjs-206,90955.1 kB994 months agoMIT
react-highcharts01,260-636 years ago-
recharts026,6886.38 MB446a month agoMIT

Feature Comparison: react-apexcharts vs react-chartjs-2 vs react-highcharts vs recharts

Chart Variety

  • react-apexcharts:

    React-ApexCharts offers a comprehensive range of chart types, including line, bar, area, pie, radar, and more. This variety allows developers to choose the best representation for their data, making it suitable for diverse applications from simple dashboards to complex analytical tools.

  • react-chartjs-2:

    React-Chartjs-2 provides a solid selection of standard chart types such as line, bar, and doughnut charts. While it may not have as many options as some other libraries, it covers the essentials for most applications, making it a great choice for straightforward visualizations.

  • react-highcharts:

    React-Highcharts supports a wide array of chart types, including advanced options like heatmaps, treemaps, and more. This extensive variety makes it ideal for applications that require detailed data analysis and sophisticated visualizations.

  • recharts:

    Recharts focuses on a limited set of chart types, primarily line, bar, and area charts. However, it excels in creating responsive and customizable charts, making it suitable for projects that prioritize ease of use over an extensive variety.

Customization

  • react-apexcharts:

    React-ApexCharts provides extensive customization options, allowing developers to modify almost every aspect of the charts, including colors, tooltips, legends, and animations. This flexibility is beneficial for creating visually appealing and branded data visualizations.

  • react-chartjs-2:

    Customization in React-Chartjs-2 is straightforward, leveraging the underlying Chart.js configuration. While it allows for basic customization, it may require more effort for advanced styling compared to other libraries.

  • react-highcharts:

    React-Highcharts offers deep customization capabilities, enabling developers to fine-tune chart elements extensively. This is particularly useful for applications that require specific branding or detailed data representation.

  • recharts:

    Recharts is designed with a composable approach, allowing developers to easily customize charts by composing components. This makes it simple to adjust styles and behaviors, although it may not offer as many built-in customization options as some other libraries.

Performance

  • react-apexcharts:

    React-ApexCharts is optimized for performance, handling large datasets efficiently without significant lag. It employs virtual rendering techniques to ensure smooth interactions, making it suitable for real-time data applications.

  • react-chartjs-2:

    Performance in React-Chartjs-2 is generally good for standard charting needs. However, as the dataset grows, developers may need to implement optimizations to maintain responsiveness, especially with complex charts.

  • react-highcharts:

    React-Highcharts is built for high performance, capable of rendering large datasets with minimal impact on responsiveness. Its architecture is designed to handle complex visualizations without sacrificing speed.

  • recharts:

    Recharts is lightweight and performs well with moderate datasets. However, for very large datasets, performance may degrade, and developers might need to consider optimizations such as data aggregation.

Ease of Use

  • react-apexcharts:

    React-ApexCharts is known for its user-friendly API and straightforward integration process. Developers can quickly set up charts with minimal configuration, making it accessible for those new to charting libraries.

  • react-chartjs-2:

    React-Chartjs-2 is very easy to use, especially for developers familiar with Chart.js. Its simplicity allows for quick implementation of basic charts, making it ideal for rapid prototyping.

  • react-highcharts:

    React-Highcharts has a steeper learning curve due to its extensive features and options. While powerful, it may take more time for developers to fully leverage its capabilities compared to simpler libraries.

  • recharts:

    Recharts is designed with React in mind, making it intuitive for React developers. Its composable nature allows for easy integration and quick iterations, making it a favorite for projects that require fast development.

Community and Support

  • react-apexcharts:

    React-ApexCharts has a growing community and good documentation, providing ample resources for developers. However, it may not be as widely adopted as some other libraries, which could impact the availability of third-party plugins or extensions.

  • react-chartjs-2:

    React-Chartjs-2 benefits from the large Chart.js community, ensuring a wealth of resources, examples, and plugins. This strong backing makes it easier for developers to find support and solutions to common issues.

  • react-highcharts:

    React-Highcharts has a robust community and extensive documentation, making it easier for developers to find help and examples. Its popularity in enterprise applications contributes to its strong support network.

  • recharts:

    Recharts has a dedicated community and is well-documented, providing a good support structure for developers. Its focus on React ensures that resources are relevant and up-to-date.

How to Choose: react-apexcharts vs react-chartjs-2 vs react-highcharts vs recharts

  • react-apexcharts:

    Choose React-ApexCharts if you need a library that offers a wide variety of chart types and is easy to integrate with existing React applications. It is particularly useful for dashboards and data-heavy applications due to its responsive design and customization options.

  • react-chartjs-2:

    Select React-Chartjs-2 if you prefer a library that is built on top of Chart.js, known for its simplicity and ease of use. It is ideal for developers who want to create basic charts quickly without extensive configuration and appreciate the flexibility of Chart.js.

  • react-highcharts:

    Opt for React-Highcharts if you require advanced charting capabilities and a rich set of features. It is suitable for complex data visualizations and offers extensive customization options, making it a good choice for enterprise-level applications that demand high performance and detailed analytics.

  • recharts:

    Choose Recharts if you are looking for a library that is specifically designed for React and follows a composable approach. It is great for building responsive charts with a focus on simplicity and ease of use, particularly for projects that require quick iterations and a clean API.

README for react-apexcharts

build ver

React.js wrapper for ApexCharts to build interactive visualizations in react.

Download and Installation

Installing via npm
npm install react-apexcharts apexcharts

Usage

Client-Side Usage (Traditional)

import Chart from 'react-apexcharts'

To create a basic bar chart with minimal configuration, write as follows:

class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      options: {
        chart: {
          id: 'apexchart-example'
        },
        xaxis: {
          categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]
        }
      },
      series: [{
        name: 'series-1',
        data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
      }]
    }
  }
  render() {
    return (
      <Chart options={this.state.options} series={this.state.series} type="bar" width={500} height={320} />
    )
  }
}

This will render the following chart

How do I update the chart?

Simple! Just change the series or any option and it will automatically re-render the chart.

View this example on codesandbox

Server-Side Rendering (SSR) with Next.js App Router

New in v2.0.0: react-apexcharts now supports Server-Side Rendering with Next.js 13+ App Router using ApexCharts v5.5.0+.

Server Component (RSC)

Render charts on the server for faster initial page loads:

import Chart from 'react-apexcharts/server'

export default async function DashboardPage() {
  const series = [{
    name: 'series-1',
    data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
  }]

  const options = {
    chart: { id: 'apexchart-example' },
    xaxis: { categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] }
  }

  return (
    <Chart
      type="bar"
      series={series}
      options={options}
      width={500}
      height={320}
    />
  )
}

With Client-Side Hydration

For interactive charts, combine server rendering with client-side hydration:

// app/dashboard/page.tsx (Server Component)
import Chart from 'react-apexcharts/server'
import ChartHydrate from './ChartHydrate'

export default async function DashboardPage() {
  const series = [{ data: [30, 40, 35, 50, 49, 60, 70] }]
  const options = { chart: { type: 'bar' }, xaxis: { categories: ['A', 'B', 'C', 'D', 'E', 'F', 'G'] } }

  return (
    <div>
      <Chart type="bar" series={series} options={options} width={500} height={300} />
      <ChartHydrate />
    </div>
  )
}
// app/dashboard/ChartHydrate.tsx (Client Component)
'use client'
import Hydrate from 'react-apexcharts/hydrate'

export default function ChartHydrate() {
  return (
    <Hydrate
      className="my-chart"
      clientOptions={{
        chart: {
          animations: {
            enabled: true,
            speed: 800
          }
        }
      }}
    />
  )
}

Client-Only Usage in Next.js

For client-only rendering (same as before):

'use client'
import Chart from 'react-apexcharts'

export default function ClientChart() {
  const options = {
    chart: { id: 'apexchart-example' },
    xaxis: { categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] }
  }

  const series = [{
    name: 'series-1',
    data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
  }]

  return <Chart type="bar" series={series} options={options} />
}

Important: While updating the options, make sure to update the outermost property even when you need to update the nested property.

✅ Do this

this.setState({
  options: {
    ...this.state.options,
    xaxis: {
      ...this.state.options.xaxis,
      categories: ['X1', 'X2', 'X3']
    }
  }
})

❌ Not this

this.setState({
  options.xaxis.categories: ['X1', 'X2', 'X3']
})

Props

PropTypeDescription
seriesArrayThe series is a set of data. To know more about the format of the data, checkout Series docs on the website.
typeStringline, area, bar, pie, donut, scatter, bubble, heatmap, radialBar
widthNumber or StringPossible values for width can be 100%, 400px or 400 (by default is 100%)
heightNumber or StringPossible values for height can be 100%, 300px or 300 (by default is auto)
optionsObjectThe configuration object, see options on API (Reference)

How to call methods of ApexCharts programmatically?

Sometimes, you may want to call other methods of the core ApexCharts library, and you can do so on ApexCharts global variable directly

Example

ApexCharts.exec('reactchart-example', 'updateSeries', [{
  data: [40, 55, 65, 11, 23, 44, 54, 33]
}])

More info on the .exec() method can be found here

All other methods of ApexCharts can be called this way

What's included

The repository includes the following files and directories.

react-apexcharts/
├── dist/
│   ├── react-apexcharts.cjs.js
│   ├── react-apexcharts.esm.js
│   ├── react-apexcharts.iife.min.js
│   └── react-apexchart.min.js (backward compat)
└── example/
│   ├── src/
│   ├── public/
│   ├── package.json
│   └── README.md
└── src/
    └── react-apexcharts.jsx

Development

Install dependencies

npm install

Running the example

Basic example including update is included to show how to get started using ApexCharts with React easily.

To run the examples,

cd example
npm install
npm run start

Bundling

To build
npm run build

License

ApexCharts is offered under a dual-license model to support individuals, startups, and commercial products of all sizes. Read full license agreements here: https://apexcharts.com/license