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

111
Views
La etiqueta min y max no se muestra en el gráfico chart.js

los atributos min y max de chart.js no funcionan en el gráfico, pero la función junto a la declaración min y max funciona correctamente. He revisado todos los sitios web y todos los problemas, pero no puedo encontrar la solución para eso. Por favor ayuda

 const ctx = document.getElementById("myChart").getContext("2d"); let gradient = ctx.createLinearGradient(0,25,0,300); gradient.addColorStop(0, "rgba(149, 76, 233, 0.5)"); gradient.addColorStop(0.35, "rgba(149, 76, 233, 0.25)"); gradient.addColorStop(1, "rgba(149, 76, 233, 0)"); const revenue = [30.0, 38.2, 45.1, 52.4, 58.9, 65.2, 69.8, 71.6, 75.6, 82.2]; const labels = [ "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", ]; const data = { labels, datasets: [ { data: revenue, label: "Annual Revenue", fill: true, backgroundColor: gradient, borderColor: "rgba(149, 76, 233, 1)", lineTension: 0.2, pointRadius: 3, borderWidth: 2, }, ], }; const config = { type: 'line', data: data, options: { resposive: true, scales: { y:{ grindLines:{ color: "rgba(149, 76, 233, 1)" }, ticks:{ beginAtZero: false, max : "10", min : "100", callback: function (value){ return "$" + value + "k"; }, }, }, }, }, }; const myChart = new Chart(ctx, config);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Con la versión 3 de Chart.js, min y max son del tipo number y ya no se definen dentro de la opción de ticks sino directamente dentro de la scale de la siguiente manera:

 scales: { y: { min: 10, max: 100 } ...

También noté que en su código, min es más grande que max , es posible que esto deba corregirse.

Eche un vistazo a la documentación de Chart.js aquí .

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!