Skip to content

How to ensure hover tooltip shows the same value as the one displayed on the chart (provided by formatter) #423

Open
@axsaucedo

Description

@axsaucedo

If a formatter is provided, this has effect on the labels that appear on the chart directly, but it seems not on the tooltip labels. How can I make sure that the tooltips also show the correct label? Is this a feature of datalabels? Or would the expectation be that I have to also override the tooltip formatter directly?

As an example, I have a formatter function that changes the labels to %:

                    formatter: (value, ctx) => {
						let sum = 0;
						let dataArr = ctx.chart.data.datasets[0].data;
						dataArr.map(data => {
							sum += data;
						});
						let percentage = (value*100 / sum).toFixed(2)+"%";
						return percentage;
					},

I would like for this same label to appear on the tooltip hover as well, but it seems it only applies to the chart as mentioned.

Let me know if you need any further details. thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions