import {Component, ElementRef, Input, ViewChild} from '@angular/core';
import * as echarts from 'echarts';

@Component({
    selector: 'echart-data',
    templateUrl: 'echart-data.html'
})
export class EchartDataComponent {
    @ViewChild('echart') echart: ElementRef;//显示图形的容器

    @Input() data;
    pieChart;

    constructor() {
        setTimeout(() => {
            if (this.data) {
                echarts.init(this.echart.nativeElement).setOption(this.data, true);
            }
        }, 10000)
    }

}
