Baidu echarts Knowledge Carding

Source: Internet
Author: User

Learn Echart from how to use Echart, interfaces,option and Echart to work on four aspects .

How to use:(Template project ) last week's Weibo user visualization is primarily a template project

1. Introduce a module loader,esl.js or require.js

2. prepare a Dom with a wide height for the echarts

3. Configure the Echart path for the module loader, and connect to the echarts.js to define the desired icon path.

Require.config ({

path:{

Echarts: './js/echarts ',

' Echarts/chart/bar ': './js/echarts ',

' Echarts/chart/line ': './js/echarts '

}});

4. Load echarts dynamically and then start using it in the callback function, whether it is a single file or a package ingestion requires an explicit load diagram on demand.

Require

[

' Echarts ',

' Echarts/chart/bar ',

' Echarts/chart/line '

],

Function (EC) {

var Dom=document.getelementbyid (' main ');

var mychart=ec.init (DOM);

var option={...} Copy option as a template?

mychart.setoption (option); })

(Non-template project )

1. Direct Script Tag Introduction

2. prepare a Dom with a wide height for the echarts

3.echarts and Zrender are written for direct use by the global interface

var mychart=echarts.init (document.getElementById (' main '));

Mychart.setoption ({

tooltip:{

Trigger: ' axis '

},

legend:{

data:[' evaporation ' , ' precipitation ' ]}

}),

4. Copy option when template

Interface:

Initialize (instantiate ) Unique interface method:init

after obtaining the Echarts interface through require , the graph can be instantiated by the Init method, and when the Init is executed, a DOM node with a size can be instantiated to instantiate the chart object, and theEcharts is implemented as a multi-instance. Multiple charts can be init on the same page multiple times .

Baidu echarts Knowledge Carding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.