indicatrix/elm-chartjs-webcomponent/1.0.0

NOTE: the latest version is 3.0.0

Chartjs.Options.Scales

Axes are an integral part of a chart.

So far, this module only implements simple axis properties. Planned features soon will include implementing the Cartesian & Radial axes listed in the Chart.js documentation

For more information, see https://www.chartjs.org/docs/latest/axes/

type alias Scales =
{ xAxes : List Axis
, yAxes : List Axis
}

Container for all axes of a chart

defaultScales : Scales

Create an empty scales object

scalesFromAxes : List Axis -> List Axis -> Scales

Build a scales object from a list of axes

type alias Axis =
{ position : Maybe Position
, stacked : Maybe Bool
, ticks : Maybe Ticks
, gridLines : Maybe GridLines
}

A single axis for a chart

Create an empty axis object

setPosition : Position -> Axis -> Axis

Position of the axis in the chart

setStacked : Bool -> Axis -> Axis

¯\_(ツ)_/¯

setTicks : Ticks -> Axis -> Axis

Tick configuration

setGridLines : GridLines -> Axis -> Axis

Grid line configuration

type alias Ticks =
{ fontFamily : Maybe String
, callback : Maybe String
, beginAtZero : Maybe Bool
, min : Maybe Float
, max : Maybe Float
, maxTicksLimit : Maybe Int
, precision : Maybe Int
, stepSize : Maybe Float
, suggestedMax : Maybe Float
, suggestedMin : Maybe Float
, fontColor : Maybe Color
}

Type structure for a single axes This currently only supports standard linear Cartesian axes.

For more information, see https://www.chartjs.org/docs/latest/axes/cartesian/

defaultTicks : Ticks

Create an empty ticks object

setFontFamily : String -> Ticks -> Ticks

Font family to use for ticks

setBeginAtZero : Bool -> Ticks -> Ticks

If true, scale will include 0 (if it is not already included)

setMin : Float -> Ticks -> Ticks

Defined minimum value, overrides value from data

setMax : Float -> Ticks -> Ticks

Defined maximum value, overrides value from data

setMaxTicksLimit : Int -> Ticks -> Ticks

Maximum number of ticks and grid lines to show

setPrecision : Int -> Ticks -> Ticks

If defined and stepSize is not specified, then the step size will be rounded to this many decimal places

setStepSize : Float -> Ticks -> Ticks

Set a defined fixed step size for the scale

setSuggestedMax : Float -> Ticks -> Ticks

Adjustment used when calculating the maximum data value

setSuggestedMin : Float -> Ticks -> Ticks

Adjust used when calculating the minimum data value

setFontColor : Color -> Ticks -> Ticks

Font color to use for ticks

type alias GridLines =
{ display : Maybe Bool
, color : Maybe (PointProperty Color)
}

Create an empty grid lines object For more information, see https://www.chartjs.org/docs/latest/axes/styling.html#grid-line-configuration

defaultGridLines : GridLines

Create an empty grid lines object

setDisplay : Bool -> GridLines -> GridLines

Whether grid lines should be displayed

setColor : PointProperty Color -> GridLines -> GridLines

Color to use for grid lines