# Rescaled tooltips

Example data:

gdp = {{10, 2783}, {11, 2892}, {12, 2904}, {13, 2917}, {14, 2981}, {15, 3026},
{16, 3093}, {17, 3176}, {18, 3207}, {19, 3241.}, {20, 3121}, {21, 3203}, {22, 3261}};

pop = {{10, 34.1}, {11, 36.1}, {12, 36.2}, {13, 36.2}, {14, 36.9}, {15, 37.3},
{16, 37.6}, {17, 38.4}, {18, 38.7}, {19, 39.0}, {20, 37.5}, {21, 38.5}, {22, 39.2}};


I want to plot pop with a second right-sided axis. Since I couldn't find a solution with the MultiaxisArrangement-option (it doesnt't accept Joined -> {True, False} etc.), I used an answer found here:

How to combine several plots with different $x$ and $y$-axis?

gdpm = MinMax @ gdp[[All, 2]];
popm = MinMax @ pop[[All, 2]];
popr = Transpose[{#1, Rescale[#2, popm, gdpm]} & @@ Transpose[pop]];


The plot looks like expected:

ListPlot[{gdp, popr},
Filling -> {2 -> Axis},
FillingStyle -> Thickness[0.04],
Frame -> True,
FrameTicks -> {{All, ChartingFindTicks[gdpm, popm]}, {gdp[[All, 1]], None}},
GridLines -> {All, Automatic},
Joined -> {True, False},
PlotRangePadding -> {{0.2, 0.5}, Automatic},
PlotStyle -> ColorData[97, "ColorList"][[{2, 1}]]]


Unfortunately, the Tooltip of popr still shows the original values of pop. This can be easily fixed, I thought, write your own Tooltip:

 popt = Transpose[{pop, popr}] /. {{y_, rv_}, {_, ov_}} :> {y, Tooltip[ov, Row[{y, rv}, " - "]]}


But now, with ListPlot[{gdp, popt}..., popt doesn't show up at all!

How can I get rescaled Tooltips?

rescaleLabels = AssociationThread[
Join[gdp[[All, -1]], Round @ popr[[All, -1]]],
Join[gdp[[All, -1]], pop[[All, -1]]]];

LF = Row[{#[[1]], ReplaceAll[Missing[_, a_] :> a] @
rescaleLabels @ #[[2, 1]]}, ","] &;

ListPlot[{gdp, popr},
PlotHighlighting -> {{"IndicatedPoint"},
{"XYLabel", <|LabelingFunction -> LF|>}},
Filling -> {2 -> Axis},
FillingStyle -> Directive[Thickness[0.04], CapForm["Butt"]],
Frame -> True,
FrameTicks -> {{All, ChartingFindTicks[gdpm, popm]}, {gdp[[All, 1]],
None}},
GridLines -> {All, Automatic},
Joined -> {True, False},
PlotRangePadding -> {{0.2, 0.5}, Automatic},
PlotStyle -> ColorData[97, "ColorList"][[{2, 1}]]]