From b00800731d617d9f4b29fd4ee9a0b717c750600c Mon Sep 17 00:00:00 2001
From: Florian Raab <florian.raab@student.uni-halle.de>
Date: Mon, 6 Jan 2025 14:58:32 +0100
Subject: [PATCH] LinePlot: add ratio of applied and issued to tooltip

---
 src/Views/LinePlot.elm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/Views/LinePlot.elm b/src/Views/LinePlot.elm
index 66aba0c..2c15aa7 100644
--- a/src/Views/LinePlot.elm
+++ b/src/Views/LinePlot.elm
@@ -276,6 +276,21 @@ view global model =
                                         )
                                     ]
                             )
+
+                rate = annotation
+                    |> Maybe.map
+                        (Tuple.first
+                            >> .selection
+                            >> .y
+                        )
+                    |> Maybe.withDefault []
+                    |> List.map
+                            (\{ groupLabel, value } ->
+                                value
+                            )
+                    |> List.foldl (\x y -> x / y) 1.0
+                    |> String.fromFloat
+                    |> String.left 5
             in
             Html.div
                 [ Html.Attributes.style "margin" "0"
@@ -293,6 +308,8 @@ view global model =
                 [ Html.text year
                 , Html.br [] []
                 , Html.div [] values
+                , Html.br [] []
+                , Html.text ("ratio: " ++ rate)
                 ]
 
 
-- 
GitLab