lauber00/line-charts/1.0.1

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 0f11d0eac8ee of https://github.com/volgariver6/line-charts (zip prefix lauber00-line-charts-eb18a18/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 753022dabb810e0f2ef35feb04e89192f71460de.

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

LineChart.Container

type alias Config msg =
Config msg

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

chartConfig : LineChart.Config Data Msg
chartConfig =
  { ...
  , container = Container.default
  , ...
  }
default : String -> Config msg

The default container configuration.

Pass the id.

See the full example here.

spaced : String -> Float -> Float -> Float -> Float -> Config msg

The default container configuration, but you decide the margins.

Pass the id and the top, right, bottom, and left margin respectively.

customContainer : Container.Config msg
customContainer =
  Container.spaced "line-chart-1" 60 100 60 70

See the full example here.

styled : String -> List ( String, String ) -> Config msg

The default container configuration, but you can add some extra styles.

Pass the id and styles in form of tupels of strings.

customContainer : Container.Config msg
customContainer =
  Container.styled "line-chart-1" [ ( "font-family", "monospace" ) ]

Ok, so we have spaced if we want to set the margins and styled if we want to set the styles; but what if I want to set the margins AND the styles? If so, use custom!

responsive : String -> Config msg

Makes the chart take the size of your container.

Pass the id.

See the full example here.

Customization

custom : Properties msg -> Config msg

Properties:

  • attributesHtml are attributes which will go on it's internal div container.
  • attributesSvg are attributes which will go on it's internal svg container.
  • size controls the size. See the Size type for options.
  • margin adds margin around the chart.
  • id sets the id. It's important for this to be unique for every chart on your page.containerConfig : Container.Config msg containerConfig = Container.custom { attributesHtml = [ Html.Attributes.style [ ( "font-family", "monospace" ) ] ] , attributesSvg = [] , size = Container.static , margin = Container.Margin 30 100 60 80 , id = "chart-id" }

See the full example here.

type alias Properties msg =
{ attributesHtml : List (Attribute msg)
, attributesSvg : List (Attribute msg)
, size : Size
, margin : Margin
, id : String
}
type alias Margin =
{ top : Float
, right : Float
, bottom : Float
, left : Float
}

Sizing

type alias Size =
Size
relative : Size

Makes the chart size relative to it's container

static : Size

Makes the chart the exact number of pixels defined in your x and y axis configuration.