ECharts Tutorial
ECharts is an open-source visualization library implemented in JavaScript, covering charts across industries and meeting various needs.
ECharts provides rich chart types and interaction capabilities, enabling users to generate various charts through simple configuration, including but not limited to line charts, bar charts, scatter charts, pie charts, radar charts, maps, and more.
ECharts follows the Apache-2.0 open-source license and is free for commercial use.
ECharts is compatible with the vast majority of current browsers (IE8/9/10/11, Chrome, Firefox, Safari, etc.) and various devices, allowing display anytime and anywhere.
Knowledge you need before reading this tutorial:
To read this tutorial, you need to have the following foundation:
First ECharts Example
Example
<
!
DOCTYPE
html
<
html
<
head
<
meta
charset
=
"
utf-8
"
<
title
First ECharts Example
title
<
script
src
=
"
https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js
"
script
head
<
body
<
div
id
=
"
main
"
style
=
"
width: 600px;height:400px;
"
div
<
script
type
=
"
text/javascript
"
// Initialize the echarts instance based on the prepared DOM var myChart = echarts.init(document.getElementById('main')); // Specify the chart's configuration and data var option = { title: { text: 'First ECharts Example' }, tooltip: {}, legend: { data:['Sales'] }, xAxis: { data: ["Shirt","Sweater","Chiffon Shirt","Pants","High Heels","Socks"] }, yAxis: {}, series: [{ name: 'Sales', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] }; // Display the chart using the just-specified configuration and data. myChart.setOption(option);
script
body
html
Try it »
Click the "Try it" button to view the online example
ECharts Features
ECharts includes the following features:
-
Rich visualization types: provides regular line charts, bar charts, scatter charts, pie charts, candlestick charts, box plots for statistics, maps and heatmaps for geographic data visualization, line charts, relationship graphs, treemap, and sunburst for relational data visualization, parallel coordinates for multidimensional data visualization, as well as funnel charts and gauges for BI, and supports mixing charts.
-
Multiple data formats can be used directly without conversion: the built-in dataset property (4.0+) supports directly passing data sources in various formats including two-dimensional tables and key-value pairs; it also supports input of TypedArray format data.
-
Front-end presentation of massive data: through incremental rendering technology (4.0+), combined with various fine optimizations, ECharts can present data volumes in the tens of millions.
-
Mobile optimization: detailed optimizations for mobile interactions, e.g., on small mobile screens it is suitable to zoom and pan within the coordinate system with fingers. On PC, you can also zoom (with the mouse wheel) and pan within the chart with the mouse.
-
Multiple rendering solutions, cross-platform use: supports rendering charts in the form of Canvas, SVG (4.0+), and VML.
-
Deep interactive data exploration: provides out-of-the-box interactive components such as legend, visual mapping, data area zoom, tooltip, and data brush selection, enabling multi-dimensional data filtering, view zooming, detail display, and other interactive operations.
-
Support for multidimensional data and rich visual encoding: for traditional scatter charts and others, the passed-in data can also be multi-dimensional.
-
Dynamic data: changes in data drive changes in the chart's presentation.
-
Gorgeous effects: provides eye-catching effects for the visualization of geographic data such as line data and point data.
-
Achieve more powerful and gorgeous 3D visualization through GL: Achieve three-dimensional visualization effects in VR and large-screen scenarios.
-
Accessibility (4.0+): Supports automatically generating descriptions from chart configuration items, so that visually impaired users can understand chart content with the help of screen-reading devices, making charts accessible to more people!