apexcharts vs chart.js vs echarts vs recharts
Data Visualization Libraries
apexchartschart.jsechartsrechartsSimilar Packages:

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.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
apexcharts015,0798.35 MB336a day agoSEE LICENSE IN LICENSE
chart.js067,2176.18 MB5365 months agoMIT
echarts065,84457.6 MB1,7807 months agoApache-2.0
recharts026,7396.38 MB446a month agoMIT

Feature Comparison: apexcharts vs chart.js vs echarts vs recharts

Chart Types

  • 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.

  • 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.

  • 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.

Customization

  • 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.

  • 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.

  • 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.

Performance

  • 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.

  • 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.

  • 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.

Interactivity

  • 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.

  • 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.

  • 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.

Ease of Use: Code Examples

  • 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>
    
  • 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>
    
  • 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;
    

How to Choose: apexcharts vs chart.js vs echarts vs recharts

  • 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.

  • 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.

  • 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.

README for apexcharts

build downloads ver size prettier jsdelivr

A modern JavaScript charting library that allows you to build interactive data visualizations with simple API and 100+ ready-to-use samples. Packed with the features that you expect, ApexCharts includes over a dozen chart types that deliver beautiful, responsive visualizations in your apps and dashboards.


Download and Installation

Installing via npm
npm install apexcharts --save
Direct <script> include
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>

Wrappers for Vue/React/Angular/Stencil

Integrate easily with 3rd party frameworks

Unofficial Wrappers

Useful links to wrappers other than the popular frameworks mentioned above

Usage

Client-Side (Browser)

import ApexCharts from 'apexcharts'

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

var options = {
  chart: {
    type: 'bar'
  },
  series: [
    {
      name: 'sales',
      data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
    }
  ],
  xaxis: {
    categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]
  }
}

var chart = new ApexCharts(document.querySelector('#chart'), options)
chart.render()

Server-Side Rendering (SSR)

ApexCharts now supports SSR for Next.js, Nuxt, SvelteKit, Astro, and other meta-frameworks:

import ApexCharts from 'apexcharts/ssr'

const chartHTML = await ApexCharts.renderToHTML({
  series: [{ data: [30, 40, 35, 50, 49, 60, 70, 91, 125] }],
  chart: { type: 'bar' },
  xaxis: {
    categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]
  }
}, {
  width: 500,
  height: 300
})

// Returns hydration-ready HTML with embedded SVG
// Client-side hydration (makes chart interactive)
import ApexCharts from 'apexcharts/client'

// Hydrate specific chart
ApexCharts.hydrate(document.getElementById('my-chart'))

// Or hydrate all charts on the page
ApexCharts.hydrateAll()

This will render the following chart

Tree-shaking — ship only what you use

By default import ApexCharts from 'apexcharts' includes everything. If you want a smaller bundle, import from apexcharts/core and add only the chart types and features you need:

import ApexCharts from 'apexcharts/core'   // bare class — no chart types, no features

// Import by the exact chart type name you use in { chart: { type: '...' } }
import 'apexcharts/line'
import 'apexcharts/bar'
// import 'apexcharts/area'
// import 'apexcharts/scatter'

// Optional features
import 'apexcharts/features/legend'
import 'apexcharts/features/toolbar'      // zoom/pan toolbar
// import 'apexcharts/features/exports'      // SVG/PNG/CSV download
// import 'apexcharts/features/annotations'
// import 'apexcharts/features/keyboard'     // keyboard navigation

Vite users: Vite's dependency pre-bundler can create two separate copies of ApexCharts, causing "chart type X is not registered" errors even when the import is present. Fix this by listing all apexcharts sub-entries in optimizeDeps.include:

// vite.config.js
export default {
  optimizeDeps: {
    include: [
      'apexcharts/core',
      'apexcharts/line',   // add only the ones you import
      'apexcharts/bar',
      'apexcharts/features/legend',
      'apexcharts/features/toolbar',
      // ...
    ],
  },
}

See tree-shaking for the full guide.

A little more than the basic

You can create a combination of different charts, sync them and give your desired look with unlimited possibilities. Below is an example of synchronized charts with github style.

Interactivity

Zoom, Pan, and Scroll through data. Make selections and load other charts using those selections. An example showing some interactivity

interactive chart

Dynamic Series Update

Another approach is to Drill down charts where one selection updates the data of other charts. An example of loading dynamic series into charts is shown below

dynamic-loading-chart

Annotations

Annotations allow you to write custom text on specific values or on axes values. Valuable to expand the visual appeal of your chart and make it more informative.

annotations

Mixed Charts

You can combine more than one chart type to create a combo/mixed chart. Possible combinations can be line/area/column together in a single chart. Each chart type can have its own y-axis.

annotations

Candlestick

Use a candlestick chart (a common financial chart) to describe price changes of a security, derivative, or currency. The below image shows how you can use another chart as a brush/preview pane which acts as a handle to browse the main candlestick chart.

candlestick

Heatmaps

Use Heatmaps to represent data through colors and shades. Frequently used with bigger data collections, they are valuable for recognizing patterns and areas of focus.

heatmap

Gauges

The tiny gauges are an important part of a dashboard and are useful in displaying single-series data. A demo of these gauges:

radialbar-chart

Sparklines

Utilize sparklines to indicate trends in data, for example, occasional increments or declines, monetary cycles, or to feature the most extreme and least values:

sparkline-chart

Need Advanced Data Grid for your next project?

We partnered with Infragistics, creators of the fastest data grids on the planet! Ignite UI Grids can handle unlimited rows and columns of data while providing access to custom templates and real-time data updates.

Featuring an intuitive API for easy theming and branding, you can quickly bind to data with minimal hand-on coding. The grid is available in most of your favorite frameworks:

Angular Data Grid | React Data Grid | Blazor Data Grid | Web Components DataGrid | jQuery Data Grid

What's included

The download bundle includes the following files and directories providing a minified single file in the dist folder. Every asset including icon/css is bundled in the js itself to avoid loading multiple files.

apexcharts/
├── dist/
│   └── apexcharts.min.js
├── src/
│   ├── assets/
│   ├── charts/
│   ├── modules/
│   ├── utils/
│   └── apexcharts.js
└── samples/

Development

Install dependencies and run the project

npm install
npm run dev

This will start the webpack watch and any changes you make to src folder will auto-compile and output will be produced in the dist folder.

More details in Contributing Guidelines.

Minifying the src

npm run build

Where do I go next?

Head over to the documentation section to read more about how to use different kinds of charts and explore all options.

Contacts

Email: info@apexcharts.com

Twitter: @apexcharts

Facebook: fb.com/apexcharts

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