[Chartjs]-React-chartjs-2 tooltip callback not working

10👍

You are using v2 syntax while using v3 so the option name and place where wrong, also your scale config was wrong, it should look like this:

const option = {
  plugins: {
    tooltip: {
      callbacks: {
        title: function () {
          return "my tittle";
        }
      }
    },
    legend: { display: false },
    title: {
      display: true,
      text: "Test chart",
      position: "top"
    }
  },
  scales: {
    y: {
      beginAtZero: true
    }
  }
};

For more information about changes between v2 and v3 please check the migration guide

Leave a comment