Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
Chart.js v3 - beginAtZero no hace nada en mi gráfico

Leí muchos hilos sobre el parámetro beginAtZero en Chart.js, pero ninguna de las soluciones que encontré me funcionó.

Tengo un gráfico de líneas simple con fechas en mi eje x y números enteros en mi eje y. No puedo hacer que mi eje y comience con 0.

 let atchoum = document.querySelector("#atchoum") let statchoum = new Chart(atchoum, { type: "line", data: { labels: {{ atchoumDate|raw }}, datasets: [{ label: "Nombre d'éternuements au support", data: {{ atchoumNb|raw }}, borderColor: "blue", tension: 0.3, options: { responsive: true, scales: { y: { beginAtZero: true } }, animations: { y: { easing: 'easeInOutElastic', from: (ctx) => { if (ctx.type === 'data') { if (ctx.mode === 'default' && !ctx.dropped) { ctx.dropped = true; return 0; } } } } }, } }] } })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está definiendo sus opciones en el propio conjunto de datos. Se supone que el objeto de opciones está en el mismo nivel que los campos de type y data , ya que las opciones son para todo el gráfico y no para un único conjunto de datos.

 const options = { type: 'line', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 7, 9, 20, 8] }] }, options: { scales: { y: { beginAtZero: true } } } } const ctx = document.getElementById('chartJSContainer').getContext('2d'); new Chart(ctx, options);
 <body> <canvas id="chartJSContainer" width="600" height="400"></canvas> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.5.1/chart.js"></script> </body>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!