rickshaw-demo.js
3.22 KB
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
93
94
95
96
97
98
99
100
101
102
103
$(function() {
var graph = new Rickshaw.Graph( {
element: document.querySelector("#chart"),
series: [{
color: '#1ab394',
data: [
{ x: 0, y: 40 },
{ x: 1, y: 49 },
{ x: 2, y: 38 },
{ x: 3, y: 30 },
{ x: 4, y: 32 } ]
}]
});
graph.render();
var graph2 = new Rickshaw.Graph( {
element: document.querySelector("#rickshaw_multi"),
renderer: 'area',
stroke: true,
series: [ {
data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 20 }, { x: 4, y: 16 } ],
color: '#1ab394',
stroke: '#17997f'
}, {
data: [ { x: 0, y: 22 }, { x: 1, y: 25 }, { x: 2, y: 38 }, { x: 3, y: 44 }, { x: 4, y: 46 } ],
color: '#eeeeee',
stroke: '#d7d7d7'
} ]
} );
graph2.renderer.unstack = true;
graph2.render();
var graph3 = new Rickshaw.Graph({
element: document.querySelector("#rickshaw_line"),
renderer: 'line',
series: [ {
data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
color: '#1ab394'
} ]
} );
graph3.render();
var graph4 = new Rickshaw.Graph({
element: document.querySelector("#rickshaw_multi_line"),
renderer: 'line',
series: [{
data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
color: '#1ab394'
}, {
data: [ { x: 0, y: 20 }, { x: 1, y: 24 }, { x: 2, y: 19 }, { x: 3, y: 15 }, { x: 4, y: 16 } ],
color: '#d7d7d7'
}]
});
graph4.render();
var graph5 = new Rickshaw.Graph( {
element: document.querySelector("#rickshaw_bars"),
renderer: 'bar',
series: [ {
data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
color: '#1ab394'
} ]
} );
graph5.render();
var graph6 = new Rickshaw.Graph( {
element: document.querySelector("#rickshaw_bars_stacked"),
renderer: 'bar',
series: [
{
data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
color: '#1ab394'
}, {
data: [ { x: 0, y: 20 }, { x: 1, y: 24 }, { x: 2, y: 19 }, { x: 3, y: 15 }, { x: 4, y: 16 } ],
color: '#d7d7d7'
} ]
} );
graph6.render();
var graph7 = new Rickshaw.Graph( {
element: document.querySelector("#rickshaw_scatterplot"),
renderer: 'scatterplot',
stroke: true,
padding: { top: 0.05, left: 0.05, right: 0.05 },
series: [ {
data: [ { x: 0, y: 15 },
{ x: 1, y: 18 },
{ x: 2, y: 10 },
{ x: 3, y: 12 },
{ x: 4, y: 15 },
{ x: 5, y: 24 },
{ x: 6, y: 28 },
{ x: 7, y: 31 },
{ x: 8, y: 22 },
{ x: 9, y: 18 },
{ x: 10, y: 16 }
],
color: '#1ab394'
} ]
} );
graph7.render();
});