angularchart.jsng2-chartschartjs-plugin-zoom

how resetZoom() en multiple charts (ng2charts or chartjs)?


i have a page with multiple charts and i add the pluggin for zoom.

i reset the zoom making

this.chart.chart['resetZoom']();

and it work... in only 1 chart, just the first one.

if i make xonsole.log to this.chart, the element get only the firts chart. also, if i made this.chart.update() it work with all the charts

@ViewChild(BaseChartDirective, {static: true }) chart: BaseChartDirective;

that its the way that i access to the chart functions

i can't post the code becaouse its tooooooooo long xD


Solution

  • You can try to assign created chart to a property in your class, and after that to call .reset(). Check this example: Stackblitz