/
Example1.elm
92 lines (72 loc) · 1.82 KB
/
Example1.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
module Docs.Legends.Example1 exposing (main)
import Html
import LineChart
import LineChart.Colors as Colors
import LineChart.Junk as Junk
import LineChart.Area as Area
import LineChart.Axis as Axis
import LineChart.Junk as Junk
import LineChart.Dots as Dots
import LineChart.Grid as Grid
import LineChart.Dots as Dots
import LineChart.Line as Line
import LineChart.Colors as Colors
import LineChart.Events as Events
import LineChart.Legends as Legends
import LineChart.Container as Container
import LineChart.Interpolation as Interpolation
import LineChart.Axis.Intersection as Intersection
main : Html.Html msg
main =
chart
chart : Html.Html msg
chart =
LineChart.viewCustom
{ x = Axis.default 700 "Age" .age
, y = Axis.default 400 "Income" .income
, container = Container.default "line-chart-1"
, interpolation = Interpolation.default
, intersection = Intersection.default
, legends = Legends.byEnding (Junk.label Colors.black)
, events = Events.default
, junk = Junk.default
, grid = Grid.default
, area = Area.default
, line = Line.default
, dots = Dots.default
}
[ LineChart.line Colors.blueLight Dots.square "Chuck" chuck
, LineChart.line Colors.pinkLight Dots.plus "Alice" alice
, LineChart.line Colors.goldLight Dots.diamond "Bobby" bobby
]
-- DATA
type alias Data =
{ age : Float
, weight : Float
, height : Float
, income : Float
}
alice : List Data
alice =
[ Data 4 24 0.94 0
, Data 25 75 1.73 25000
, Data 43 83 1.75 40000
]
bobby : List Data
bobby =
[ Data 4 22 1.01 0
, Data 25 75 1.87 28000
, Data 43 77 1.87 52000
]
chuck : List Data
chuck =
[ Data 4 21 0.98 0
, Data 25 89 1.83 85000
, Data 43 95 1.84 120000
]
average : List Data
average =
[ Data 4 22.3 1.0 0
, Data 25 79.7 1.8 46000
, Data 43 85 1.82 70667
]