lauber00/line-charts/1.0.3

Renamed to volgariver6/line-charts. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as lauber00/line-charts still install under that name. 4 versions of 4 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/volgariver6/line-charts.

What we checked: The repo moved to github.com/volgariver6/line-charts. Rebuilt with git archive from commit d68ee83c9316 of https://github.com/volgariver6/line-charts (zip prefix lauber00-line-charts-ec0c8ea/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 1d2d5061fac32e0920f5c86bf94648f2ee5bd718.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/lauber00/line-charts/zipball/1.0.3/

LineChart.Axis.Ticks

type alias Config msg =
Config msg

Part of the configuration in Axis.custom.

axisConfig : Axis.Config Data msg
axisConfig =
  Axis.custom
    { ..
    , ticks = Ticks.default
    , ...
    }
default : Config msg

Makes around five ticks at "nice" numbers.

** What are "nice" numbers/integers/datetimes? **

"Nice" numbers are intervals which begin with 10, 5, 3, 2, 1 (adjusted to magnitude, of course!). For dates, it means whole days, weeks, months or hours, minutes, and seconds.

Custom amount

Choose the approximate amount of ticks on your axis!

ticksConfig : Ticks.Config msg
ticksConfig =
  Ticks.int 7   -- makes ca. 7 ticks at nice integers
  -- or
  Ticks.time 7  -- makes ca. 7 ticks at nice datetimes
  -- or
  Ticks.float 7 -- makes ca. 7 ticks at nice float

See full example here.

int : Int -> Config msg
time : Zone -> Int -> Config msg
float : Int -> Config msg

Custom tick

Now you get to decide how the ticks should look. Remember that all formatting of the value in the label is done in Axis.Tick!

ticksConfig : Ticks.Config msg
ticksConfig =
  Ticks.intCustom 7 customTick

See full example here.

intCustom : Int -> (Int -> Config msg) -> Config msg
timeCustom : Zone -> Int -> (Time -> Config msg) -> Config msg
floatCustom : Int -> (Float -> Config msg) -> Config msg

Custom positions

custom : (Range -> Range -> List (Config msg)) -> Config msg

Make your own combination of ticks.

ticksConfig : Maybe Info -> Ticks.Config msg
ticksConfig maybeHovered =
  let
    hoverOne =
      case maybeHovered of
        Just hovered -> [ Tick.float hovered.age ]
        Nothing -> []


    framing range =
      List.map Tick.float [ range.min, range.max ]
  in
  Ticks.custom <| \dataRange axisRange ->
    framing dataRange ++ hoverOne

See full example here.

** What if I still want nice values?**

You can use Axis.Values to produce "nice" values within a given range.