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

100
Views
¿Hay alguna forma de mostrar información sobre herramientas para los puntos que no están visibles en el gráfico en Chart.js?

Tengo un gráfico de líneas que tiene un valor mínimo para el eje Y. A veces, los datos están por debajo de este valor mínimo y no quiero estirar el gráfico debido a este punto, pero quiero tener la información sobre herramientas para mostrar los datos cuando muevo el cursor al valor en el eje X.

He creado un codepen sobre el problema: codepen

 var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: "line", data: { labels: ["R", "B", "Y", "G", "P", "O"], datasets: [ { label: "# of Votes", data: [12, 13, 11, 12, 9, 13] } ] }, options: { scales: { y: { min: 10 }, }, interaction: { intersect: false, mode: 'nearest', axis: 'x', }, } });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede definir el modo interaction.mode: 'x' como se explica aquí .

Eche un vistazo a su código modificado a continuación y vea cómo funciona.

 new Chart('myChart', { type: "line", data: { labels: ["R", "B", "Y", "G", "P", "O"], datasets: [{ label: "# of Votes", data: [12, 13, 11, 12, 9, 13] }] }, options: { scales: { y: { min: 10 } }, interaction: { intersect: false, mode: 'x' } } });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.js"></script> <canvas id="myChart" height="80"></canvas>

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!