What are echarts? how to use? Introduction to echarts
Sep 11, 2018 pm 01:43 PMCharts can intuitively display huge data to us in a suitable way. We can also obtain valuable information through chart analysis. The front-end personnel are here to display the data in a very comfortable and intuitive way. The best way to show it to others is actually ECharts. So, what exactly is echarts? how to use? This article will introduce to you the content of echarts.
First let’s take a look at what echarts is?
From the explanation on the official website, we can know that echarts is a commercial-grade data chart. It is a pure JavaScript icon library, compatible with most browsers, and the underlying layer relies on the lightweight canvas class. The library ZRender provides intuitive, vivid, interactive, and highly customizable data visualization charts. Innovative drag-and-drop recalculation, data views, value range roaming and other features greatly enhance the user experience and empower users with the ability to mine and integrate data.
In short, echarts is a library that helps with data visualization.
After reading the explanation of what echarts is, let’s take a look at How to use echarts?
We mentioned above that echarts is a commercial-grade data chart. So let’s take a look at what these charts are
Line chart (area chart), column chart (bar chart), scatter chart (bubble chart), K-line chart, pie chart (donut chart)
12 types of charts including radar chart (filled radar chart), chord chart, force-directed layout chart, map, dashboard, funnel chart, event river chart, etc.
After we know what charts are, we need to know how to use them.
First we need to download the plug-in: https://github.com/ecomfe/echarts/archive/1.4.1.zip
Then we use it An example to illustrate the basic process of using echarts.
The first step of using echarts: First, you need to introduce the JS library into the file. You can use Baidu's CDN
<script src="http://s1.bdstatic.com/r/www/cache/ecom/esl/1-6-10/esl.js"></script>
The second step of using echarts: Then create a DIV for displaying the chart
<div id="pie" style="height:400px"></div> <div id="bar" style="height:400px"></div>
echarts Step 3: Configure the loaded chart type and path
<script type="text/javascript"> // 路径配置 require.config({ paths:{ 'echarts' : 'http://echarts.baidu.com/build/echarts', 'echarts/chart/bar' : 'http://echarts.baidu.com/build/echarts', 'echarts/chart/pie' : 'http://echarts.baidu.com/build/echarts' } }); </script>
echarts Step 4: Configure chart data
optionpie = { title: { text: '2018年08月客户总满意度比例图',subtext: '测试人员',x: 'center' }, tooltip: { trigger: 'item', formatter: "{a}<br/>{b} : {c} ({d}%)" }, legend: { orient: 'vertical', x: 'left', data: ['满意', '不满意'] }, toolbox: { show: true, feature: { restore: true, saveAsImage: true } }, calculable: true, series: [ { name: '总满意度百分比', type: 'pie', radius: '55%', center: ['50%', 225], data: [ { value: 100, name: '满意' }, { value: 16, name: '不满意'} ] } ] }; option = { title: { text: '2018年08月客户满意度分布图',subtext: '测试人员',x: 'left' }, tooltip: { trigger: 'axis', formatter: "{b}<br/>{a0} : {c0}<br/>{a1} : {c1}" }, legend: { x: 'right', padding: [5,70,5,5], data: ['满意', '不满意'] }, toolbox: { show: true, feature: { restore: true, saveAsImage: true } }, calculable: true, xAxis: [ { type: 'category', data: ['客服人员满意度', '维修人员满意度', '售后人员满意度'] } ], yAxis: [ { type: 'value', splitArea: { show: true } } ], series: [ { name: '满意', type: 'bar', radius: '55%', center: ['50%', 225], data: [10, 5, 8]}, { name: '不满意', type: 'bar', radius: '55%', center: ['50%', 225], data: [2, 4, 6]} ] };
echarts Step 5: Display the data In charts
require( [ 'echarts', 'echarts/chart/pie', 'echarts/chart/bar' ], function (ec) { //饼状图 var pieChart = ec.init(document.getElementById('pie')); pieChart.setOption(optionpie); //柱状图 var myChart = ec.init(document.getElementById('bar')); myChart.setOption(option); } )
Related recommendations:
How to use ECharts in webpack?
The above is the detailed content of What are echarts? how to use? Introduction to echarts. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

ECharts and Java interface: How to quickly implement statistical charts such as line charts, bar charts, pie charts, etc.

Steps to draw dashboard using ECharts and Python interface

How to use php interface and ECharts to generate visual statistical charts

How to use map heat map to display city heat in ECharts

How to use calendar charts to display time data in ECharts

ECharts and golang technical guide: practical tips for creating various statistical charts

How to use ECharts and php interface to generate statistical charts

Steps to create a funnel chart using ECharts and Python interface
