What is echarts?
ECharts is a powerful, interactive charting and visualization library for browser environments. It provides a wide range of chart types and is highly customizable, making it suitable for complex data visualization needs.
What are echarts's main functionalities?
Line Chart
This code initializes a basic line chart with ECharts. It sets up the x-axis with categories representing days of the week and the y-axis with numerical values. The series data represents the values for each day.
const echarts = require('echarts');
const chart = echarts.init(document.getElementById('main'));
const option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
}]
};
chart.setOption(option);
Bar Chart
This code initializes a basic bar chart with ECharts. Similar to the line chart, it sets up the x-axis with categories and the y-axis with numerical values. The series data represents the bar heights for each category.
const echarts = require('echarts');
const chart = echarts.init(document.getElementById('main'));
const option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar'
}]
};
chart.setOption(option);
Pie Chart
This code initializes a basic pie chart with ECharts. The series data represents different categories and their corresponding values, which are displayed as slices of the pie.
const echarts = require('echarts');
const chart = echarts.init(document.getElementById('main'));
const option = {
series: [{
type: 'pie',
data: [
{ value: 1048, name: 'Search Engine' },
{ value: 735, name: 'Direct' },
{ value: 580, name: 'Email' },
{ value: 484, name: 'Union Ads' },
{ value: 300, name: 'Video Ads' }
]
}]
};
chart.setOption(option);
Other packages similar to echarts
chart.js
Chart.js is a simple yet flexible JavaScript charting library for designers & developers. It offers a variety of chart types and is known for its ease of use and integration. Compared to ECharts, Chart.js is more lightweight but may lack some of the advanced features and customizability.
highcharts
Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to web sites or web applications. Highcharts is known for its extensive range of chart types and high level of customization. It is comparable to ECharts in terms of functionality but is a commercial product with licensing fees for certain uses.
d3
D3.js is a JavaScript library for producing dynamic, interactive data visualizations in web browsers. It uses SVG, HTML, and CSS. D3 is highly flexible and powerful, allowing for complex and custom visualizations. However, it has a steeper learning curve compared to ECharts.
Apache ECharts (incubating)
Apache ECharts (incubating) is a free, powerful charting and visualization library offering an easy way of adding 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.
Now ECharts is an incubator project of Apache Software Foundation.
Please check its incubator status here
中文官网 | ENGLISH HOMEPAGE
Get Apache ECharts (incubating)
You may choose one of the following methods:
- Download from Official Website in 中文下载页
- Download from Official Website in English
npm install echarts --save
- CDN: jsDelivr CDN
Docs
-
Tutorial
-
API
-
Option Manual
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
# If intending to build and get all types of the "production" files:
npm run release
# The same as `node build/build.js --release`
# If only intending to get `dist/echarts.js`, which is usually
# enough in dev or running the tests:
npm run build
# The same as `node build/build.js`
# Get the same "production" files as `node build/build.js`, while
# watching the editing of the source code. Usually used in dev.
npm run watch
# The same as `node build/build.js -w`
# Check the manual:
npm run help
# The same as `node build/build.js --help`
Then the "production" files are generated in the dist
directory.
More custom build approaches can be checked in this tutorial: Create Custom Build of ECharts please.
Contribution
If you wish to debug locally or make pull requests, please refer to contributing document.
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.