Format Tooltip Chartjs TypeScript Angular

I want format the Tooltip to have this format:

APP : 111 not APP 111:111

I tried :

 tooltips: {
      callbacks: {
        title: (Items: any, data: any)=> data.datasets[0].data[Items[0].index],
        label: (Items: any, data: any) => data.datasets[Items.datasetIndex].data[Items.index]
      }
    }

But not workin, how can I modify this please, thanks for your help

enter image description here

1 answer

  • answered 2021-04-14 21:32 Flora8832

    Solution :

    tooltips: {
          mode: 'label',
          callbacks: {
            label: function(tooltipItem: any, data: any) {
              let indice = tooltipItem.index;
              return  data.labels[indice] ;
            }
          }
        },