import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; import { ApexChart } from 'ng-apexcharts';
@Component({ selector: 'app-chart', templateUrl: './chart.component.html', styleUrls: ['./chart.component.scss'] }) export class ChartComponent implements OnInit { chartOptions: ApexChart;
constructor(private cdr: ChangeDetectorRef) { }
ngOnInit() { // 初始化 chartOptions }
updateData(newData: any[]) { this.chartOptions.series[0].data = newData; this.cdr.detectChanges(); }
updateTitle(newTitle: string) { this.chartOptions.title.text = newTitle; this.cdr.detectChanges(); } }
下一篇:Apexchart标记溢出错误