Hover over the bars below to see a fully customized tooltip: the title shows the full date, the body formats revenue as currency, and the footer displays the percentage of the total.
Chart.js tooltips are controlled by the callbacks object inside options.plugins.tooltip. Each callback returns a string (or array of strings) that replaces the default text for that section of the tooltip:
| Callback | Tooltip Section | Receives |
|---|---|---|
title(tooltipItems) |
Top line (bold) | Array of all hovered items |
beforeLabel(tooltipItem) |
Line before the value | Single tooltip item |
label(tooltipItem) |
Main value line | Single tooltip item |
afterLabel(tooltipItem) |
Line after the value | Single tooltip item |
footer(tooltipItems) |
Bottom line (lighter text) | Array of all hovered items |
This is the exact configuration used in the chart above:
tooltipItem object gives you access to .raw (the data value), .label (the x-axis label), .dataIndex (which data point), and .dataset (the full dataset object). Use console.log(tooltipItem) during development to explore all available properties.