recharts vs chart.js vs echarts vs apexcharts
Data Visualization Libraries Comparison
1 Year
rechartschart.jsechartsapexchartsSimilar Packages:
What's Data Visualization Libraries?

Data visualization libraries are tools that help developers create graphical representations of data in web applications. These libraries provide various types of charts, graphs, and interactive visualizations that make it easier to understand complex data sets. They often come with customizable features, animations, and support for real-time data, allowing for dynamic and engaging presentations of information. Examples include bar charts, line graphs, pie charts, scatter plots, and more, which can be integrated into websites and applications to enhance data storytelling and analysis.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
recharts7,515,61224,9994.64 MB44712 days agoMIT
chart.js4,441,84865,7114.96 MB47415 minutes agoMIT
echarts1,152,32063,22153.2 MB2,1364 months agoApache-2.0
apexcharts1,039,93714,7214.94 MB3052 months agoMIT
Feature Comparison: recharts vs chart.js vs echarts vs apexcharts

Chart Types

  • recharts:

    Recharts focuses on providing a set of composable chart components for React applications. It supports common chart types such as line, bar, pie, area, and scatter charts, but it is not as extensive as some other libraries in terms of specialized chart types.

  • chart.js:

    Chart.js provides support for 11 different chart types, including line, bar, radar, doughnut, polar area, bubble, and scatter charts. It also allows for the creation of mixed charts by combining multiple chart types in a single canvas.

  • echarts:

    ECharts is known for its extensive support for complex and specialized chart types, including tree diagrams, sunburst charts, heatmaps, and more. It also supports 3D charts and custom visualizations, making it one of the most versatile libraries for data representation.

  • apexcharts:

    ApexCharts supports a wide variety of chart types, including line, bar, area, pie, radial bar, and more. It also offers mixed charts, which allow you to combine different types of charts in a single visualization.

Customization

  • recharts:

    Recharts allows for customization of chart components through props and CSS. Since it is built with React, developers can easily create reusable and customizable components, but it may require more effort to achieve deep customization compared to other libraries.

  • chart.js:

    Chart.js is highly customizable, allowing developers to modify almost every aspect of the chart, including scales, legends, tooltips, and animations. It also supports plugins, which can be used to extend the functionality and add custom features.

  • echarts:

    ECharts provides extensive customization options, including the ability to style charts using JSON configuration. It supports dynamic data updates, custom themes, and even allows for the creation of interactive visualizations using JavaScript.

  • apexcharts:

    ApexCharts offers a high level of customization for its charts, including the ability to modify colors, labels, tooltips, and animations. It also supports custom SVG rendering and provides a straightforward API for configuring chart properties.

Performance

  • recharts:

    Recharts is optimized for performance in React applications, but its performance can be affected by the number of rendered components and the complexity of the charts. It is best suited for small to medium-sized data sets.

  • chart.js:

    Chart.js is lightweight and performs efficiently with small to medium-sized data sets. It may experience performance issues with very large data sets or highly complex charts, but these can often be mitigated with optimizations.

  • echarts:

    ECharts is designed to handle large data sets and complex visualizations efficiently. It uses a canvas-based rendering approach, which helps maintain performance even with thousands of data points and intricate chart types.

  • apexcharts:

    ApexCharts performs well with moderate data sets and provides smooth interactions. However, performance may degrade with extremely large data sets, especially if multiple charts are rendered on the same page.

Interactivity

  • recharts:

    Recharts provides good interactivity, especially for React applications. It supports tooltips, legends, and event handling, allowing developers to create interactive charts with relative ease.

  • chart.js:

    Chart.js supports basic interactivity out of the box, such as tooltips and hover effects. Developers can add more interactive features using plugins and custom JavaScript code, but it may require additional effort.

  • echarts:

    ECharts excels in interactivity, offering advanced features like dynamic data updates, draggable elements, and customizable tooltips. It also supports event handling and allows for the creation of highly interactive and engaging visualizations.

  • apexcharts:

    ApexCharts provides a range of interactive features, including tooltips, zooming, panning, and data point selection. These features are easy to implement and enhance the user experience without requiring extensive configuration.

Ease of Use: Code Examples

  • recharts:

    Simple Area Chart with Recharts

    import React from 'react';
    import { AreaChart, Area, XAxis, YAxis, Tooltip, CartesianGrid, ResponsiveContainer } from 'recharts';
    
    const data = [
      { name: 'Page A', uv: 4000, pv: 2400, amt: 2400 },
      { name: 'Page B', uv: 3000, pv: 1398, amt: 2210 },
      { name: 'Page C', uv: 2000, pv: 9800, amt: 2290 },
      { name: 'Page D', uv: 2780, pv: 3908, amt: 2000 },
      { name: 'Page E', uv: 1890, pv: 4800, amt: 2181 },
      { name: 'Page F', uv: 2390, pv: 3800, amt: 2500 },
      { name: 'Page G', uv: 3490, pv: 4300, amt: 2100
    };
    
    const Example = () => (
      <ResponsiveContainer width="100%" height={400}>
        <AreaChart data={data}>
          <CartesianGrid strokeDasharray="3 3" />
          <XAxis dataKey="name" />
          <YAxis />
          <Tooltip />
          <Area type="monotone" dataKey="pv" stroke="#8884d8" fill="rgba(136, 132, 216, 0.2)" />
        </AreaChart>
      </ResponsiveContainer>
    );
    
    export default Example;
    
  • chart.js:

    Simple Bar Chart with Chart.js

    <canvas id="myChart" width="400" height="200"></canvas>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script>
    var ctx = document.getElementById('myChart').getContext('2d');
    var myChart = new Chart(ctx, {
      type: 'bar',
      data: {
        labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
        datasets: [{
          label: '# of Votes',
          data: [12, 19, 3, 5, 2, 3],
          backgroundColor: ['rgba(255, 99, 132, 0.2)',
                          'rgba(54, 162, 235, 0.2)',
                          'rgba(255, 206, 86, 0.2)',
                          'rgba(75, 192, 192, 0.2)',
                          'rgba(153, 102, 255, 0.2)',
                          'rgba(255, 159, 64, 0.2)'],
          borderColor: ['rgba(255, 99, 132, 1)',
                        'rgba(54, 162, 235, 1)',
                        'rgba(255, 206, 86, 1)',
                        'rgba(75, 192, 192, 1)',
                        'rgba(153, 102, 255, 1)',
                        'rgba(255, 159, 64, 1)'],
          borderWidth: 1
        }]
      },
      options: {
        scales: {
          y: {
            beginAtZero: true
          }
        }
      }
    });
    </script>
    
  • echarts:

    Simple Pie Chart with ECharts

    <div id="main" style="width: 600px;height:400px;"></div>
    <script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
    <script>
    var myChart = echarts.init(document.getElementById('main'));
    var option = {
      title: {
        text: 'ECharts Entry Example',
        subtext: 'Fake Data',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [{
        name: 'Access From',
        type: 'pie',
        radius: '50%',
        data: [
          {value: 1048, name: 'Search Engine'},
          {value: 735, name: 'Direct'},
          {value: 580, name: 'Email'},
          {value: 484, name: 'Union Ads'}
        ],
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 10,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }]
    };
    myChart.setOption(option);
    </script>
    
  • apexcharts:

    Simple Line Chart with ApexCharts

    <div id="chart"></div>
    <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
    <script>
    var options = {
      chart: {
        type: 'line'
      },
      series: [{
        name: 'Sales',
        data: [30, 40, 35, 50, 49, 60, 70]
      }],
      xaxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
      }
    };
    var chart = new ApexCharts(document.querySelector('#chart'), options);
    chart.render();
    </script>
    
How to Choose: recharts vs chart.js vs echarts vs apexcharts
  • recharts:

    Choose Recharts if you are building a React application and want a library that is specifically designed for React. It is built on top of D3.js and provides a set of composable components that make it easy to create responsive and customizable charts.

  • chart.js:

    Select Chart.js if you want a lightweight, open-source library that provides a good balance between simplicity and functionality. It supports various chart types and is highly customizable, making it suitable for both beginners and experienced developers.

  • echarts:

    Opt for ECharts if you are working with large data sets and need a library that can handle complex visualizations. It is highly customizable, supports dynamic data, and offers advanced features like data-driven animations and rich interaction capabilities.

  • apexcharts:

    Choose ApexCharts if you need a simple, easy-to-use library that offers a wide range of chart types with minimal configuration. It is particularly good for projects that require interactive charts with tooltips, zooming, and panning features.

README for recharts

Recharts

storybook Build Status Coverage Status npm version npm downloads MIT License

Introduction

Recharts is a Redefined chart library built with React and D3.

The main purpose of this library is to help you to write charts in React applications without any pain. Main principles of Recharts are:

  1. Simply deploy with React components.
  2. Native SVG support, lightweight depending only on some D3 submodules.
  3. Declarative components, components of charts are purely presentational.

Documentation at recharts.org and our storybook (WIP)

Please see the wiki for FAQ.

All development is done on the master branch. The current latest release and storybook documentation reflects what is on the release branch.

Examples

<LineChart width={400} height={400} data={data} margin={{ top: 5, right: 20, left: 10, bottom: 5 }}>
  <XAxis dataKey="name" />
  <Tooltip />
  <CartesianGrid stroke="#f5f5f5" />
  <Line type="monotone" dataKey="uv" stroke="#ff7300" yAxisId={0} />
  <Line type="monotone" dataKey="pv" stroke="#387908" yAxisId={1} />
</LineChart>

All the components of Recharts are clearly separated. The lineChart is composed of x axis, tooltip, grid, and line items, and each of them is an independent React Component. The clear separation and composition of components is one of the principle Recharts follows.

Installation

npm

NPM is the easiest and fastest way to get started using Recharts. It is also the recommended installation method when building single-page applications (SPAs). It pairs nicely with a CommonJS module bundler such as Webpack.

# latest stable
$ npm install recharts

umd

The UMD build is also available on unpkg.com:

<script src="https://unpkg.com/react/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/recharts/umd/Recharts.min.js"></script>

Then you can find the library on window.Recharts.

dev build

$ git clone https://github.com/recharts/recharts.git
$ cd recharts
$ npm install
$ npm run build

Demo

To examine the demos in your local build, execute:

$ npm run[-script] demo

and then browse to http://localhost:3000.

Storybook

We are in the process of unifying documentation and examples in storybook. To run it locally, execute

$ npm run[-script] storybook

and then browse to http://localhost:6006.

Releases

Releases are automated via GH Actions - when a new release is created in GH, CI will trigger that:

  1. Runs a build
  2. Runs tests
  3. Runs npm publish

Version increments and tagging are not automated at this time.

Release testing

Until we can automate more, it should be preferred to test as close to the results of npm publish as we possibly can. This ensures we don't publish unintended breaking changes. One way to do that is using yalc - npm i -g yalc.

  1. Make your changes in recharts
  2. yalc publish in recharts
  3. yalc add recharts in your test package (ex: in a vite or webpack reach app with recharts installed, imported, and your recent changes used)
  4. npm install
  5. Test a local run, a build, etc.

Module Formats

  • babel-plugin-recharts A simple transform to cherry-pick Recharts modules so you don’t have to. Note: this plugin is out of date and may not work with 2.x

Thanks

Chromatic

Thanks to Chromatic for providing the visual testing platform that helps us review UI changes and catch visual regressions.

License

MIT

Copyright (c) 2015-2023 Recharts Group.