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

172
Visualizações
Negative values ​on the y axis when all points have a value of 0

I have a chart where the values ​​can be 0 or 1, and in chartJs 2 or lower it works perfect, but I migrated to version 3.6 and now the -1 appears, even though I set BeginAtZero true, min 0 and max 1. I need to make the 0 at the beginning of the y axis (as in version 2), not in the middle (as in version 3.6) this is my code

var ctx = document.getElementById("test");
var myChart = new Chart(ctx, {
   type: 'line',
   data: {
      labels: ["ab", "cd", "ef", "gh", "ij"],
      datasets: [{ data: [0, 0, 0, 0, 0] }]
   },
   options: // SEE BELOW
});

this is the options for the previous version (works correctly)

scales: {
   yAxes: [{
       ticks: {
           beginAtZero: true,
           max: 1,
           min: 0
       }
   }]
}

and this is the code for version 3.6 (y axis is wrong)

scales: {
   y: {
      ticks: {
         beginAtZero: true,
         max: 1,
         min: 0
      }
  }
}
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