indicatrix/elm-chartjs-webcomponent/1.0.0

NOTE: the latest version is 3.0.0

Chartjs.Options.Legend

type alias Legend =
{ display : Maybe Bool
, position : Maybe Position
, fullWidth : Maybe Bool
, reverse : Maybe Bool
, labels : Maybe Labels
}

The chart legend displays data about the datasets that are appearing on the chart

defaultLegend : Legend

Create a blank legend object that can then be updated with the below functions

setDisplay : Bool -> Legend -> Legend

Is the legend shown?

setPosition : Position -> Legend -> Legend

Position of the legend (relative to the chart)

setFullWidth : Bool -> Legend -> Legend

Marks that this box should take the full width of the canvas (pushing down other boxes). This is unlikely to need to be changed in day-to-day use.

setReverse : Bool -> Legend -> Legend

Legend will show datasets in reverse order

setLabels : Labels -> Legend -> Legend

Set properties for the labels of this legend

type alias Labels =
{ boxWidth : Maybe Int
, fontSize : Maybe Int
, fontStyle : Maybe String
, fontColor : Maybe Color
, fontFamily : Maybe String
, padding : Maybe Int
, usePointStyle : Maybe Bool
}

Properties for the labels that make up the legend

defaultLabels : Labels

Create a blank labels object that can then be updated with the below functions

setBoxWidth : Int -> Labels -> Labels

Width of the coloured box

setFontSize : Int -> Labels -> Labels

Font size of the label text

setFontStyle : String -> Labels -> Labels

Font style of the label text (normal, bold, etc.)

setFontColor : Color -> Labels -> Labels

Color of the label text

setFontFamily : String -> Labels -> Labels

Font family to use for label text

setPadding : Int -> Labels -> Labels

Padding between rows of coloured boxes

setUsePointStyle : Bool -> Labels -> Labels

Label style will match corresponding point style