score:9

Accepted answer

To add all the data from a specific label (date) in the tooltip, you need to set tooltips mode to index in your chart options, like so :

options: {
   tooltips: {
      mode: 'index'
   },
   ...
}

ᴅᴇᴍᴏ

var chart = new Chart(ctx, {
   type: 'line',
   data: {
      labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
      datasets: [{
         label: 'LINE 1',
         data: [3, 1, 4, 2, 5],
         backgroundColor: 'rgba(0, 119, 290, 0.2)',
         borderColor: 'rgba(0, 119, 290, 0.6)'
      }, {
         label: 'LINE 2',
         data: [4, 2, 3, 5, 1],
         backgroundColor: 'rgba(0, 119, 290, 0.1)',
         borderColor: 'rgba(0, 119, 290, 0.6)'
      }]
   },
   options: {
      tooltips: {
         mode: 'index'
      },
      scales: {
         yAxes: [{
            ticks: {
               beginAtZero: true
            }
         }]
      }
   }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<canvas id="ctx"></canvas>

score:-1

for chart.js version 3.x use tooltip:

options: {
   tooltip: {
      mode: 'index'
   },
   ...
}

Related Query

More Query from same tag