terezka/elm-charts

Plot crashes on constant data and no defined domain

krlu opened this issue · 2 comments

krlu commented

Behavior

For a plot with only one series whose y value does not change, the plot crashes.

Expected Behavior

Should plot a straight horizontal line

Example

e.g. the following crashes

let
    test =
      List.range 1 60
      |> List.map (\value -> (toFloat value, 10))
in
    plot
      [ 
      ]
      [ line
        [ 
        ]
        test
      , xAxis
        [ Axis.line [ ]
        ]
      ]

Other notes

This is caused by the getRange function on line 21 in the package Internal.Stuff

Hey you! I realise that adding that crash was a terrible idea 🤦‍♀️. Instead, I now default the range to 1 when your range is zero or less and will just make a note about this in the docs somewhere. Again, thanks for notifying me!

Fixed with #34