chart 0.1.4.2 → 0.1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/helpers/chart2_helper.rb +272 -0
- data/app/helpers/chart_helper.rb +0 -304
- data/app/helpers/google_helper.rb +307 -0
- data/app/helpers/highcharts_helper.rb +275 -0
- data/app/helpers/nvd3_helper.rb +460 -0
- data/lib/chart/version.rb +1 -1
- data/vendor/assets/javascripts/chart2.js +9773 -0
- data/vendor/assets/javascripts/google.js +147 -45
- data/vendor/assets/javascripts/nvd3.js +1174 -611
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fafca2b53d328a39184971caf03c9343a53bf37
|
4
|
+
data.tar.gz: d38e6dc0ede6df375e3e88c9ef12c84ffe9bdda6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6304f963423bad868ebb0dd40ddecc32b1643005db8ab92462e983cfc5e4d195fea59cd3866d79630f7e2d49e07bcc41d112f06f1489bc42153a7006644d2c6
|
7
|
+
data.tar.gz: a10f52f04d9007d4bc8a0a552cddeca18efb8d962dd9c7c27e7b4fd09ef0f99496c8b8599461972756d76b70ec7715c963b947c46b7053d6f5d4fe0bdbefd87d
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Chart ships with the following awesome charts:
|
6
6
|
|
7
|
-
* [ChartJS](https://github.com/nnnick/Chart.js/) (1.1.1)
|
7
|
+
* [ChartJS](https://github.com/nnnick/Chart.js/) (1.1.1 & 2.0.1)
|
8
8
|
* [NVD3](https://github.com/novus/nvd3) (1.8.2)
|
9
9
|
* [Google Chart](https://developers.google.com/chart/)
|
10
10
|
* [Highchart](http://www.highcharts.com) (4.2.4)
|
@@ -0,0 +1,272 @@
|
|
1
|
+
module Chart2Helper
|
2
|
+
|
3
|
+
def chart2_bar id=nil, size=nil
|
4
|
+
html = "<canvas id=\"myChart_bar\" width=\"400\" height=\"400\"></canvas>".html_safe
|
5
|
+
script = javascript_tag do
|
6
|
+
<<-END.html_safe
|
7
|
+
var ctx = document.getElementById("myChart_bar");
|
8
|
+
|
9
|
+
var data = {
|
10
|
+
labels: ["January", "February", "March", "April", "May", "June", "July"],
|
11
|
+
datasets: [
|
12
|
+
{
|
13
|
+
label: "My First dataset",
|
14
|
+
backgroundColor: "rgba(255,99,132,0.2)",
|
15
|
+
borderColor: "rgba(255,99,132,1)",
|
16
|
+
borderWidth: 1,
|
17
|
+
hoverBackgroundColor: "rgba(255,99,132,0.4)",
|
18
|
+
hoverBorderColor: "rgba(255,99,132,1)",
|
19
|
+
data: [65, 59, 80, 81, 56, 55, 40],
|
20
|
+
}
|
21
|
+
]
|
22
|
+
};
|
23
|
+
|
24
|
+
var options = {};
|
25
|
+
|
26
|
+
var myBarChart = new Chart(ctx, {
|
27
|
+
type: 'bar',
|
28
|
+
data: data,
|
29
|
+
options: options
|
30
|
+
});
|
31
|
+
|
32
|
+
END
|
33
|
+
end
|
34
|
+
return html + script
|
35
|
+
end
|
36
|
+
|
37
|
+
def chart2_line id=nil, size=nil
|
38
|
+
html = "<canvas id=\"myChart_line\" width=\"400\" height=\"400\"></canvas>".html_safe
|
39
|
+
script = javascript_tag do
|
40
|
+
<<-END.html_safe
|
41
|
+
var ctx = document.getElementById("myChart_line");
|
42
|
+
|
43
|
+
var data = {
|
44
|
+
labels: ["January", "February", "March", "April", "May", "June", "July"],
|
45
|
+
datasets: [
|
46
|
+
{
|
47
|
+
label: "My First dataset",
|
48
|
+
fill: false,
|
49
|
+
lineTension: 0.1,
|
50
|
+
backgroundColor: "rgba(75,192,192,0.4)",
|
51
|
+
borderColor: "rgba(75,192,192,1)",
|
52
|
+
borderCapStyle: 'butt',
|
53
|
+
borderDash: [],
|
54
|
+
borderDashOffset: 0.0,
|
55
|
+
borderJoinStyle: 'miter',
|
56
|
+
pointBorderColor: "rgba(75,192,192,1)",
|
57
|
+
pointBackgroundColor: "#fff",
|
58
|
+
pointBorderWidth: 1,
|
59
|
+
pointHoverRadius: 5,
|
60
|
+
pointHoverBackgroundColor: "rgba(75,192,192,1)",
|
61
|
+
pointHoverBorderColor: "rgba(220,220,220,1)",
|
62
|
+
pointHoverBorderWidth: 2,
|
63
|
+
pointRadius: 1,
|
64
|
+
pointHitRadius: 10,
|
65
|
+
data: [65, 59, 80, 81, 56, 55, 40],
|
66
|
+
}
|
67
|
+
]
|
68
|
+
};
|
69
|
+
|
70
|
+
var options = {};
|
71
|
+
|
72
|
+
var myLineChart = new Chart(ctx, {
|
73
|
+
type: 'line',
|
74
|
+
data: data,
|
75
|
+
options: options
|
76
|
+
});
|
77
|
+
END
|
78
|
+
end
|
79
|
+
return html + script
|
80
|
+
end
|
81
|
+
|
82
|
+
def chart2_radar id=nil, size=nil
|
83
|
+
html = "<div style=\"width: #{size[:width]}px; height: #{size[:height]}px;\"><canvas id=\"myChart_radar_#{id}\" width=\"#{size[:width]}\" height=\"#{size[:height]}\"></canvas></div>".html_safe
|
84
|
+
script = javascript_tag do
|
85
|
+
<<-END.html_safe
|
86
|
+
|
87
|
+
var ctx = document.getElementById("myChart_radar_#{id}");
|
88
|
+
|
89
|
+
var data = {
|
90
|
+
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
|
91
|
+
datasets: [
|
92
|
+
{
|
93
|
+
label: "My First dataset",
|
94
|
+
backgroundColor: "rgba(179,181,198,0.2)",
|
95
|
+
borderColor: "rgba(179,181,198,1)",
|
96
|
+
pointBackgroundColor: "rgba(179,181,198,1)",
|
97
|
+
pointBorderColor: "#fff",
|
98
|
+
pointHoverBackgroundColor: "#fff",
|
99
|
+
pointHoverBorderColor: "rgba(179,181,198,1)",
|
100
|
+
data: [65, 59, 90, 81, 56, 55, 40]
|
101
|
+
},
|
102
|
+
{
|
103
|
+
label: "My Second dataset",
|
104
|
+
backgroundColor: "rgba(255,99,132,0.2)",
|
105
|
+
borderColor: "rgba(255,99,132,1)",
|
106
|
+
pointBackgroundColor: "rgba(255,99,132,1)",
|
107
|
+
pointBorderColor: "#fff",
|
108
|
+
pointHoverBackgroundColor: "#fff",
|
109
|
+
pointHoverBorderColor: "rgba(255,99,132,1)",
|
110
|
+
data: [28, 48, 40, 19, 96, 27, 100]
|
111
|
+
}
|
112
|
+
]
|
113
|
+
};
|
114
|
+
|
115
|
+
var options = {};
|
116
|
+
|
117
|
+
var myRadarChart = new Chart(ctx, {
|
118
|
+
type: 'radar',
|
119
|
+
data: data,
|
120
|
+
options: options
|
121
|
+
});
|
122
|
+
|
123
|
+
END
|
124
|
+
end
|
125
|
+
return html + script
|
126
|
+
end
|
127
|
+
|
128
|
+
def chart2_pie id=nil, size=nil
|
129
|
+
html = "<div style=\"width: #{size[:width]}px; height: #{size[:height]}px;\"><canvas id=\"myChart_pie_#{id}\" width=\"#{size[:width]}\" height=\"#{size[:height]}\"></canvas></div>".html_safe
|
130
|
+
script = javascript_tag do
|
131
|
+
<<-END.html_safe
|
132
|
+
var ctx = document.getElementById("myChart_pie_#{id}");
|
133
|
+
|
134
|
+
var options = {};
|
135
|
+
|
136
|
+
var data = {
|
137
|
+
labels: [
|
138
|
+
"Red",
|
139
|
+
"Green",
|
140
|
+
"Yellow"
|
141
|
+
],
|
142
|
+
datasets: [
|
143
|
+
{
|
144
|
+
data: [300, 50, 100],
|
145
|
+
backgroundColor: [
|
146
|
+
"#FF6384",
|
147
|
+
"#36A2EB",
|
148
|
+
"#FFCE56"
|
149
|
+
],
|
150
|
+
hoverBackgroundColor: [
|
151
|
+
"#FF6384",
|
152
|
+
"#36A2EB",
|
153
|
+
"#FFCE56"
|
154
|
+
]
|
155
|
+
}]
|
156
|
+
};
|
157
|
+
|
158
|
+
|
159
|
+
var options = {};
|
160
|
+
|
161
|
+
var myPieChart = new Chart(ctx, {
|
162
|
+
type: 'pie',
|
163
|
+
data: data,
|
164
|
+
options: options
|
165
|
+
});
|
166
|
+
|
167
|
+
END
|
168
|
+
end
|
169
|
+
return html + script
|
170
|
+
end
|
171
|
+
|
172
|
+
def chart2_donut
|
173
|
+
html = "<canvas id=\"myChart_donut\" width=\"400\" height=\"400\"></canvas>".html_safe
|
174
|
+
script = javascript_tag do
|
175
|
+
<<-END.html_safe
|
176
|
+
var ctx = document.getElementById("myChart_donut");
|
177
|
+
|
178
|
+
var options = {};
|
179
|
+
|
180
|
+
var data = {
|
181
|
+
labels: [
|
182
|
+
"Red",
|
183
|
+
"Green",
|
184
|
+
"Yellow"
|
185
|
+
],
|
186
|
+
datasets: [
|
187
|
+
{
|
188
|
+
data: [300, 50, 100],
|
189
|
+
backgroundColor: [
|
190
|
+
"#FF6384",
|
191
|
+
"#36A2EB",
|
192
|
+
"#FFCE56"
|
193
|
+
],
|
194
|
+
hoverBackgroundColor: [
|
195
|
+
"#FF6384",
|
196
|
+
"#36A2EB",
|
197
|
+
"#FFCE56"
|
198
|
+
]
|
199
|
+
}]
|
200
|
+
};
|
201
|
+
|
202
|
+
|
203
|
+
var options = {};
|
204
|
+
|
205
|
+
var myDonutChart = new Chart(ctx, {
|
206
|
+
type: 'doughnut',
|
207
|
+
data: data,
|
208
|
+
options: options
|
209
|
+
});
|
210
|
+
END
|
211
|
+
end
|
212
|
+
return html + script
|
213
|
+
end
|
214
|
+
|
215
|
+
def chart2_polar_area
|
216
|
+
html = "<canvas id=\"myChart_polarArea\" width=\"400\" height=\"400\"></canvas>".html_safe
|
217
|
+
script = javascript_tag do
|
218
|
+
<<-END.html_safe
|
219
|
+
|
220
|
+
var ctx = document.getElementById("myChart_polarArea");
|
221
|
+
|
222
|
+
var options = {};
|
223
|
+
|
224
|
+
var data = {
|
225
|
+
labels: [
|
226
|
+
"Red",
|
227
|
+
"Green",
|
228
|
+
"Yellow"
|
229
|
+
],
|
230
|
+
datasets: [
|
231
|
+
{
|
232
|
+
data: [300, 50, 100],
|
233
|
+
backgroundColor: [
|
234
|
+
"#FF6384",
|
235
|
+
"#36A2EB",
|
236
|
+
"#FFCE56"
|
237
|
+
],
|
238
|
+
hoverBackgroundColor: [
|
239
|
+
"#FF6384",
|
240
|
+
"#36A2EB",
|
241
|
+
"#FFCE56"
|
242
|
+
]
|
243
|
+
}]
|
244
|
+
};
|
245
|
+
|
246
|
+
|
247
|
+
var options = {};
|
248
|
+
|
249
|
+
var myPolarAreaChart = new Chart(ctx, {
|
250
|
+
type: 'polarArea',
|
251
|
+
data: data,
|
252
|
+
options: options
|
253
|
+
});
|
254
|
+
END
|
255
|
+
end
|
256
|
+
return html + script
|
257
|
+
end
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
# def chart2_scatter
|
264
|
+
# html = "".html_safe
|
265
|
+
# script = javascript_tag do
|
266
|
+
# <<-END.html_safe
|
267
|
+
# END
|
268
|
+
# end
|
269
|
+
# return html + script
|
270
|
+
# end
|
271
|
+
|
272
|
+
end
|
data/app/helpers/chart_helper.rb
CHANGED
@@ -1,309 +1,5 @@
|
|
1
1
|
module ChartHelper
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# Highcharts
|
7
|
-
def hLine
|
8
|
-
html = "<div id=\"container\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>".html_safe
|
9
|
-
script = javascript_tag do
|
10
|
-
<<-END.html_safe
|
11
|
-
$(function () {
|
12
|
-
$('#container').highcharts({
|
13
|
-
title: {
|
14
|
-
text: 'Monthly Average Temperature',
|
15
|
-
x: -20 //center
|
16
|
-
},
|
17
|
-
subtitle: {
|
18
|
-
text: 'Source: WorldClimate.com',
|
19
|
-
x: -20
|
20
|
-
},
|
21
|
-
xAxis: {
|
22
|
-
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
23
|
-
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
24
|
-
},
|
25
|
-
yAxis: {
|
26
|
-
title: {
|
27
|
-
text: 'Temperature (°C)'
|
28
|
-
},
|
29
|
-
plotLines: [{
|
30
|
-
value: 0,
|
31
|
-
width: 1,
|
32
|
-
color: '#808080'
|
33
|
-
}]
|
34
|
-
},
|
35
|
-
tooltip: {
|
36
|
-
valueSuffix: '°C'
|
37
|
-
},
|
38
|
-
legend: {
|
39
|
-
layout: 'vertical',
|
40
|
-
align: 'right',
|
41
|
-
verticalAlign: 'middle',
|
42
|
-
borderWidth: 0
|
43
|
-
},
|
44
|
-
series: [{
|
45
|
-
name: 'Tokyo',
|
46
|
-
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
|
47
|
-
}, {
|
48
|
-
name: 'New York',
|
49
|
-
data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
|
50
|
-
}, {
|
51
|
-
name: 'Berlin',
|
52
|
-
data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
|
53
|
-
}, {
|
54
|
-
name: 'London',
|
55
|
-
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
|
56
|
-
}]
|
57
|
-
});
|
58
|
-
});
|
59
|
-
END
|
60
|
-
end
|
61
|
-
return html + script
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
def hArea
|
66
|
-
html = "<div id=\"container_area\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>".html_safe
|
67
|
-
script = javascript_tag do
|
68
|
-
<<-END.html_safe
|
69
|
-
$(function () {
|
70
|
-
$('#container_area').highcharts({
|
71
|
-
chart: {
|
72
|
-
type: 'area'
|
73
|
-
},
|
74
|
-
title: {
|
75
|
-
text: 'US and USSR nuclear stockpiles'
|
76
|
-
},
|
77
|
-
subtitle: {
|
78
|
-
text: 'Source: <a href="http://thebulletin.metapress.com/content/c4120650912x74k7/fulltext.pdf">' +
|
79
|
-
'thebulletin.metapress.com</a>'
|
80
|
-
},
|
81
|
-
xAxis: {
|
82
|
-
allowDecimals: false,
|
83
|
-
labels: {
|
84
|
-
formatter: function () {
|
85
|
-
return this.value; // clean, unformatted number for year
|
86
|
-
}
|
87
|
-
}
|
88
|
-
},
|
89
|
-
yAxis: {
|
90
|
-
title: {
|
91
|
-
text: 'Nuclear weapon states'
|
92
|
-
},
|
93
|
-
labels: {
|
94
|
-
formatter: function () {
|
95
|
-
return this.value / 1000 + 'k';
|
96
|
-
}
|
97
|
-
}
|
98
|
-
},
|
99
|
-
tooltip: {
|
100
|
-
pointFormat: '{series.name} produced <b>{point.y:,.0f}</b><br/>warheads in {point.x}'
|
101
|
-
},
|
102
|
-
plotOptions: {
|
103
|
-
area: {
|
104
|
-
pointStart: 1940,
|
105
|
-
marker: {
|
106
|
-
enabled: false,
|
107
|
-
symbol: 'circle',
|
108
|
-
radius: 2,
|
109
|
-
states: {
|
110
|
-
hover: {
|
111
|
-
enabled: true
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
116
|
-
},
|
117
|
-
series: [{
|
118
|
-
name: 'USA',
|
119
|
-
data: [null, null, null, null, null, 6, 11, 32, 110, 235, 369, 640,
|
120
|
-
1005, 1436, 2063, 3057, 4618, 6444, 9822, 15468, 20434, 24126,
|
121
|
-
27387, 29459, 31056, 31982, 32040, 31233, 29224, 27342, 26662,
|
122
|
-
26956, 27912, 28999, 28965, 27826, 25579, 25722, 24826, 24605,
|
123
|
-
24304, 23464, 23708, 24099, 24357, 24237, 24401, 24344, 23586,
|
124
|
-
22380, 21004, 17287, 14747, 13076, 12555, 12144, 11009, 10950,
|
125
|
-
10871, 10824, 10577, 10527, 10475, 10421, 10358, 10295, 10104]
|
126
|
-
}, {
|
127
|
-
name: 'USSR/Russia',
|
128
|
-
data: [null, null, null, null, null, null, null, null, null, null,
|
129
|
-
5, 25, 50, 120, 150, 200, 426, 660, 869, 1060, 1605, 2471, 3322,
|
130
|
-
4238, 5221, 6129, 7089, 8339, 9399, 10538, 11643, 13092, 14478,
|
131
|
-
15915, 17385, 19055, 21205, 23044, 25393, 27935, 30062, 32049,
|
132
|
-
33952, 35804, 37431, 39197, 45000, 43000, 41000, 39000, 37000,
|
133
|
-
35000, 33000, 31000, 29000, 27000, 25000, 24000, 23000, 22000,
|
134
|
-
21000, 20000, 19000, 18000, 18000, 17000, 16000]
|
135
|
-
}]
|
136
|
-
});
|
137
|
-
});
|
138
|
-
END
|
139
|
-
end
|
140
|
-
return html + script
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
def hBar
|
145
|
-
html = "<div id=\"container_bar\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>".html_safe
|
146
|
-
script = javascript_tag do
|
147
|
-
<<-END.html_safe
|
148
|
-
$(function () {
|
149
|
-
$('#container_bar').highcharts({
|
150
|
-
chart: {
|
151
|
-
type: 'bar'
|
152
|
-
},
|
153
|
-
title: {
|
154
|
-
text: 'Historic World Population by Region'
|
155
|
-
},
|
156
|
-
subtitle: {
|
157
|
-
text: 'Source: <a href="https://en.wikipedia.org/wiki/World_population">Wikipedia.org</a>'
|
158
|
-
},
|
159
|
-
xAxis: {
|
160
|
-
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
|
161
|
-
title: {
|
162
|
-
text: null
|
163
|
-
}
|
164
|
-
},
|
165
|
-
yAxis: {
|
166
|
-
min: 0,
|
167
|
-
title: {
|
168
|
-
text: 'Population (millions)',
|
169
|
-
align: 'high'
|
170
|
-
},
|
171
|
-
labels: {
|
172
|
-
overflow: 'justify'
|
173
|
-
}
|
174
|
-
},
|
175
|
-
tooltip: {
|
176
|
-
valueSuffix: ' millions'
|
177
|
-
},
|
178
|
-
plotOptions: {
|
179
|
-
bar: {
|
180
|
-
dataLabels: {
|
181
|
-
enabled: true
|
182
|
-
}
|
183
|
-
}
|
184
|
-
},
|
185
|
-
legend: {
|
186
|
-
layout: 'vertical',
|
187
|
-
align: 'right',
|
188
|
-
verticalAlign: 'top',
|
189
|
-
x: -40,
|
190
|
-
y: 80,
|
191
|
-
floating: true,
|
192
|
-
borderWidth: 1,
|
193
|
-
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
|
194
|
-
shadow: true
|
195
|
-
},
|
196
|
-
credits: {
|
197
|
-
enabled: false
|
198
|
-
},
|
199
|
-
series: [{
|
200
|
-
name: 'Year 1800',
|
201
|
-
data: [107, 31, 635, 203, 2]
|
202
|
-
}, {
|
203
|
-
name: 'Year 1900',
|
204
|
-
data: [133, 156, 947, 408, 6]
|
205
|
-
}, {
|
206
|
-
name: 'Year 2012',
|
207
|
-
data: [1052, 954, 4250, 740, 38]
|
208
|
-
}]
|
209
|
-
});
|
210
|
-
});
|
211
|
-
END
|
212
|
-
end
|
213
|
-
return html + script
|
214
|
-
end
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
def hPie
|
221
|
-
html = "<div id=\"container_pie\" style=\"min-width: 310px; height: 400px; margin: 0 auto\"></div>".html_safe
|
222
|
-
script = javascript_tag do
|
223
|
-
<<-END.html_safe
|
224
|
-
$(function () {
|
225
|
-
$('#container_pie').highcharts({
|
226
|
-
chart: {
|
227
|
-
plotBackgroundColor: null,
|
228
|
-
plotBorderWidth: null,
|
229
|
-
plotShadow: false,
|
230
|
-
type: 'pie'
|
231
|
-
},
|
232
|
-
title: {
|
233
|
-
text: 'Browser market shares January, 2015 to May, 2015'
|
234
|
-
},
|
235
|
-
tooltip: {
|
236
|
-
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
237
|
-
},
|
238
|
-
plotOptions: {
|
239
|
-
pie: {
|
240
|
-
allowPointSelect: true,
|
241
|
-
cursor: 'pointer',
|
242
|
-
dataLabels: {
|
243
|
-
enabled: true,
|
244
|
-
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
|
245
|
-
style: {
|
246
|
-
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
|
247
|
-
}
|
248
|
-
}
|
249
|
-
}
|
250
|
-
},
|
251
|
-
series: [{
|
252
|
-
name: 'Brands',
|
253
|
-
colorByPoint: true,
|
254
|
-
data: [{
|
255
|
-
name: 'Microsoft Internet Explorer',
|
256
|
-
y: 56.33
|
257
|
-
}, {
|
258
|
-
name: 'Chrome',
|
259
|
-
y: 24.03,
|
260
|
-
sliced: true,
|
261
|
-
selected: true
|
262
|
-
}, {
|
263
|
-
name: 'Firefox',
|
264
|
-
y: 10.38
|
265
|
-
}, {
|
266
|
-
name: 'Safari',
|
267
|
-
y: 4.77
|
268
|
-
}, {
|
269
|
-
name: 'Opera',
|
270
|
-
y: 0.91
|
271
|
-
}, {
|
272
|
-
name: 'Proprietary or Undetectable',
|
273
|
-
y: 0.2
|
274
|
-
}]
|
275
|
-
}]
|
276
|
-
});
|
277
|
-
});
|
278
|
-
END
|
279
|
-
end
|
280
|
-
return html + script
|
281
|
-
end
|
282
|
-
|
283
|
-
|
284
|
-
#
|
285
|
-
#
|
286
|
-
# Google Chart
|
287
|
-
|
288
|
-
def gBar
|
289
|
-
|
290
|
-
|
291
|
-
end
|
292
|
-
|
293
|
-
|
294
|
-
def gLine
|
295
|
-
|
296
|
-
end
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
#
|
304
|
-
# D3.js related chart
|
305
|
-
#
|
306
|
-
|
307
3
|
def horizontal_grouped_bar id=nil, size=nil, data=nil, options=nil
|
308
4
|
html = "<div style=\"width: #{size[:width]}px; height: #{size[:height]}px;\" id=\"horizontal_grouped_bar_#{id}\"><svg></svg></div>".html_safe
|
309
5
|
script = javascript_tag do
|