terezka/elm-plot/3.0.1

NOTE: this package is not compatible with Elm 0.19.1

Plot.Axis

Attributes for altering the view of your axis.

Definition

type alias Attribute msg =
Config msg -> Config msg

Attributes

classes : List String -> Attribute msg

Adds classes to the container holding your axis.

myXAxis : Plot.Element msg
myXAxis =
    Plot.xAxis
        [ Axis.view
            [ Axis.classes [ "axis--x" ] ]
        ]
line : List (Attribute msg) -> Attribute msg

Adds styles to the axis line.

myXAxis : Plot.Element msg
myXAxis =
    Plot.xAxis
        [ Axis.view
            [ Axis.lineStyle [ ( "stroke", "blue" ) ] ]
        ]
positionLowest : Attribute msg

Position this axis to the lowest value on the opposite axis. E.g. if this attribute is added on an y-axis, it will be positioned to the left.

myXAxis : Plot.Element msg
myXAxis =
    Plot.xAxis
        [ Axis.view
            [ Axis.positionLowest ]
        ]
positionHighest : Attribute msg

Position this axis to the highest value on the opposite axis. E.g. if this attribute is added on an y-axis, it will be positioned to the right.

myXAxis : Plot.Element msg
myXAxis =
    Plot.xAxis
        [ Axis.view
            [ Axis.positionHighest ]
        ]
cleanCrossings : Attribute msg

Remove tick and value where the axis crosses the opposite axis.

myXAxis : Plot.Element msg
myXAxis =
    Plot.xAxis
        [ Axis.view [ Axis.cleanCrossings ] ]
anchorInside : Attribute msg

Anchor the ticks/labels on the inside of the plot. By default they are anchored on the outside.

myXAxis : Plot.Element msg
myXAxis =
    Plot.xAxis
        [ Axis.view
            [ Axis.anchorInside ]
        ]

Ticks and labels

tick : List (Attribute msg) -> Attribute msg

By providing this attribute with a list of tick attributes, you may alter the values and ticks displayed as your axis' ticks.

myYAxis : Plot.Element msg
myYAxis =
    Plot.yAxis
        [ Axis.tick
            [ Tick.view [ Tick.length 3 ]
            , Tick.values [ 2, 4, 6 ]
            ]
        ]
label : List (Attribute msg) -> Attribute msg

By providing this attribute with a list of label attributes, you may alter the values and ticks displayed as your axis' labels.

myYAxis : Plot.Element msg
myYAxis =
    Plot.yAxis
        [ Axis.tick
            [ Label.view
                [ Label.displace (10, 0)
                , Label.format formatFunc
                ]
            , Label.values [ 3, 5, 7 ]
            ]
        ]