How do I add a $ prefix to the tooltip in chart.js and have no decimal places

0👍

This ca be done by defining options.plugins.tooltip.callbacks.label function inside your setup variable as follows.

var setup = {
  type: 'bar',
  data: chartdata,
  options: {
    plugins: {
      title: {
        display: true,
        text: dataj.cols[0].label
      },
      tooltip: {
        callbacks: {              
          label: ctx => ctx.label + ': $' + parseInt(ctx.parsed.y).toLocaleString()
        }
      }
    },
    responsive: true,
  }
}

Please take a look at the Tooltip Callbacks page from the Chart.js documentation for further details.

Leave a comment