Chartjs-Is there any way to show a tooltip for points which are not visible on the chart in Chart.js?

0👍

You can define interaction.mode: 'x' as explained here.

Please take a look at your amended code below and see how it works.

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>

Leave a comment