terezka/line-charts

Junk.hoveryMany doesn't work for more than 310 points

Closed this issue · 5 comments

Using Junk.hoverMany on a line chart works fine and the vertical line and text is show. However, after the 310:th point the line still works, but the text isn't shown anymore.
Using Elm 0.19

Thanks for reporting! Will check it out

groob commented

I am also encountering this issue, or at least something similar. I have less than 310 points though.
Here's the example I was tinkering with.
https://gist.github.com/groob/9bac21dc0980de9871187665cb2c86e0

groob commented

For my issue, I was able to debug and get a fix, though not necessarily a correct one:

diff --git a/src/Internal/Junk.elm b/src/Internal/Junk.elm
index 11f86be..d1bd43a 100644
--- a/src/Internal/Junk.elm
+++ b/src/Internal/Junk.elm
@@ -180,7 +180,7 @@ hover system x styles =

     containerStyles =
       [ if shouldFlip system x
-          then ( "transform", "translate(-100%, -50%)" )
+          then ( "transform", "translate(0, -50%)" )
           else ( "transform", "translate(0, -50%)" )
       ]
       ++ styles
@@ -209,7 +209,7 @@ hoverAt system x y styles view =
     containerStyles =
       standardStyles ++ posititonStyles ++ styles
   in
-  Html.div (List.map (\(p,v) -> Html.Attributes.style p v) styles) view
+  Html.div (List.map (\(p,v) -> Html.Attributes.style (Debug.log "internal.p" p) (Debug.log "internal.v" v)) styles) view
groob commented

I realize now that this is makes sense on the demo where the widget flips halfway through. If my chart was properly styled I wouldn't have the bug =)

That fix worked for my problem also!