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

212
Views
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
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!