Chartjs-How to always show line chart tooltip in ionic-angular.?

0👍

To always show the tooltips, you must follow an approach similar to the one described here: Chart.js v2: How to make tooltips always appear on pie chart?

You have to define for your chart the showAllTooltips option as below:

let barChart = new Chart(this.barCanvas.nativeElement, {
    type: "line",

     //...

     //...
    },
    options: {
      showAllTooltips: true,

      //...
    }
});

And than you must call the code that defines the showAllTooltips behavior.

Here is a stackblitz of the working solution.

The method configureTooltipBehavior() is the one responsible for the magic.

https://stackblitz.com/edit/angular-ivy-fzpyva

Leave a comment