highcharts_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +106 -0
- data/Rakefile +6 -0
- data/highcharts_rails.gemspec +27 -0
- data/lib/highcharts_rails/version.rb +3 -0
- data/lib/highcharts_rails.rb +8 -0
- data/vendor/assets/javascripts/highcharts-3d.src.js +2139 -0
- data/vendor/assets/javascripts/highcharts-more.src.js +2982 -0
- data/vendor/assets/javascripts/highcharts.src.js +22947 -0
- data/vendor/assets/javascripts/js/highcharts-3d.src.js +2085 -0
- data/vendor/assets/javascripts/js/highcharts-more.src.js +2820 -0
- data/vendor/assets/javascripts/js/highcharts.src.js +20917 -0
- data/vendor/assets/javascripts/js/modules/accessibility.src.js +1072 -0
- data/vendor/assets/javascripts/js/modules/annotations.src.js +408 -0
- data/vendor/assets/javascripts/js/modules/boost.src.js +652 -0
- data/vendor/assets/javascripts/js/modules/broken-axis.src.js +338 -0
- data/vendor/assets/javascripts/js/modules/data.src.js +981 -0
- data/vendor/assets/javascripts/js/modules/drilldown.src.js +756 -0
- data/vendor/assets/javascripts/js/modules/exporting.src.js +953 -0
- data/vendor/assets/javascripts/js/modules/funnel.src.js +290 -0
- data/vendor/assets/javascripts/js/modules/gantt.src.js +791 -0
- data/vendor/assets/javascripts/js/modules/grid-axis.src.js +545 -0
- data/vendor/assets/javascripts/js/modules/heatmap.src.js +798 -0
- data/vendor/assets/javascripts/js/modules/no-data-to-display.src.js +150 -0
- data/vendor/assets/javascripts/js/modules/offline-exporting.src.js +492 -0
- data/vendor/assets/javascripts/js/modules/overlapping-datalabels.src.js +164 -0
- data/vendor/assets/javascripts/js/modules/series-label.src.js +606 -0
- data/vendor/assets/javascripts/js/modules/solid-gauge.src.js +305 -0
- data/vendor/assets/javascripts/js/modules/treemap.src.js +881 -0
- data/vendor/assets/javascripts/js/modules/xrange-series.src.js +254 -0
- data/vendor/assets/javascripts/js/themes/dark-blue.js +317 -0
- data/vendor/assets/javascripts/js/themes/dark-green.js +314 -0
- data/vendor/assets/javascripts/js/themes/dark-unica.js +243 -0
- data/vendor/assets/javascripts/js/themes/gray.js +326 -0
- data/vendor/assets/javascripts/js/themes/grid-light.js +99 -0
- data/vendor/assets/javascripts/js/themes/grid.js +131 -0
- data/vendor/assets/javascripts/js/themes/sand-signika.js +129 -0
- data/vendor/assets/javascripts/js/themes/skies.js +112 -0
- data/vendor/assets/javascripts/lib/canvg.src.js +3073 -0
- data/vendor/assets/javascripts/lib/jspdf.src.js +3031 -0
- data/vendor/assets/javascripts/lib/rgbcolor.src.js +299 -0
- data/vendor/assets/javascripts/lib/svg2pdf.src.js +1451 -0
- data/vendor/assets/javascripts/modules/accessibility.src.js +1072 -0
- data/vendor/assets/javascripts/modules/annotations.src.js +408 -0
- data/vendor/assets/javascripts/modules/boost.src.js +652 -0
- data/vendor/assets/javascripts/modules/broken-axis.src.js +338 -0
- data/vendor/assets/javascripts/modules/data.src.js +981 -0
- data/vendor/assets/javascripts/modules/drilldown.src.js +797 -0
- data/vendor/assets/javascripts/modules/exporting.src.js +882 -0
- data/vendor/assets/javascripts/modules/funnel.src.js +304 -0
- data/vendor/assets/javascripts/modules/gantt.src.js +815 -0
- data/vendor/assets/javascripts/modules/grid-axis.src.js +547 -0
- data/vendor/assets/javascripts/modules/heatmap.src.js +810 -0
- data/vendor/assets/javascripts/modules/no-data-to-display.src.js +161 -0
- data/vendor/assets/javascripts/modules/offline-exporting.src.js +492 -0
- data/vendor/assets/javascripts/modules/overlapping-datalabels.src.js +164 -0
- data/vendor/assets/javascripts/modules/series-label.src.js +606 -0
- data/vendor/assets/javascripts/modules/solid-gauge.src.js +316 -0
- data/vendor/assets/javascripts/modules/treemap.src.js +935 -0
- data/vendor/assets/javascripts/modules/xrange-series.src.js +276 -0
- data/vendor/assets/javascripts/themes/dark-blue.js +317 -0
- data/vendor/assets/javascripts/themes/dark-green.js +314 -0
- data/vendor/assets/javascripts/themes/dark-unica.js +243 -0
- data/vendor/assets/javascripts/themes/gray.js +326 -0
- data/vendor/assets/javascripts/themes/grid-light.js +99 -0
- data/vendor/assets/javascripts/themes/grid.js +131 -0
- data/vendor/assets/javascripts/themes/sand-signika.js +129 -0
- data/vendor/assets/javascripts/themes/skies.js +112 -0
- data/vendor/assets/stylesheets/highcharts.scss +610 -0
- metadata +161 -0
@@ -0,0 +1,304 @@
|
|
1
|
+
/**
|
2
|
+
* @license Highcharts JS v5.0.6 (2016-12-07)
|
3
|
+
* Highcharts funnel module
|
4
|
+
*
|
5
|
+
* (c) 2010-2016 Torstein Honsi
|
6
|
+
*
|
7
|
+
* License: www.highcharts.com/license
|
8
|
+
*/
|
9
|
+
(function(factory) {
|
10
|
+
if (typeof module === 'object' && module.exports) {
|
11
|
+
module.exports = factory;
|
12
|
+
} else {
|
13
|
+
factory(Highcharts);
|
14
|
+
}
|
15
|
+
}(function(Highcharts) {
|
16
|
+
(function(Highcharts) {
|
17
|
+
/**
|
18
|
+
* Highcharts funnel module
|
19
|
+
*
|
20
|
+
* (c) 2010-2016 Torstein Honsi
|
21
|
+
*
|
22
|
+
* License: www.highcharts.com/license
|
23
|
+
*/
|
24
|
+
/* eslint indent:0 */
|
25
|
+
'use strict';
|
26
|
+
|
27
|
+
// create shortcuts
|
28
|
+
var seriesType = Highcharts.seriesType,
|
29
|
+
seriesTypes = Highcharts.seriesTypes,
|
30
|
+
noop = Highcharts.noop,
|
31
|
+
each = Highcharts.each;
|
32
|
+
|
33
|
+
|
34
|
+
seriesType('funnel', 'pie', {
|
35
|
+
animation: false,
|
36
|
+
center: ['50%', '50%'],
|
37
|
+
width: '90%',
|
38
|
+
neckWidth: '30%',
|
39
|
+
height: '100%',
|
40
|
+
neckHeight: '25%',
|
41
|
+
reversed: false,
|
42
|
+
size: true, // to avoid adapting to data label size in Pie.drawDataLabels
|
43
|
+
|
44
|
+
|
45
|
+
// Presentational
|
46
|
+
dataLabels: {
|
47
|
+
//position: 'right',
|
48
|
+
connectorWidth: 1
|
49
|
+
//connectorColor: null
|
50
|
+
},
|
51
|
+
states: {
|
52
|
+
select: {
|
53
|
+
color: '#cccccc',
|
54
|
+
borderColor: '#000000',
|
55
|
+
shadow: false
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
},
|
60
|
+
|
61
|
+
// Properties
|
62
|
+
{
|
63
|
+
animate: noop,
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Overrides the pie translate method
|
67
|
+
*/
|
68
|
+
translate: function() {
|
69
|
+
|
70
|
+
var
|
71
|
+
// Get positions - either an integer or a percentage string must be given
|
72
|
+
getLength = function(length, relativeTo) {
|
73
|
+
return (/%$/).test(length) ?
|
74
|
+
relativeTo * parseInt(length, 10) / 100 :
|
75
|
+
parseInt(length, 10);
|
76
|
+
},
|
77
|
+
|
78
|
+
sum = 0,
|
79
|
+
series = this,
|
80
|
+
chart = series.chart,
|
81
|
+
options = series.options,
|
82
|
+
reversed = options.reversed,
|
83
|
+
ignoreHiddenPoint = options.ignoreHiddenPoint,
|
84
|
+
plotWidth = chart.plotWidth,
|
85
|
+
plotHeight = chart.plotHeight,
|
86
|
+
cumulative = 0, // start at top
|
87
|
+
center = options.center,
|
88
|
+
centerX = getLength(center[0], plotWidth),
|
89
|
+
centerY = getLength(center[1], plotHeight),
|
90
|
+
width = getLength(options.width, plotWidth),
|
91
|
+
tempWidth,
|
92
|
+
getWidthAt,
|
93
|
+
height = getLength(options.height, plotHeight),
|
94
|
+
neckWidth = getLength(options.neckWidth, plotWidth),
|
95
|
+
neckHeight = getLength(options.neckHeight, plotHeight),
|
96
|
+
neckY = (centerY - height / 2) + height - neckHeight,
|
97
|
+
data = series.data,
|
98
|
+
path,
|
99
|
+
fraction,
|
100
|
+
half = options.dataLabels.position === 'left' ? 1 : 0,
|
101
|
+
|
102
|
+
x1,
|
103
|
+
y1,
|
104
|
+
x2,
|
105
|
+
x3,
|
106
|
+
y3,
|
107
|
+
x4,
|
108
|
+
y5;
|
109
|
+
|
110
|
+
// Return the width at a specific y coordinate
|
111
|
+
series.getWidthAt = getWidthAt = function(y) {
|
112
|
+
var top = (centerY - height / 2);
|
113
|
+
|
114
|
+
return y > neckY || height === neckHeight ?
|
115
|
+
neckWidth :
|
116
|
+
neckWidth + (width - neckWidth) * (1 - (y - top) / (height - neckHeight));
|
117
|
+
};
|
118
|
+
series.getX = function(y, half) {
|
119
|
+
return centerX + (half ? -1 : 1) * ((getWidthAt(reversed ? 2 * centerY - y : y) / 2) + options.dataLabels.distance);
|
120
|
+
};
|
121
|
+
|
122
|
+
// Expose
|
123
|
+
series.center = [centerX, centerY, height];
|
124
|
+
series.centerX = centerX;
|
125
|
+
|
126
|
+
/*
|
127
|
+
* Individual point coordinate naming:
|
128
|
+
*
|
129
|
+
* x1,y1 _________________ x2,y1
|
130
|
+
* \ /
|
131
|
+
* \ /
|
132
|
+
* \ /
|
133
|
+
* \ /
|
134
|
+
* \ /
|
135
|
+
* x3,y3 _________ x4,y3
|
136
|
+
*
|
137
|
+
* Additional for the base of the neck:
|
138
|
+
*
|
139
|
+
* | |
|
140
|
+
* | |
|
141
|
+
* | |
|
142
|
+
* x3,y5 _________ x4,y5
|
143
|
+
*/
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
// get the total sum
|
149
|
+
each(data, function(point) {
|
150
|
+
if (!ignoreHiddenPoint || point.visible !== false) {
|
151
|
+
sum += point.y;
|
152
|
+
}
|
153
|
+
});
|
154
|
+
|
155
|
+
each(data, function(point) {
|
156
|
+
// set start and end positions
|
157
|
+
y5 = null;
|
158
|
+
fraction = sum ? point.y / sum : 0;
|
159
|
+
y1 = centerY - height / 2 + cumulative * height;
|
160
|
+
y3 = y1 + fraction * height;
|
161
|
+
//tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight));
|
162
|
+
tempWidth = getWidthAt(y1);
|
163
|
+
x1 = centerX - tempWidth / 2;
|
164
|
+
x2 = x1 + tempWidth;
|
165
|
+
tempWidth = getWidthAt(y3);
|
166
|
+
x3 = centerX - tempWidth / 2;
|
167
|
+
x4 = x3 + tempWidth;
|
168
|
+
|
169
|
+
// the entire point is within the neck
|
170
|
+
if (y1 > neckY) {
|
171
|
+
x1 = x3 = centerX - neckWidth / 2;
|
172
|
+
x2 = x4 = centerX + neckWidth / 2;
|
173
|
+
|
174
|
+
// the base of the neck
|
175
|
+
} else if (y3 > neckY) {
|
176
|
+
y5 = y3;
|
177
|
+
|
178
|
+
tempWidth = getWidthAt(neckY);
|
179
|
+
x3 = centerX - tempWidth / 2;
|
180
|
+
x4 = x3 + tempWidth;
|
181
|
+
|
182
|
+
y3 = neckY;
|
183
|
+
}
|
184
|
+
|
185
|
+
if (reversed) {
|
186
|
+
y1 = 2 * centerY - y1;
|
187
|
+
y3 = 2 * centerY - y3;
|
188
|
+
y5 = (y5 ? 2 * centerY - y5 : null);
|
189
|
+
}
|
190
|
+
// save the path
|
191
|
+
path = [
|
192
|
+
'M',
|
193
|
+
x1, y1,
|
194
|
+
'L',
|
195
|
+
x2, y1,
|
196
|
+
x4, y3
|
197
|
+
];
|
198
|
+
if (y5) {
|
199
|
+
path.push(x4, y5, x3, y5);
|
200
|
+
}
|
201
|
+
path.push(x3, y3, 'Z');
|
202
|
+
|
203
|
+
// prepare for using shared dr
|
204
|
+
point.shapeType = 'path';
|
205
|
+
point.shapeArgs = {
|
206
|
+
d: path
|
207
|
+
};
|
208
|
+
|
209
|
+
|
210
|
+
// for tooltips and data labels
|
211
|
+
point.percentage = fraction * 100;
|
212
|
+
point.plotX = centerX;
|
213
|
+
point.plotY = (y1 + (y5 || y3)) / 2;
|
214
|
+
|
215
|
+
// Placement of tooltips and data labels
|
216
|
+
point.tooltipPos = [
|
217
|
+
centerX,
|
218
|
+
point.plotY
|
219
|
+
];
|
220
|
+
|
221
|
+
// Slice is a noop on funnel points
|
222
|
+
point.slice = noop;
|
223
|
+
|
224
|
+
// Mimicking pie data label placement logic
|
225
|
+
point.half = half;
|
226
|
+
|
227
|
+
if (!ignoreHiddenPoint || point.visible !== false) {
|
228
|
+
cumulative += fraction;
|
229
|
+
}
|
230
|
+
});
|
231
|
+
},
|
232
|
+
/**
|
233
|
+
* Draw a single point (wedge)
|
234
|
+
* @param {Object} point The point object
|
235
|
+
* @param {Object} color The color of the point
|
236
|
+
* @param {Number} brightness The brightness relative to the color
|
237
|
+
*/
|
238
|
+
drawPoints: seriesTypes.column.prototype.drawPoints,
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Funnel items don't have angles (#2289)
|
242
|
+
*/
|
243
|
+
sortByAngle: function(points) {
|
244
|
+
points.sort(function(a, b) {
|
245
|
+
return a.plotY - b.plotY;
|
246
|
+
});
|
247
|
+
},
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Extend the pie data label method
|
251
|
+
*/
|
252
|
+
drawDataLabels: function() {
|
253
|
+
var data = this.data,
|
254
|
+
labelDistance = this.options.dataLabels.distance,
|
255
|
+
leftSide,
|
256
|
+
sign,
|
257
|
+
point,
|
258
|
+
i = data.length,
|
259
|
+
x,
|
260
|
+
y;
|
261
|
+
|
262
|
+
// In the original pie label anticollision logic, the slots are distributed
|
263
|
+
// from one labelDistance above to one labelDistance below the pie. In funnels
|
264
|
+
// we don't want this.
|
265
|
+
this.center[2] -= 2 * labelDistance;
|
266
|
+
|
267
|
+
// Set the label position array for each point.
|
268
|
+
while (i--) {
|
269
|
+
point = data[i];
|
270
|
+
leftSide = point.half;
|
271
|
+
sign = leftSide ? 1 : -1;
|
272
|
+
y = point.plotY;
|
273
|
+
x = this.getX(y, leftSide);
|
274
|
+
|
275
|
+
// set the anchor point for data labels
|
276
|
+
point.labelPos = [
|
277
|
+
0, // first break of connector
|
278
|
+
y, // a/a
|
279
|
+
x + (labelDistance - 5) * sign, // second break, right outside point shape
|
280
|
+
y, // a/a
|
281
|
+
x + labelDistance * sign, // landing point for connector
|
282
|
+
y, // a/a
|
283
|
+
leftSide ? 'right' : 'left', // alignment
|
284
|
+
0 // center angle
|
285
|
+
];
|
286
|
+
}
|
287
|
+
|
288
|
+
seriesTypes.pie.prototype.drawDataLabels.call(this);
|
289
|
+
}
|
290
|
+
|
291
|
+
});
|
292
|
+
|
293
|
+
/**
|
294
|
+
* Pyramid series type.
|
295
|
+
* A pyramid series is a special type of funnel, without neck and reversed by default.
|
296
|
+
*/
|
297
|
+
seriesType('pyramid', 'funnel', {
|
298
|
+
neckWidth: '0%',
|
299
|
+
neckHeight: '0%',
|
300
|
+
reversed: true
|
301
|
+
});
|
302
|
+
|
303
|
+
}(Highcharts));
|
304
|
+
}));
|