Chartjs-Can't get if else statement in tooltip label to work in chartjs

0👍

In the else case you return an array but you should return a string. Remove the angle brackets and check if it works.

} else {                        
  return corporation  + " €" + valor.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."), "Inschrijfprijs : €" + total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}

Tooltip Callbacks from Chart.js documentation states

label (…) Returns text to render for an individual item in the tooltip.

Leave a comment