Convert Figma logo to code with AI

apache logoecharts

Apache ECharts is a powerful, interactive charting and data visualization library for browser

60,384
19,607
60,384
2,175

Top Related Projects

Highcharts JS, the JavaScript charting framework

64,568

Simple HTML5 Charts using the <canvas> tag

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

16,856

Open-source JavaScript charting library behind Plotly and Dash

101,622

JavaScript 3D Library.

23,884

Redefined chart library built with React and D3

Quick Overview

Apache ECharts is a powerful, interactive charting and data visualization library for browser-based applications. It offers a wide range of chart types, from basic line and bar charts to more complex 3D and geographic visualizations, making it suitable for various data representation needs.

Pros

  • Highly customizable with a rich set of options for fine-tuning chart appearance and behavior
  • Supports a wide variety of chart types, including 3D and geographic visualizations
  • Excellent performance, even with large datasets, due to incremental rendering
  • Active community and regular updates, ensuring ongoing improvements and bug fixes

Cons

  • Steep learning curve due to the extensive API and configuration options
  • Large file size, which may impact initial page load times
  • Limited built-in themes, requiring additional effort for custom styling
  • Some advanced features may require additional plugins or extensions

Code Examples

  1. Creating a basic line chart:
// Initialize the echarts instance
var myChart = echarts.init(document.getElementById('main'));

// Specify the configuration items and data
var option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [{
    data: [820, 932, 901, 934, 1290, 1330, 1320],
    type: 'line'
  }]
};

// Use the configuration items and data to set the chart
myChart.setOption(option);
  1. Creating a pie chart with custom colors:
var myChart = echarts.init(document.getElementById('main'));

var option = {
  color: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#990099'],
  series: [{
    name: 'Sales',
    type: 'pie',
    radius: '55%',
    data: [
      {value: 335, name: 'Direct'},
      {value: 310, name: 'Email'},
      {value: 234, name: 'Affiliate'},
      {value: 135, name: 'Video Ads'},
      {value: 1548, name: 'Search'}
    ]
  }]
};

myChart.setOption(option);
  1. Creating a bar chart with dataset:
var myChart = echarts.init(document.getElementById('main'));

var option = {
  dataset: {
    source: [
      ['product', '2015', '2016', '2017'],
      ['Matcha Latte', 43.3, 85.8, 93.7],
      ['Milk Tea', 83.1, 73.4, 55.1],
      ['Cheese Cocoa', 86.4, 65.2, 82.5],
      ['Walnut Brownie', 72.4, 53.9, 39.1]
    ]
  },
  xAxis: {type: 'category'},
  yAxis: {},
  series: [
    {type: 'bar'},
    {type: 'bar'},
    {type: 'bar'}
  ]
};

myChart.setOption(option);

Getting Started

  1. Include ECharts in your project:

    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.2/dist/echarts.min.js"></script>
    
  2. Create a DOM element to render the chart:

    <div id="main" style="width: 600px;height:400px;"></div>
    
  3. Initialize and render the chart:

    var myChart = echarts.init(document.getElementById('main'));
    var option = {
      // Chart configuration
    };
    myChart.setOption(option);
    

Competitor Comparisons

Highcharts JS, the JavaScript charting framework

Pros of Highcharts

  • Commercial-grade support and documentation
  • Extensive range of chart types and customization options
  • Better cross-browser compatibility, especially for older browsers

Cons of Highcharts

  • Requires a license for commercial use
  • Steeper learning curve due to more complex API
  • Larger file size, potentially impacting page load times

Code Comparison

ECharts:

var myChart = echarts.init(document.getElementById('main'));
myChart.setOption({
    xAxis: {type: 'category', data: ['Mon', 'Tue', 'Wed']},
    yAxis: {type: 'value'},
    series: [{data: [120, 200, 150], type: 'line'}]
});

Highcharts:

Highcharts.chart('container', {
    xAxis: {categories: ['Mon', 'Tue', 'Wed']},
    yAxis: {title: {text: 'Values'}},
    series: [{name: 'Data', data: [120, 200, 150]}]
});

Both ECharts and Highcharts are powerful charting libraries with their own strengths. ECharts offers a free, open-source solution with good performance and a growing community. It's particularly strong in handling large datasets and provides unique chart types popular in East Asian markets. Highcharts, while requiring a license for commercial use, offers more polished documentation, extensive customization options, and better support for older browsers. The choice between them often depends on specific project requirements, budget constraints, and target audience.

64,568

Simple HTML5 Charts using the <canvas> tag

Pros of Chart.js

  • Lightweight and simple to use, with a smaller file size
  • Easier learning curve for beginners
  • Better default animations and interactivity out of the box

Cons of Chart.js

  • Less customization options compared to ECharts
  • Limited chart types and advanced features
  • May require additional plugins for complex visualizations

Code Comparison

Chart.js:

new Chart(ctx, {
    type: 'bar',
    data: {
        labels: ['Red', 'Blue', 'Yellow'],
        datasets: [{
            label: 'My Dataset',
            data: [12, 19, 3]
        }]
    }
});

ECharts:

echarts.init(document.getElementById('main')).setOption({
    xAxis: {
        type: 'category',
        data: ['Red', 'Blue', 'Yellow']
    },
    yAxis: {
        type: 'value'
    },
    series: [{
        data: [12, 19, 3],
        type: 'bar'
    }]
});

Both libraries offer straightforward ways to create charts, but ECharts provides more detailed configuration options, while Chart.js focuses on simplicity and ease of use. ECharts excels in handling large datasets and creating complex visualizations, whereas Chart.js is ideal for quick, simple charts with minimal setup.

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

Pros of D3

  • More flexible and customizable, allowing for complex and unique visualizations
  • Extensive documentation and large community support
  • Direct manipulation of the DOM for fine-grained control

Cons of D3

  • Steeper learning curve, especially for beginners
  • Requires more code to create basic charts
  • Less out-of-the-box functionality compared to ECharts

Code Comparison

D3:

const svg = d3.select("body").append("svg")
    .attr("width", 400)
    .attr("height", 300);

svg.selectAll("rect")
    .data(data)
    .enter()
    .append("rect")
    .attr("x", (d, i) => i * 40)
    .attr("y", d => 300 - d * 10)
    .attr("width", 35)
    .attr("height", d => d * 10);

ECharts:

const option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
    },
    yAxis: {
        type: 'value'
    },
    series: [{
        data: [120, 200, 150, 80, 70],
        type: 'bar'
    }]
};
chart.setOption(option);

D3 provides more control over individual elements, while ECharts offers a more declarative approach with pre-built chart types.

16,856

Open-source JavaScript charting library behind Plotly and Dash

Pros of Plotly.js

  • More extensive documentation and examples
  • Better support for 3D visualizations
  • Easier integration with web frameworks like React and Vue

Cons of Plotly.js

  • Larger file size, potentially impacting page load times
  • Steeper learning curve for beginners
  • Less performant with large datasets compared to ECharts

Code Comparison

ECharts:

var myChart = echarts.init(document.getElementById('main'));
var option = {
    xAxis: {type: 'category', data: ['A', 'B', 'C']},
    yAxis: {type: 'value'},
    series: [{type: 'bar', data: [1, 2, 3]}]
};
myChart.setOption(option);

Plotly.js:

var data = [{
    x: ['A', 'B', 'C'],
    y: [1, 2, 3],
    type: 'bar'
}];
var layout = {title: 'Simple Bar Chart'};
Plotly.newPlot('myDiv', data, layout);

Both libraries offer powerful charting capabilities, but they differ in syntax and approach. ECharts uses a more configuration-based setup, while Plotly.js leans towards a data-driven structure. The choice between them often depends on specific project requirements and personal preference.

101,622

JavaScript 3D Library.

Pros of three.js

  • Specializes in 3D graphics rendering, offering more advanced 3D capabilities
  • Larger community and ecosystem, with extensive documentation and examples
  • More flexible and customizable for complex 3D visualizations

Cons of three.js

  • Steeper learning curve, especially for those new to 3D graphics
  • Larger file size and potentially higher performance overhead
  • Less suitable for simple 2D charts and graphs

Code Comparison

ECharts (2D bar chart):

var myChart = echarts.init(document.getElementById('main'));
var option = {
    xAxis: {type: 'category', data: ['A', 'B', 'C']},
    yAxis: {type: 'value'},
    series: [{type: 'bar', data: [120, 200, 150]}]
};
myChart.setOption(option);

three.js (3D cube):

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
const geometry = new THREE.BoxGeometry();
const material = new THREE.MeshBasicMaterial({color: 0x00ff00});
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);

Both libraries are powerful tools for data visualization, but they serve different purposes. ECharts excels in creating 2D charts and graphs with ease, while three.js is better suited for complex 3D visualizations and interactive graphics. The choice between them depends on the specific requirements of your project.

23,884

Redefined chart library built with React and D3

Pros of Recharts

  • Built specifically for React, offering seamless integration with React applications
  • Simpler API and more declarative syntax, making it easier for React developers to use
  • Smaller bundle size, which can lead to faster load times for web applications

Cons of Recharts

  • Less feature-rich compared to ECharts, with fewer chart types and customization options
  • Smaller community and ecosystem, resulting in fewer resources and third-party extensions
  • Limited support for non-React environments

Code Comparison

ECharts:

var myChart = echarts.init(document.getElementById('main'));
var option = {
    xAxis: {type: 'category', data: ['Mon', 'Tue', 'Wed']},
    yAxis: {type: 'value'},
    series: [{data: [120, 200, 150], type: 'line'}]
};
myChart.setOption(option);

Recharts:

import { LineChart, Line, XAxis, YAxis } from 'recharts';
const data = [{name: 'Mon', value: 120}, {name: 'Tue', value: 200}, {name: 'Wed', value: 150}];
<LineChart width={400} height={300} data={data}>
  <XAxis dataKey="name" /><YAxis /><Line type="monotone" dataKey="value" stroke="#8884d8" />
</LineChart>

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Apache ECharts

logo

Apache ECharts is a free, powerful charting and visualization library offering easy ways to add intuitive, interactive, and highly customizable charts to your commercial products. It is written in pure JavaScript and based on zrender, which is a whole new lightweight canvas library.

中文官网 | ENGLISH HOMEPAGE

License Latest npm release NPM downloads Contributors

Build Status

Get Apache ECharts

You may choose one of the following methods:

Docs

Get Help

Build

Build echarts source code:

Execute the instructions in the root directory of the echarts: (Node.js is required)

# Install the dependencies from NPM:
npm install

# Rebuild source code immediately in watch mode when changing the source code.
# It opens the `./test` directory, and you may open `-cases.html` to get the list
# of all test cases.
# If you wish to create a test case, run `npm run mktest:help` to learn more.
npm run dev

# Check the correctness of TypeScript code.
npm run checktype

# If intending to build and get all types of the "production" files:
npm run release

Then the "production" files are generated in the dist directory.

Contribution

Please refer to the contributing document if you wish to debug locally or make pull requests.

Resources

Awesome ECharts

https://github.com/ecomfe/awesome-echarts

Extensions

License

ECharts is available under the Apache License V2.

Code of Conduct

Please refer to Apache Code of Conduct.

Paper

Deqing Li, Honghui Mei, Yi Shen, Shuang Su, Wenli Zhang, Junting Wang, Ming Zu, Wei Chen. ECharts: A Declarative Framework for Rapid Construction of Web-based Visualization. Visual Informatics, 2018.

NPM DownloadsLast 30 Days