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