georgesboris/elm-widgets-charts-alpha/9.2.0

NOTE: the latest version is 9.2.2

W.Chart

Setup

globalStyles : Svg msg
List (ChartAttribute msg)
-> { x : AxisConfigX msg x }
-> ConfigX msg x
List (ChartAttribute msg)
-> { x : AxisConfigX msg x
, y : AxisConfigYZ msg x y
}
-> ConfigXY msg x y
List (ChartAttribute msg)
-> { x : AxisConfigX msg x
, y : AxisConfigYZ msg x y
, z : AxisConfigYZ msg x z
}
-> ConfigXYZ msg x y z
type alias ConfigX msg x =
Config msg x () () { x : Point x }
type alias ConfigXY msg x y =
Config
msg
x
y
()
{ x : Point x
, y : List (Point y)
}
type alias ConfigXYZ msg x y z =
Config
msg
x
y
z
{ x : Point x
, y : List (Point y)
, z : List (Point z)
}
type alias Config msg x y z point =
Config msg x y z point
type alias ChartAttribute msg =
Attr (Attributes msg)

Axis

List (AxisAttribute msg)
-> { data : List x
, toLabel : x -> String
}
-> AxisConfigX msg x
List (AxisAttribute msg)
-> { label : String
, color : String
, toValue : x -> Maybe Float
}
-> AxisConfigYZ msg x String
List (AxisAttribute msg)
-> { data : List a
, toLabel : a -> String
, toColor : a -> String
, toValue : a -> x -> Maybe Float
}
-> AxisConfigYZ msg x a

Axis Attributes

stacked : AxisAttribute msg
distribution : AxisAttribute msg
axisLabel : String -> AxisAttribute msg
axisLabelPadding : Float -> AxisAttribute msg
defaultValue : Float -> AxisAttribute msg
safety : Float -> AxisAttribute msg
ticks : Int -> AxisAttribute msg
format : (Float -> String) -> AxisAttribute msg
formatList : (List Float -> String) -> AxisAttribute msg

Formats lists of values for a given axis.

Used as the default format function for all aggregations.

( { label : String
, color : String
, values : List Float
}
-> List (Html msg)
)
-> AxisAttribute msg
formatStack : (List Float -> String) -> AxisAttribute msg

@deprecated. Use formatList instead.

noAxisLine : AxisAttribute msg
noGridLines : AxisAttribute msg
type alias AxisAttribute msg =
Attr (AxisAttributes msg)

Annotations

Labels

noLabels : ChartAttribute msg
dontAutoHideLabels : ChartAttribute msg
mergeAxisAnnotations : ChartAttribute msg

Legends

topLegends : ChartAttribute msg

Displays the legends below the header (if present) and above the chart.

bottomLegends : ChartAttribute msg

Displays the legends above the footer (if present) and below the chart.

showLegendsLabels : ChartAttribute msg

Displays the axis labels on top of the legends.

showLegendsValues : ChartAttribute msg

Displays values for each legend to the side of the legend.

Format can be customized through formatList.

formatLegendValues : (List Float -> String) -> AxisAttribute msg

Overrides formatList when displaying the values on a legend.

legendsPadding : Float -> ChartAttribute msg

Defines the space between legends and the header or footer.

legendsPaddingLeft : Float -> ChartAttribute msg
legendsPaddingRight : Float -> ChartAttribute msg
legendsPaddingX : Float -> ChartAttribute msg
legendsMinWidth : Int -> ChartAttribute msg

Annotation Padding

annotationsPadding : Float -> ChartAttribute msg
annotationsPaddingX : Float -> ChartAttribute msg
annotationsTopPadding : Float -> ChartAttribute msg
annotationsBottomPadding : Float -> ChartAttribute msg
annotationsLeftPadding : Float -> ChartAttribute msg
annotationsRightPadding : Float -> ChartAttribute msg

Testing

id : String -> ChartAttribute msg

Styles

Size

width : Int -> ChartAttribute msg
ratio : Float -> ChartAttribute msg
background : String -> ChartAttribute msg

Padding

padding : Int -> ChartAttribute msg
paddingX : Int -> ChartAttribute msg
paddingY : Int -> ChartAttribute msg
paddingTop : Int -> ChartAttribute msg
paddingBottom : Int -> ChartAttribute msg
paddingLeft : Int -> ChartAttribute msg
paddingRight : Int -> ChartAttribute msg
{ top : Int
, left : Int
, right : Int
, bottom : Int
}
-> ChartAttribute msg

Colors

Font Sizes

{ small : Float
, medium : Float
, large : Float
}
-> ChartAttribute msg

Widgets

view : List (Widget msg x y z point) -> Config msg x y z point -> Html msg
type alias WidgetX msg x y z a =
Widget msg x y z { a | x : Point x }
type alias WidgetXY msg x y z a =
Widget msg x y z { a | x : Point x, y : List (Point y) }
type alias WidgetXYZ msg x y z a =
Widget
msg
x
y
z
{ a | x : Point x, y : List (Point y), z : List (Point z) }
type alias Widget msg x y z point =
Widget msg x y z point

Interaction

Maybe Coordinates
-> Config msg x y z point
-> Config msg x y z point
List (HoverAttribute msg point)
-> Config msg x y z point
-> Config msg x y z point
groupByXY : HoverAttribute msg point
( { x : Float
, y : Maybe Float
}
-> point
-> msg
)
-> HoverAttribute msg point
( { x : Float
, y : Maybe Float
}
-> point
-> msg
)
-> HoverAttribute msg point
( { x : Float
, y : Maybe Float
}
-> point
-> msg
)
-> HoverAttribute msg point
type alias PointX x =
{ x : Point x }
type alias PointXY x y =
{ x : Point x
, y : List (Point y)
}
type alias PointXYZ x y z =
{ x : Point x
, y : List (Point y)
, z : List (Point z)
}

Chart Interaction

onMouseEnterChart : msg -> ChartAttribute msg
onMouseLeaveChart : msg -> ChartAttribute msg

Helpful Types

type alias Context msg x y z =
Context msg x y z
type alias Coordinates =
{ x : Float
, y : Maybe Float
}
type alias Point a =
DataPoint a
type alias RenderDatum =
RenderDatum
type alias AxisDataPoints x a =
AxisDataPoints x a

Debugging

debug : ChartAttribute msg