Example data:
data = <|"France" -> <|"10" -> 100.0, "11" -> 100.5, "12" -> 101.0, "13" -> 101.5, "14" -> 102.3, "15" -> 102.8, "16" -> 103.1`, "17" -> 103.3, "18" -> 103.7, "19" -> 103.9, "20" -> 104.1, "21" -> 104.6, "22" -> 105.0|>, "Spain" -> <|"10" -> 100.0, "11" -> 100.4, "12" -> 100.7, "13" -> 100.5, "14" -> 100.1, "15" -> 99.9, "16" -> 99.9, "17" -> 100.1, "18" -> 100.4, "19" -> 101.0, "20" -> 101.8, "21" -> 102.0, "22" -> 102.0|>, "Mean" -> <|"10" -> 100.0, "11" -> 100.2, "12" -> 100.3, "13" -> 100.2, "14" -> 100.4, "15" -> 100.2, "16" -> 100.0, "17" -> 100.0, "18" -> 100.0, "19" -> 99.9, "20" -> 100.1, "21" -> 100.0, "22" -> 99.7|>, "Italy" -> <|"10" -> 100.0, "11" -> 100.3, "12" -> 100.3, "13" -> 100.8, "14" -> 102.7, "15" -> 102.7, "16" -> 102.5, "17" -> 102.4, "18" -> 102.2, "19" -> 101.1, "20" -> 100.8, "21" -> 100.1, "22" -> 99.7|>, "Portugal" -> <|"10" -> 100.0, "11" -> 100.0, "12" -> 99.7, "13" -> 99.2, "14" -> 98.6, "15" -> 98.1, "16" -> 97.8, "17" -> 97.5, "18" -> 97.3, "19" -> 97.2, "20" -> 97.4, "21" -> 97.4, "22" -> 97.9|>, "Greece" -> <|"10" -> 100.0, "11" -> 100.0, "12" -> 99.7, "13" -> 99.0, "14" -> 98.3, "15" -> 97.7, "16" -> 97.0, "17" -> 96.8, "18" -> 96.6, "19" -> 96.5, "20" -> 96.4, "21" -> 96.0, "22" -> 94.1|>|>; My question is a follow-up on this answer by @kglr:
Borrowing from it with some changes:
ClickPlot[dt_] := DynamicModule[{black, check, color, lands, length, pal, pos, years}, lands = Keys @ dt; years = ToExpression @ Keys[dt[[1]]]; length = Length @ lands; pal = Flatten[{#, #}] &[ColorData[97, "ColorList"]]; color = Table[i -> {pal[[i]], Thickness[0.0025]}, {i, length}]; black = Table[i -> {Black, Thin}, {i, length}]; check = Table[i -> Pane[Style[lands[[i]], "Panel"]], {i, length}]; Dynamic @ Column[{ ListPlot[dt, DataRange -> MinMax[years], Frame -> True, FrameTicks -> {{All, None}, {years, None}}, GridLines -> {years, Automatic}, ImageSize -> 600, Joined -> True, LabelingFunction -> None, PlotHighlighting -> "Ball", PlotLabels -> Automatic, PlotStyle -> Values[<|black, KeyTake[pos] @ color|>] ], Panel @ CheckboxBar[ Dynamic[pos], check, Method -> "Active", Appearance -> "Horizontal" -> {Automatic, 7} ] }] ] Highlight France, Spain and Italy:
ClickPlot[data] I would like to omit the CheckboxBar and click the PlotLabels instead. This should be extremely difficult to achieve. But maybe it would be possible to link the plot lines to Button - wrappers. (See documentation for ListPlot, Details and Options).
Then, by clicking one or more lines (possibly at the right end points), one would get the highlight effects as shown above.



