Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

213
Vistas
Chart.js - mouse over line event

Is it possible in Chart.js to detect event when mouse is over a line in the chart? I also need to know the index of the dataset.

enter image description here

HTML:

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
<canvas id="myChart" width="300px" height="100px"></canvas>

JAVASCRIPT

var fruits = ['Apples', 'Oranges', 'Tomotoes']

var datasets = fruits.map(function(a) {
  return {
    label: a,
    data: new Array(10).fill(0).map(Math.random),
    fill: false,
  }
})


var canvas = document.getElementById("myChart");
var ctx = canvas.getContext("2d");
var myChart = window.myChart = new Chart(ctx, {
  type: 'line',
  data: {
    //labels: labels,
    labels: new Array(10),
    datasets: datasets,
  },
  options: {
  }
});

https://jsfiddle.net/9qo874en/

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda