Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

608
Visualizações
charts not showing properly in angular - Chart.js

In my component, I have 6 charts that I display via ngFor and the data I get it from Firebase, let me show you:

component.html

<div style="width: 550px; border-radius: 8px;"
         class="animacion mb-5 mat-elevation-z7 animate__animated animate__fadeInRight"
         [ngClass]="'animate__delay-'+i+'s'" *ngFor="let gerencia of arregloGerencias; let i = index">
            <div class="text-center mt-3">
                <h4>{{gerencia.nombre | titlecase}}</h4>

            </div>
            <hr>
            <canvas class="mb-5" baseChart (chartClick)="chartClicked($event)"
            [data]="arregloGrafico[i]" [labels]=" polarAreaChartLabels"
            [legend]="polarAreaLegend " [chartType]="polarAreaChartType ">

            </canvas>
        </div>

component.ts

for ( let i = 0; i < this.arregloGerencias.length; i++) {
                  let contadorListo = 0;
                  let contadorNoListo = 0;
                  for (let j = 0; j < arregloFinal.length; j++) {
                    if (arregloFinal[j].areaAux.gerencia == this.arregloGerencias[i].nombre) {
                      if (arregloFinal[j].marcador) {
                        contadorListo ++
                      } else  {
                        contadorNoListo ++
                      }
                    }
                  }
                  this.arregloGrafico.push([contadorListo, contadorNoListo]);
                  
                }

I use and array of arrays of numbers to get the data of every chart that is displayed, as you can see in the part of canvas [data]="arregloGrafico[i]" and this is what I've got:

It shows only the last two

As you can see, it only shows the last two charts properly and I don't know why that happens. What I've realized, is that the output is correct but the last two arrays shows different: enter image description here

Please help !!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda