drawGrad :: GradData -> Diagram SVG R2
drawGrad ((s,e), Grad n d _) = pathImg <> km
 where title = translateX mid $ textDef n === textDef (show2Digit d)
       mid = (s + e) / 2
       km = translateX s $ rotate (1/4 @@ turn) $ textDef (showKm s)
       pathImg | 0 /= d = (scaleY (signum d) $ p2 (s,25) ~~ p2 (e,-25)) <> title
               | d == 0 = p2 (s, 0) ~~ p2 (e, 0)
drawGrad :: GradData -> Diagram SVG R2
drawGrad ((s,e), Grad n d _) = pathImg <> km
 where title = translateX mid $ textDef n === textDef (show2Digit d)
       mid = (s + e) / 2
       km = translateX s $ rotate (1/4 @@ turn) $ textDef (showKm s)
       pathImg | 0 /= d = (scaleY (signum d) $ p2 (s,25) ~~ p2 (e,-25)) <> title
               | d == 0 = p2 (s, 0) ~~ p2 (e, 0)
drawGrad ((s,e), Grad n d _) = pathImg <> km
 where title = translateX mid $ textDef n === textDef (show2Digit d)
       mid = (s + e) / 2
       km = translateX s $ rotate (1/4 @@ turn) $ textDef (showKm s)
       pathImg | 0 /= d = (scaleY (signum d) $ p2 (s,25) ~~ p2 (e,-25)) <> title
               | d == 0 = p2 (s, 0) ~~ p2 (e, 0)