Open
Description
集成echart
npm install echarts
在你的组件
ts
import {
Component,
AfterViewInit,
ViewChild,
ElementRef,
} from "@angular/core";
import * as echarts from "echarts";
chartInstance: any;
@ViewChild("chart", { static: false }) chart: ElementRef;
...
ngAfterViewInit() {
this.chartInstance = echarts.init(this.chart.nativeElement);
this.chartInstance.setOption(LINE_OPTIONS);
}
html
<div #chart class="chart-wrap"></div>