✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

How to display real y value on hover tooltip when barnorm = "percent"

Hi,
I have a bar chart with barnorm = “percent”.
In the hoverinfo tooltip the %{y} value corresponds to y the percentage value, but I would like to display both the real %{y} and pecentage %{y} value.
This is possible in pie charts for example, using the following hovertemplate:

hovertemplate = "Label: %{label}" + \
                          "<br>Value: %{value}" + \
                          "<br>Percent value: %{percent}" + \
                          "<extra></extra>"

I could not find anything similar for bar charts (with barnorm = “percent”) or stacked area charts (with groupnorm = “percent”).

One of my miserable attempts was:

hovertemplate = "Real y: %{data[%{pointNumber}]}" + \
                         "<br> Percent y: %{y}" + \
                         "<extra></extra>"

But having nested %{…%{…}} doesn’t seem to be possible.

Any ideas ?

Thanks !