Chartjs-Problems with ChartJS refresh in angular component

2👍

The problem can be solved if you don’t invoke mostrarGraficoMezclado() inside ngAfterViewInit() but rather at the end of getDatosGlobalesGrafica(), just after getDatosGrafica().

This makes sure, the chart gets created only once its data is available.

getDatosGlobalesGrafica(proyectoId: string, acumular: boolean) {
  ...
  zip(...)
     .pipe(...)
     .subscribe(
        ...
        this.getDatosGrafica();
        this.mostrarGraficoMezclado();
     );
  );  
}

Leave a comment