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

206
Visualizações
yAxes not re-render new data in Chart.js with React.js

Hi I try using the Line chart in my project but get an error you can see it in the image below

package.json

"dependencies": {
  "chart.js": "^3.7.1",
  "react": "^17.0.2",
  "react-chartjs-2": "^4.1.0",
  "react-dom": "^17.0.2",    
},

Chart code

 const data = {
        labels: coinTimeStamp,
        datasets: [
            {
                label: 'Price in USD.',
                data: coinPrice,
                fill: false,
                backgroundColor: '#0071bd',
                borderColor: '#0071bd'
            }
        ]
    }

    const options = {
        scales: {
            yAxes: [
                {
                    ticks: {
                        beginAtZero: true
                    }
                }
            ]
        }
    }

<Line data={data} options={options}  />

and I get these two errors in the browser console

enter image description here

and thanks

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

add the following to the import section

import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend, } from 'chart.js';

ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend );

this will fix the issue

and this---

for Invalid scale config. for scale: yAxes, I removed the first array, I think it was and left it like this: const options = { scales: { y: { ticks: { beginAtZero: true, }, }, }, };

https://github.com/adrianhajdin/project_cryptoverse/issues/26

about 4 years ago · Juan Pablo Isaza Relatório
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