Angular uses Echarts and adaptive

1. Install npm dependencies

Download and install dependencies in the Angular root directory

npm install echarts --save
npm install ngx-echarts --save

2. Import files

Angular.json
introduces "node_modules/echarts/dist/echarts.js" in the scripts of Angular.json.
Both build and test need to be introduced
insert image description here
insert image description here

3. Import module

insert image description here

4. Use

   <div style="height: 99%; width: 99%" echarts [options]="lineOptions" [loading]="true" [autoResize]="true"></div>

Note: You don’t need to use the complicated method in the echarts document to achieve self-adaptation, but use it in npm ng-echarts, as follows:
Explore more functions by yourself
insert image description here

Guess you like

Origin blog.csdn.net/DragonOfMoon/article/details/125079445