Refactor charts to use @ViewChild instead of @Input

This commit is contained in:
Jesse Lucas
2020-03-29 16:51:12 -04:00
parent 90ed7aa121
commit 09d498bb80
5 changed files with 43 additions and 29 deletions
@@ -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) => {