georgesboris/elm-widgets-charts-alpha/4.0.5

NOTE: the latest version is 9.2.2

W.Chart

Setup

globalStyles : Svg msg
fromX : List (ChartAttribute msg) -> { x : AxisConfigX x } -> ConfigX msg x
List (ChartAttribute msg)
-> { x : AxisConfigX x
, y : AxisConfigYZ x y
}
-> ConfigXY msg x y
List (ChartAttribute msg)
-> { x : AxisConfigX x
, y : AxisConfigYZ x y
, z : AxisConfigYZ 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
-> { data : List x
, toLabel : x -> String
}
-> AxisConfigX x
List AxisAttribute
-> { label : String
, color : String
, toValue : x -> Maybe Float
}
-> AxisConfigYZ x String
List AxisAttribute
-> { data : List a
, toLabel : a -> String
, toColor : a -> String
, toValue : a -> x -> Maybe Float
}
-> AxisConfigYZ x a

Axis Attributes

axisLabel : String -> AxisAttribute
defaultValue : Float -> AxisAttribute
format : (Float -> String) -> AxisAttribute
noAxisLine : AxisAttribute
noGridLines : AxisAttribute
safety : Float -> AxisAttribute
stacked : AxisAttribute
distribution : AxisAttribute
ticks : Int -> AxisAttribute
type alias AxisAttribute =
Attr AxisAttributes

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
{ 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)
}

Helpful Types

type alias Context x y z =
Context 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