Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular集成echart #103

Open
deepthan opened this issue Sep 10, 2020 · 0 comments
Open

Angular集成echart #103

deepthan opened this issue Sep 10, 2020 · 0 comments

Comments

@deepthan
Copy link
Owner

集成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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant