I'm currently using ng2-charts v1.5.0 and I'm facing an issue with updating the chart data after a click event. Despite following suggestions from other sources, I am unable to get it to work properly.
Here is a snippet of my code:
<div style="display: block">
<canvas #chart baseChart
[data]="dChartData"
[labels]="dChartLabels"
[chartType]="dChartType"
(chartClick)="chartClicked($event)">
</canvas>
</div>
When I try to access the BaseChartDirective using @ViewChild, I encounter this error message:
__zone_symbol__error : Error: Can't construct a query for the property "chart" of "ChartTest1WidgetComponent" since the query selector wasn't defined.
Even when I attempt to use @ViewChild with the name 'chart', calling this.chart.ngOnChanges({});
results in the error
_this.chart.ngOnChanges is not a function
. This behavior is quite confusing to me. How can I correctly reference the view child as a BaseChartDirective
?