highcharts-rails 4.2.7 → 5.0.0

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