This is the line chart module from elm-chart-builder.
⚠ This module is still a work in progress and it has limited funcionality!
Initializes the line chart with the data
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init dataRenders the line chart, after initialisation and customisation
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.renderSets the approximate number of ticks for the horizontal axis
Defaults to Scale.ticks
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setContinousDataTickCount 5
|> Line.renderSets the formatting for ticks for the horizontal axis
Defaults to Scale.tickFormat
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setContinousDataTicks (FormatNumber.format { usLocale | decimals = 0 })
|> Line.renderSet the ticks for the horizontal axis
Defaults to Scale.ticks
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setHorizontalTicks [ 1, 2, 3 ]
|> Line.renderSets the approximate number of ticks for the vertical axis
Defaults to Scale.ticks
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setContinousDataTickCount 5
|> Line.renderSets the formatting for ticks in the vertical axis
Defaults to Scale.tickFormat
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setContinousDataTicks (FormatNumber.format { usLocale | decimals = 0 })
|> Line.renderSet the ticks for the vertical axis
Defaults to Scale.ticks
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setAxisVerticalDataTicks [ 1, 2, 3 ]
|> Line.renderSets an accessible, long-text description for the svg chart. Default value: ""
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setDesc "This is an accessible chart, with a desc element"
|> Line.renderSets margin, width and height all at once Prefer this method from the individual ones when you need to set all three at once.
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
margin =
{ top = 30, right = 20, bottom = 30, left = 0 }
Line.init data
|> Line.setDimensions
{ margin = margin
, width = 400
, height = 400
}
|> Line.renderSets the domain value in the config If not set, the domain is calculated from the data
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setDomain (DomainLinear { horizontal = ( 1, 1 ), vertical = ( 0, 20 ) })
|> Line.renderSets the outer height of the line chart Default value: 400
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setHeight 600
|> Line.renderSets the margin values in the config
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
margin =
{ top = 30, right = 20, bottom = 30, left = 0 }
Line.init data
|> Line.setMargin margin
|> Line.renderSets the showHorizontalAxis boolean value in the config Default value: True This shows the bar's horizontal axis
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Bar.setShowHorizontalAxis False
|> Bar.renderSets the showVerticalAxis boolean value in the config Default value: True This shows the bar's vertical axis
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Bar.setShowVerticalAxis False
|> Bar.renderSets an accessible title for the svg chart. Default value: ""
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setTitle "This is a chart"
|> Line.renderSets the outer width of the line chart Default value: 400
data : List DataGroupLinear
data =
[ { groupLabel = Nothing
, points = [ ( 1, 10 ), (2, 20) ]
}
]
Line.init data
|> Line.setWidth 600
|> Line.renderDomainLinear constructor
dummyDomainBandStruct : DomainBandStruct
dummyDomainBandStruct =
{ bandGroup = []
, bandSingle = []
, linear = ( 0, 0 )
}
domain : Domain
domain =
domainBand dummyDomainBandStructDomain Type For line charts this can only be of DomainLinear type (For now, DomainTime coming soon...)
Line chart data format.