Chartjs-Chart.js custom tooltips label

0👍

What you can do here is instead of building string for label you can build array and just simply return it.
So this is how your label callback will look like.

label: function (tooltipItem, data) {
  const labelArr = [];
  var array = data.tooltipText[tooltipItem.index];
  for (var text in array){
    labelArr.push(text + ": " + array[text])
  }
  return labelArr;
},

Leave a comment