This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14060|Reply: 2

[Angular] 【Practice】Angular6.x introduces echarts chart tutorial

[Copy link]
Posted on 4/24/2019 3:27:55 PM | | | |
preface

Because Angular2+ is developed using TypeScript, if you want to use echarts, you must install the Angular plugin NGX-echarts. The renderings are as follows:



GitHub address:The hyperlink login is visible.
echarts related knowledge and API:The hyperlink login is visible.

Installation

npm installation command:

npm install module_name -S i.e. npm install module_name --save write-dependenciesnpm install module_name-D --d, i.e. npm install module_name --save-dev writes devDependencies


Introduced the ngx-echarts module

Introduce NgxEchartsModule in the app.modules.ts root module

Since my page is a subcomponent, I need to import it in a submoduleIt does not need to be imported in the app.modules.ts parent module, the code is as follows:

Submodules cannot import components from the parent module, if you want to share the header component, import the header component into each module you want to use.
Shared modules are also parent modules that can export things from child modules, you add what needs to be shared into a module, and then import it in other modules

Reference links:The hyperlink login is visible.


Component HTML page itsvse.component.html introduced:

CSS Stylesheet Set Height:

itsvse.component.ts code (both TS codes below are acceptable)

Method 1:

Method 2:

Finally, run the project and you can see the echarts chart effect.






Previous:Angular6 introduces Baidu map tutorial
Next:Docker in Practice
 Landlord| Posted on 5/10/2019 10:48:10 AM |
 Landlord| Posted on 5/10/2019 4:25:17 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com