terezka/charts/18.0.0

NOTE: the latest version is 20.0.1

Chart.Attributes

This module contains attributes for editing elements in Chart and Chart.Svg. See Chart for usage examples.

Often a single attribute can change several different configurations, so the categories below are only guiding.

type alias Attribute c =
c -> c

Container

width : Float -> { a | width : Float } -> { a | width : Float }
height : Float -> { a | height : Float } -> { a | height : Float }
attrs : a -> { x | attrs : a } -> { x | attrs : a }
htmlAttrs : a -> { x | htmlAttrs : a } -> { x | htmlAttrs : a }
events : x -> { a | events : x } -> { a | events : x }
margin : x -> { a | margin : x } -> { a | margin : x }
padding : x -> { a | padding : x } -> { a | padding : x }

Limits

range : x -> { a | range : x } -> { a | range : x }
domain : x -> { a | domain : x } -> { a | domain : x }
limits : x -> { a | limits : x } -> { a | limits : x }
lowest : Float -> (Float -> Float -> Float -> Float) -> Axis -> Axis

Change the lower bound of an axis.

CA.lowest -5 CA.orLower initial  -- { initial | min = -5, max = 10 }
CA.lowest -5 CA.orHigher initial -- { initial | min = 0, max = 10 }
CA.lowest 2 CA.exactly initial   -- { initial | min = 2, max = 10 }
CA.lowest 2 CA.less initial   -- { initial | min = -2, max = 10 }
CA.lowest 3 CA.more initial   -- { initial | min = 3, max = 10 }

where

initial : Chart.Svg.Axis
initial =
  { .. | min = 0, max = 10 }
highest : Float -> (Float -> Float -> Float -> Float) -> Axis -> Axis

Same as lowest, but changes upper bound.

orLower : Float -> Float -> Float -> Float

See lowest for usage examples.

orHigher : Float -> Float -> Float -> Float

See lowest for usage examples.

exactly : Float -> Float -> Float -> Float

See lowest for usage examples.

more : Float -> Float -> Float -> Float

See lowest for usage examples.

less : Float -> Float -> Float -> Float

See lowest for usage examples.

window : Float -> Float -> Axis -> Axis

Set an axis to an exact window.

CA.window 2 5 initial   -- { initial | min = 2, max = 5 }

where

initial : Axis
initial =
  { .. | min = 0, max = 10 }
likeData : Axis -> Axis

Resets axis to fit data bounds.

zoom : Float -> Axis -> Axis

Zoom with a certain percentage.

CA.range [ CA.zoom 150 ]
move : Float -> Axis -> Axis

Offset entire range.

CA.move 5 initial   -- { initial | min = 5, max = 15 }

where

initial : Axis
initial =
  { .. | min = 0, max = 10 }
centerAt : Float -> Axis -> Axis

Center range/domain at certain point.

CA.centerAt 20 initial -- { initial | min = -30, max = 70 }

where

initial : Axis
initial =
  { .. | min = 0, max = 100 }
pad : Float -> Float -> Axis -> Axis

Add padding (in px) to range/domain.

CA.range [ CA.pad 5 10 ]
zero : Axis -> Float

Given an axis, find the value within it closest to zero.

CA.zero { dataMin = 0, dataMax = 10, min = 2, max = 5 } -- 2
CA.zero { dataMin = 0, dataMax = 10, min = -5, max = 5 } -- 0
CA.zero { dataMin = 0, dataMax = 10, min = -5, max = -2 } -- -2
middle : Axis -> Float

Get the middle value of your axis.

percent : Float -> Axis -> Float

Get the value at a certain percentage of the length of your axis.

Labels

fontSize : Int -> { a | fontSize : Maybe Int } -> { a | fontSize : Maybe Int }
uppercase : { a | uppercase : Bool } -> { a | uppercase : Bool }
format : x -> { a | format : Maybe x } -> { a | format : Maybe x }
position : x -> { a | position : x } -> { a | position : x }
alignLeft : { a | anchor : Maybe Anchor } -> { a | anchor : Maybe Anchor }
alignRight : { a | anchor : Maybe Anchor } -> { a | anchor : Maybe Anchor }
alignMiddle : { a | anchor : Maybe Anchor } -> { a | anchor : Maybe Anchor }
Float
-> Float
-> { a
| ellipsis :
Maybe
{ height : Float
, width : Float
}
}
-> { a
| ellipsis :
Maybe
{ height : Float
, width : Float
}
}

Note: There is no SVG feature for ellipsis, so this turns labels into HTML.

Axis

amount : Int -> { a | amount : Int } -> { a | amount : Int }
flip : { a | flip : Bool } -> { a | flip : Bool }
pinned : x -> { a | pinned : x } -> { a | pinned : x }
ints : { a | generate : TickType } -> { a | generate : TickType }
times : Zone -> { a | generate : TickType } -> { a | generate : TickType }

Coordinates

x : Float -> { a | x : Float } -> { a | x : Float }
y : Float -> { a | y : Float } -> { a | y : Float }
x1 : x -> { a | x1 : Maybe x } -> { a | x1 : Maybe x }
y1 : Float -> { a | y1 : Maybe Float } -> { a | y1 : Maybe Float }
x2 : x -> { a | x2 : Maybe x } -> { a | x2 : Maybe x }
y2 : Float -> { a | y2 : Maybe Float } -> { a | y2 : Maybe Float }
x2Svg : x -> { a | x2Svg : Maybe x } -> { a | x2Svg : Maybe x }
y2Svg : x -> { a | y2Svg : Maybe x } -> { a | y2Svg : Maybe x }
length : Float -> { a | length : Float } -> { a | length : Float }
moveLeft : Float -> { a | xOff : Float } -> { a | xOff : Float }
moveRight : Float -> { a | xOff : Float } -> { a | xOff : Float }
moveUp : Float -> { a | yOff : Float } -> { a | yOff : Float }
moveDown : Float -> { a | yOff : Float } -> { a | yOff : Float }

Decoration

border : String -> { a | border : String } -> { a | border : String }
borderWidth : Float -> { a | borderWidth : Float } -> { a | borderWidth : Float }
color : String -> { a | color : String } -> { a | color : String }
opacity : Float -> { a | opacity : Float } -> { a | opacity : Float }
highlight : Float -> { a | highlight : Float } -> { a | highlight : Float }
Float
-> { a | highlightWidth : Float }
-> { a | highlightWidth : Float }
String
-> { a | highlightColor : String }
-> { a | highlightColor : String }
String
-> { a | background : String }
-> { a | background : String }
noArrow : { a | arrow : Bool } -> { a | arrow : Bool }
rotate : Float -> { a | rotate : Float } -> { a | rotate : Float }
List (Attribute Pattern)
-> { a | design : Maybe Design, opacity : Float }
-> { a | design : Maybe Design, opacity : Float }
List (Attribute Pattern)
-> { a | design : Maybe Design, opacity : Float }
-> { a | design : Maybe Design, opacity : Float }
List String
-> { a | design : Maybe Design, opacity : Float }
-> { a | design : Maybe Design, opacity : Float }

Bar

ungroup : { a | grouped : Bool } -> { a | grouped : Bool }
roundTop : Float -> { a | roundTop : Float } -> { a | roundTop : Float }
roundBottom : Float -> { a | roundBottom : Float } -> { a | roundBottom : Float }
spacing : Float -> { a | spacing : Float } -> { a | spacing : Float }

Lines

Float
-> { a | area : Float, method : Maybe Method }
-> { a | area : Float, method : Maybe Method }
size : Float -> { a | size : Float } -> { a | size : Float }
dashed : x -> { a | dashed : x } -> { a | dashed : x }
break : { a | break : Bool } -> { a | break : Bool }
tickLength : Float -> { a | tickLength : Float } -> { a | tickLength : Float }
Float
-> { a | tickDirection : Float }
-> { a | tickDirection : Float }
linear : { a | method : Maybe Method } -> { a | method : Maybe Method }
monotone : { a | method : Maybe Method } -> { a | method : Maybe Method }
stepped : { a | method : Maybe Method } -> { a | method : Maybe Method }
circle : { a | shape : Maybe Shape } -> { a | shape : Maybe Shape }
triangle : { a | shape : Maybe Shape } -> { a | shape : Maybe Shape }
square : { a | shape : Maybe Shape } -> { a | shape : Maybe Shape }
diamond : { a | shape : Maybe Shape } -> { a | shape : Maybe Shape }
plus : { a | shape : Maybe Shape } -> { a | shape : Maybe Shape }
cross : { a | shape : Maybe Shape } -> { a | shape : Maybe Shape }

Tooltip

{ a | direction : Maybe Direction }
-> { a | direction : Maybe Direction }
{ a | direction : Maybe Direction }
-> { a | direction : Maybe Direction }
{ a | direction : Maybe Direction }
-> { a | direction : Maybe Direction }
{ a | direction : Maybe Direction }
-> { a | direction : Maybe Direction }
{ a | direction : Maybe Direction }
-> { a | direction : Maybe Direction }
{ a | direction : Maybe Direction }
-> { a | direction : Maybe Direction }
offset : Float -> { a | offset : Float } -> { a | offset : Float }
(Position -> Position)
-> { a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
top :
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }
{ a | focal : Maybe (Position -> Position) }
-> { a | focal : Maybe (Position -> Position) }

Legends

title : x -> { a | title : x } -> { a | title : x }
row : { a | alignment : Alignment } -> { a | alignment : Alignment }
column : { a | alignment : Alignment } -> { a | alignment : Alignment }

Grid

noGrid : { a | grid : Bool } -> { a | grid : Bool }
withGrid : { a | grid : Bool } -> { a | grid : Bool }
dotGrid : { a | dotGrid : Bool } -> { a | dotGrid : Bool }

Colors

pink : String
purple : String
blue : String
green : String
orange : String
turquoise : String
red : String
magenta : String
brown : String
mint : String
yellow : String
gray : String
darkYellow : String
darkBlue : String
darkGray : String
labelGray : String