Skip to content

Commit

Permalink
fix(chartjs): undefined changes.data
Browse files Browse the repository at this point in the history
  • Loading branch information
xidedix committed Nov 27, 2021
1 parent fc4d6bd commit f9f782c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions projects/coreui-angular-chartjs/src/lib/chartjs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ export class ChartjsComponent implements IChartjs, AfterViewInit, OnDestroy, OnC

ngAfterViewInit(): void {
this.chartRender();
this.chartUpdate();
// this.chartUpdate();
}

ngOnChanges(changes: SimpleChanges): void {
if (!changes.data.firstChange) {
if (changes.data && !changes.data.firstChange) {
this.chartUpdate();
}
}
Expand Down Expand Up @@ -160,7 +160,7 @@ export class ChartjsComponent implements IChartjs, AfterViewInit, OnDestroy, OnC

const ctx: CanvasRenderingContext2D = this.canvasElement.nativeElement.getContext('2d');

return this.ngZone.runOutsideAngular(() => {
this.ngZone.runOutsideAngular(() => {
const config = this.chartConfig();
if (config) {
this.chart = new Chart(ctx, config);
Expand Down

0 comments on commit f9f782c

Please sign in to comment.