'How to consume loop data in tooltip chartjs

v2, i want to try implement looping data from response api, but when i using .maps its loop in one tooltip & try like this just array zero data show same in every tooltips

here my code:

plugins: {
    legend: {
        display: false,
    },
    tooltip: {
        yAlign: "bottom",
        xAlign: "center",
        events: ['click'],
        displayColors: false,
        callbacks: {
            title: function () {
                var label = response.data.tsell.reverse().map((data) => data.total_amount);
                return label[0]; //if just label its loop all data but same in every tooltip data
            },
            label: function () {
                var label = response.data.tsell.reverse().map((data) => data.total_invoice);
                return label[0] + ' Transactions';
            }
        }
    },
    scales: {
        y:{
          min: -15,
          max: 15,
          stepSize: 5,
        },
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source