Skip to content

Angular集成echart #103

Open
Open
@deepthan

Description

@deepthan

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions