Refactor charts to use @ViewChild instead of @Input
This commit is contained in:
@@ -9,13 +9,6 @@ import { SystemConfigService } from 'src/app/system-config.service';
|
||||
})
|
||||
export class DonutChartComponent {
|
||||
@Input() elementID: string;
|
||||
@Input() set data(val: number[]) {
|
||||
if (this.chart) {
|
||||
val.forEach((v) => {
|
||||
this.addData(v)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private canvas: any;
|
||||
private ctx: any;
|
||||
@@ -23,6 +16,14 @@ export class DonutChartComponent {
|
||||
|
||||
constructor() { }
|
||||
|
||||
data(val: number[]) {
|
||||
if (this.chart) {
|
||||
val.forEach((v) => {
|
||||
this.addData(v)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
addData(data: number): void {
|
||||
// this.chart.data.labels.push(label);
|
||||
this.chart.data.datasets.forEach((dataset) => {
|
||||
|
||||
Reference in New Issue
Block a user