lauber00/line-charts/1.0.0

NOTE: the latest version is 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 e767c3b500c5 of https://github.com/volgariver6/line-charts (zip prefix lauber00-line-charts-8ed8149/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 da35244e03bdd7ae72c088a2a7ca7ba589ca943a.

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.0/

LineChart.Line

type alias Config data =
Config data

Use in the LineChart.Config passed to LineChart.viewCustom.

chartConfig : LineChart.Config Data msg
chartConfig =
  { ...
  , line = Line.default
  , ...
  }
default : Config data

Makes 1px wide lines.

wider : Float -> Config data

Pass the desired width of your lines.

chartConfig : LineChart.Config Data msg
chartConfig =
  { ...
  , line = Line.wider 3
  , ...
  }

See the full example here.

hoverOne : Maybe data -> Config data

Makes the line, to which the data in the first argument belongs, wider!

chartConfig : Maybe Data -> LineChart.Config Data Msg
chartConfig hovered =
  { ...
  , line = Line.hoverOne hovered
  , ...
  }

See the full example here.

custom : (List data -> Style) -> Config data

Edit as style of a line based on its data.

lineConfig : Maybe Data -> Line.Config Data
lineConfig maybeHovered =
  Line.custom (toLineStyle maybeHovered)




toLineStyle : Maybe Data -> List Data -> Line.Style
toLineStyle maybeHovered lineData =
  case maybeHovered of
    Nothing -> -- No line is hovered
      Line.style 1 identity


    Just hovered -> -- Some line is hovered
      if List.any ((==) hovered) lineData then
        -- It is this one, so make it pop!
        Line.style 2 (Manipulate.darken 0.1)
      else
        -- It is not this one, so hide it a bit
        Line.style 1 (Manipulate.lighten 0.35)

See the full example here.

Styles

type alias Style =
Style
style : Float -> (Color -> Color) -> Style

Pass the width of the line and a function transforming the line's color.

vanilla : Line.Style
vanilla =
  Line.style 1 identity


emphasize : Line.Style
emphasize =
  Line.style 2 (Manipulate.darken 0.15)


hide : Line.Style
hide =
  Line.style 1 (Manipulate.lighten 0.15)


blacken : Line.Style
blacken =
  Line.style 2 (\_ -> Colors.black)

See the full example here.