highcharts-rails 5.0.14 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +60 -0
  3. data/Rakefile +54 -5
  4. data/app/assets/images/highcharts/earth.svg +432 -0
  5. data/app/assets/javascripts/highcharts.js +5103 -3147
  6. data/app/assets/javascripts/highcharts/highcharts-3d.js +930 -277
  7. data/app/assets/javascripts/highcharts/highcharts-more.js +1374 -249
  8. data/app/assets/javascripts/highcharts/lib/canvg.js +3073 -0
  9. data/app/assets/javascripts/highcharts/lib/jspdf.js +16624 -0
  10. data/app/assets/javascripts/highcharts/lib/rgbcolor.js +299 -0
  11. data/app/assets/javascripts/highcharts/lib/svg2pdf.js +3488 -0
  12. data/app/assets/javascripts/highcharts/modules/accessibility.js +654 -212
  13. data/app/assets/javascripts/highcharts/modules/annotations.js +1552 -274
  14. data/app/assets/javascripts/highcharts/modules/boost-canvas.js +773 -0
  15. data/app/assets/javascripts/highcharts/modules/boost.js +636 -210
  16. data/app/assets/javascripts/highcharts/modules/broken-axis.js +2 -2
  17. data/app/assets/javascripts/highcharts/modules/bullet.js +364 -0
  18. data/app/assets/javascripts/highcharts/modules/data.js +766 -38
  19. data/app/assets/javascripts/highcharts/modules/drag-panes.js +588 -0
  20. data/app/assets/javascripts/highcharts/modules/drilldown.js +106 -36
  21. data/app/assets/javascripts/highcharts/modules/export-data.js +597 -0
  22. data/app/assets/javascripts/highcharts/modules/exporting.js +424 -162
  23. data/app/assets/javascripts/highcharts/modules/funnel.js +144 -22
  24. data/app/assets/javascripts/highcharts/modules/gantt.js +1154 -0
  25. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  26. data/app/assets/javascripts/highcharts/modules/heatmap.js +406 -80
  27. data/app/assets/javascripts/highcharts/modules/histogram-bellcurve.js +513 -0
  28. data/app/assets/javascripts/highcharts/modules/item-series.js +126 -0
  29. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +31 -13
  30. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +179 -57
  31. data/app/assets/javascripts/highcharts/modules/oldie.js +1378 -0
  32. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +8 -6
  33. data/app/assets/javascripts/highcharts/modules/parallel-coordinates.js +494 -0
  34. data/app/assets/javascripts/highcharts/modules/pareto.js +275 -0
  35. data/app/assets/javascripts/highcharts/modules/sankey.js +641 -0
  36. data/app/assets/javascripts/highcharts/modules/series-label.js +355 -145
  37. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +122 -1
  38. data/app/assets/javascripts/highcharts/modules/static-scale.js +64 -0
  39. data/app/assets/javascripts/highcharts/modules/stock.js +1944 -676
  40. data/app/assets/javascripts/highcharts/modules/streamgraph.js +139 -0
  41. data/app/assets/javascripts/highcharts/modules/sunburst.js +2403 -0
  42. data/app/assets/javascripts/highcharts/modules/tilemap.js +1199 -0
  43. data/app/assets/javascripts/highcharts/modules/treemap.js +538 -134
  44. data/app/assets/javascripts/highcharts/modules/variable-pie.js +490 -0
  45. data/app/assets/javascripts/highcharts/modules/variwide.js +283 -0
  46. data/app/assets/javascripts/highcharts/modules/vector.js +294 -0
  47. data/app/assets/javascripts/highcharts/modules/windbarb.js +490 -0
  48. data/app/assets/javascripts/highcharts/modules/wordcloud.js +681 -0
  49. data/app/assets/javascripts/highcharts/modules/xrange.js +615 -0
  50. data/app/assets/javascripts/highcharts/themes/avocado.js +54 -0
  51. data/app/assets/javascripts/highcharts/themes/dark-blue.js +6 -6
  52. data/app/assets/javascripts/highcharts/themes/dark-green.js +6 -6
  53. data/app/assets/javascripts/highcharts/themes/dark-unica.js +6 -6
  54. data/app/assets/javascripts/highcharts/themes/gray.js +14 -10
  55. data/app/assets/javascripts/highcharts/themes/grid-light.js +6 -6
  56. data/app/assets/javascripts/highcharts/themes/grid.js +7 -5
  57. data/app/assets/javascripts/highcharts/themes/sand-signika.js +8 -7
  58. data/app/assets/javascripts/highcharts/themes/skies.js +15 -9
  59. data/app/assets/javascripts/highcharts/themes/sunset.js +53 -0
  60. data/app/assets/stylesheets/highcharts/highcharts.css +802 -0
  61. data/app/assets/stylesheets/highcharts/highcharts.scss +665 -0
  62. data/lib/highcharts/version.rb +1 -1
  63. metadata +31 -1
@@ -0,0 +1,490 @@
1
+ /**
2
+ * @license Highcharts JS v6.0.0 (2017-10-04)
3
+ *
4
+ * Variable Pie module for Highcharts
5
+ *
6
+ * (c) 2010-2017 Grzegorz Blachliński
7
+ *
8
+ * License: www.highcharts.com/license
9
+ */
10
+ 'use strict';
11
+ (function(factory) {
12
+ if (typeof module === 'object' && module.exports) {
13
+ module.exports = factory;
14
+ } else {
15
+ factory(Highcharts);
16
+ }
17
+ }(function(Highcharts) {
18
+ (function(H) {
19
+ /**
20
+ *
21
+ * Variable Pie module for Highcharts
22
+ *
23
+ * (c) 2010-2017 Grzegorz Blachliński
24
+ *
25
+ * License: www.highcharts.com/license
26
+ */
27
+ /* eslint max-len: ["warn", 80, 4] */
28
+
29
+ var pick = H.pick,
30
+ each = H.each,
31
+ grep = H.grep,
32
+ arrayMin = H.arrayMin,
33
+ arrayMax = H.arrayMax,
34
+ seriesType = H.seriesType,
35
+ pieProto = H.seriesTypes.pie.prototype;
36
+
37
+ /**
38
+ * The variablepie series type.
39
+ *
40
+ * @constructor seriesTypes.variablepie
41
+ * @augments seriesTypes.pie
42
+ */
43
+
44
+ seriesType('variablepie', 'pie',
45
+ /**
46
+ * A variable pie series is a two dimensional series type, where each point
47
+ * renders an Y and Z value. Each point is drawn as a pie slice where the
48
+ * size (arc) of the slice relates to the Y value and the radius of pie
49
+ * slice relates to the Z value. Requires `highcharts-more.js`.
50
+ *
51
+ * @extends {plotOptions.pie}
52
+ * @product highcharts
53
+ * @sample {highcharts} highcharts/demo/variable-radius-pie/
54
+ * Variable-radius pie chart
55
+ * @since 6.0.0
56
+ * @optionparent plotOptions.variablepie
57
+ */
58
+ {
59
+ /**
60
+ * The minimum size of the points' radius related to chart's `plotArea`.
61
+ * If a number is set, it applies in pixels.
62
+ *
63
+ * @sample {highcharts}
64
+ * highcharts/variable-radius-pie/min-max-point-size/
65
+ * Example of minPointSize and maxPointSize
66
+ * @sample {highcharts}
67
+ * highcharts/variable-radius-pie/min-point-size-100/
68
+ * minPointSize set to 100
69
+ * @type {String|Number}
70
+ * @since 6.0.0
71
+ * @product highcharts
72
+ */
73
+ minPointSize: '10%',
74
+ /**
75
+ * The maximum size of the points' radius related to chart's `plotArea`.
76
+ * If a number is set, it applies in pixels.
77
+ *
78
+ * @sample {highcharts}
79
+ * highcharts/variable-radius-pie/min-max-point-size/
80
+ * Example of minPointSize and maxPointSize
81
+ * @type {String|Number}
82
+ * @since 6.0.0
83
+ * @product highcharts
84
+ */
85
+ maxPointSize: '100%',
86
+ /**
87
+ * The minimum possible z value for the point's radius calculation.
88
+ * If the point's Z value is smaller than zMin, the slice will be drawn
89
+ * according to the zMin value.
90
+ *
91
+ * @sample {highcharts}
92
+ * highcharts/variable-radius-pie/zmin-5/
93
+ * zMin set to 5, smaller z values are treated as 5
94
+ * @sample {highcharts}
95
+ * highcharts/variable-radius-pie/zmin-zmax/
96
+ * Series limited by both zMin and zMax
97
+ * @type {Number}
98
+ * @since 6.0.0
99
+ * @product highcharts
100
+ */
101
+ zMin: undefined,
102
+ /**
103
+ * The maximum possible z value for the point's radius calculation. If
104
+ * the point's Z value is bigger than zMax, the slice will be drawn
105
+ * according to the zMax value
106
+ *
107
+ * @sample {highcharts}
108
+ * highcharts/variable-radius-pie/zmin-zmax/
109
+ * Series limited by both zMin and zMax
110
+ * @type {Number}
111
+ * @since 6.0.0
112
+ * @product highcharts
113
+ */
114
+ zMax: undefined,
115
+ /**
116
+ * Whether the pie slice's value should be represented by the area
117
+ * or the radius of the slice. Can be either `area` or `radius`. The
118
+ * default, `area`, corresponds best to the human perception of the size
119
+ * of each pie slice.
120
+ *
121
+ * @sample {highcharts}
122
+ * highcharts/variable-radius-pie/sizeby/
123
+ * Difference between area and radius sizeBy
124
+ * @type {String}
125
+ * @validvalue ["area", "radius"]
126
+ * @since 6.0.0
127
+ * @product highcharts
128
+ */
129
+ sizeBy: 'area',
130
+
131
+ tooltip: {
132
+ pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}<br/>Value: {point.y}<br/>Size: {point.z}<br/>' // eslint-disable-line max-len
133
+ }
134
+ }, {
135
+ pointArrayMap: ['y', 'z'],
136
+ parallelArrays: ['x', 'y', 'z'],
137
+
138
+ /*
139
+ * It is needed to null series.center on chart redraw. Probably good
140
+ * idea will be to add this option in directly in pie series.
141
+ */
142
+ redraw: function() {
143
+ this.center = null;
144
+ pieProto.redraw.call(this, arguments);
145
+ },
146
+
147
+ /*
148
+ * For arrayMin and arrayMax calculations array shouldn't have
149
+ * null/undefined/string values.
150
+ * In this case it is needed to check if points Z value is a Number.
151
+ */
152
+ zValEval: function(zVal) {
153
+ if (typeof zVal === 'number' && !isNaN(zVal)) {
154
+ return true;
155
+ }
156
+ return null;
157
+ },
158
+
159
+ /*
160
+ * Before standard translate method for pie chart it is needed to
161
+ * calculate min/max radius of each pie slice based on its Z value.
162
+ */
163
+ calculateExtremes: function() {
164
+ var series = this,
165
+ chart = series.chart,
166
+ plotWidth = chart.plotWidth,
167
+ plotHeight = chart.plotHeight,
168
+ seriesOptions = series.options,
169
+ slicingRoom = 2 * (seriesOptions.slicedOffset || 0),
170
+ zMin,
171
+ zMax,
172
+ zData = series.zData,
173
+ smallestSize = Math.min(plotWidth, plotHeight) - slicingRoom,
174
+ extremes = {}, // Min and max size of pie slice.
175
+ // In pie charts size of a pie is changed to make space for
176
+ // dataLabels, then series.center is changing.
177
+ positions = series.center || series.getCenter();
178
+
179
+ each(['minPointSize', 'maxPointSize'], function(prop) {
180
+ var length = seriesOptions[prop],
181
+ isPercent = /%$/.test(length);
182
+ length = parseInt(length, 10);
183
+ extremes[prop] = isPercent ?
184
+ smallestSize * length / 100 :
185
+ length * 2; // Because it should be radius, not diameter.
186
+ });
187
+
188
+ series.minPxSize = positions[3] + extremes.minPointSize;
189
+ series.maxPxSize = Math.max(
190
+ Math.min(positions[2], extremes.maxPointSize),
191
+ positions[3] + extremes.minPointSize
192
+ );
193
+
194
+ if (zData.length) {
195
+ zMin = pick(
196
+ seriesOptions.zMin,
197
+ arrayMin(grep(zData, series.zValEval))
198
+ );
199
+ zMax = pick(
200
+ seriesOptions.zMax,
201
+ arrayMax(grep(zData, series.zValEval))
202
+ );
203
+ this.getRadii(zMin, zMax, series.minPxSize, series.maxPxSize);
204
+ }
205
+ },
206
+
207
+ /*
208
+ * Finding radius of series points based on their Z value and min/max Z
209
+ * value for all series
210
+ * zMin - min threshold for Z value. If point's Z value is smaller that
211
+ * zMin, point will have the smallest possible radius.
212
+ * zMax - max threshold for Z value. If point's Z value is bigger that
213
+ * zMax, point will have the biggest possible radius.
214
+ * minSize - minimal pixel size possible for radius
215
+ * maxSize - minimal pixel size possible for radius
216
+ */
217
+ getRadii: function(zMin, zMax, minSize, maxSize) {
218
+ var i = 0,
219
+ pos,
220
+ zData = this.zData,
221
+ len = zData.length,
222
+ radii = [],
223
+ options = this.options,
224
+ sizeByArea = options.sizeBy !== 'radius',
225
+ zRange = zMax - zMin,
226
+ value,
227
+ radius;
228
+
229
+
230
+ // Calculate radius for all pie slice's based on their Z values
231
+ for (i; i < len; i++) {
232
+ // if zData[i] is null/undefined/string we need to take zMin for
233
+ // smallest radius.
234
+ value = this.zValEval(zData[i]) ? zData[i] : zMin;
235
+
236
+ if (value <= zMin) {
237
+ radius = minSize / 2;
238
+ } else if (value >= zMax) {
239
+ radius = maxSize / 2;
240
+ } else {
241
+ // Relative size, a number between 0 and 1
242
+ pos = zRange > 0 ? (value - zMin) / zRange : 0.5;
243
+
244
+ if (sizeByArea) {
245
+ pos = Math.sqrt(pos);
246
+ }
247
+
248
+ radius = Math.ceil(minSize + pos * (maxSize - minSize)) / 2;
249
+ }
250
+ radii.push(radius);
251
+ }
252
+ this.radii = radii;
253
+ },
254
+
255
+
256
+ /**
257
+ * Extend tranlate by updating radius for each pie slice instead of
258
+ * using one global radius.
259
+ */
260
+ translate: function(positions) {
261
+
262
+ this.generatePoints();
263
+
264
+ var series = this,
265
+ cumulative = 0,
266
+ precision = 1000, // issue #172
267
+ options = series.options,
268
+ slicedOffset = options.slicedOffset,
269
+ connectorOffset = slicedOffset + (options.borderWidth || 0),
270
+ finalConnectorOffset,
271
+ start,
272
+ end,
273
+ angle,
274
+ startAngle = options.startAngle || 0,
275
+ startAngleRad = Math.PI / 180 * (startAngle - 90),
276
+ endAngleRad = Math.PI / 180 * (pick(
277
+ options.endAngle,
278
+ startAngle + 360) - 90),
279
+ circ = endAngleRad - startAngleRad, // 2 * Math.PI,
280
+ points = series.points,
281
+ // the x component of the radius vector for a given point
282
+ radiusX,
283
+ radiusY,
284
+ labelDistance = options.dataLabels.distance,
285
+ ignoreHiddenPoint = options.ignoreHiddenPoint,
286
+ i,
287
+ len = points.length,
288
+ point,
289
+ pointRadii,
290
+ pointRadiusX,
291
+ pointRadiusY;
292
+
293
+ series.startAngleRad = startAngleRad;
294
+ series.endAngleRad = endAngleRad;
295
+ // Use calculateExtremes to get series.radii array.
296
+ series.calculateExtremes();
297
+
298
+ // Get positions - either an integer or a percentage string must be
299
+ // given. If positions are passed as a parameter, we're in a
300
+ // recursive loop for adjusting space for data labels.
301
+ if (!positions) {
302
+ series.center = positions = series.getCenter();
303
+ }
304
+
305
+ // Utility for getting the x value from a given y, used for
306
+ // anticollision logic in data labels. Added point for using
307
+ // specific points' label distance.
308
+ series.getX = function(y, left, point) {
309
+ var radii = point.series.radii[point.index];
310
+ angle = Math.asin(
311
+ Math.min(
312
+ (y - positions[1]) /
313
+ (radii + point.labelDistance),
314
+ 1
315
+ )
316
+ );
317
+ return positions[0] +
318
+ (left ? -1 : 1) *
319
+ (Math.cos(angle) * (radii +
320
+ point.labelDistance));
321
+ };
322
+
323
+ // Calculate the geometry for each point
324
+ for (i = 0; i < len; i++) {
325
+
326
+ point = points[i];
327
+ pointRadii = series.radii[i];
328
+
329
+ // Used for distance calculation for specific point.
330
+ point.labelDistance = pick(
331
+ point.options.dataLabels &&
332
+ point.options.dataLabels.distance,
333
+ labelDistance
334
+ );
335
+
336
+ // Saved for later dataLabels distance calculation.
337
+ series.maxLabelDistance = Math.max(
338
+ series.maxLabelDistance || 0,
339
+ point.labelDistance
340
+ );
341
+
342
+ // set start and end angle
343
+ start = startAngleRad + (cumulative * circ);
344
+ if (!ignoreHiddenPoint || point.visible) {
345
+ cumulative += point.percentage / 100;
346
+ }
347
+ end = startAngleRad + (cumulative * circ);
348
+
349
+ // set the shape
350
+ point.shapeType = 'arc';
351
+ point.shapeArgs = {
352
+ x: positions[0],
353
+ y: positions[1],
354
+ r: pointRadii,
355
+ innerR: positions[3] / 2,
356
+ start: Math.round(start * precision) / precision,
357
+ end: Math.round(end * precision) / precision
358
+ };
359
+
360
+ // The angle must stay within -90 and 270 (#2645)
361
+ angle = (end + start) / 2;
362
+ if (angle > 1.5 * Math.PI) {
363
+ angle -= 2 * Math.PI;
364
+ } else if (angle < -Math.PI / 2) {
365
+ angle += 2 * Math.PI;
366
+ }
367
+
368
+ // Center for the sliced out slice
369
+ point.slicedTranslation = {
370
+ translateX: Math.round(Math.cos(angle) * slicedOffset),
371
+ translateY: Math.round(Math.sin(angle) * slicedOffset)
372
+ };
373
+
374
+ // set the anchor point for tooltips
375
+ radiusX = Math.cos(angle) * positions[2] / 2;
376
+ radiusY = Math.sin(angle) * positions[2] / 2;
377
+ pointRadiusX = Math.cos(angle) * pointRadii;
378
+ pointRadiusY = Math.sin(angle) * pointRadii;
379
+ point.tooltipPos = [
380
+ positions[0] + radiusX * 0.7,
381
+ positions[1] + radiusY * 0.7
382
+ ];
383
+
384
+ point.half = angle < -Math.PI / 2 || angle > Math.PI / 2 ?
385
+ 1 :
386
+ 0;
387
+ point.angle = angle;
388
+
389
+ // Set the anchor point for data labels. Use point.labelDistance
390
+ // instead of labelDistance // #1174
391
+ // finalConnectorOffset - not override connectorOffset value.
392
+ finalConnectorOffset = Math.min(
393
+ connectorOffset,
394
+ point.labelDistance / 5
395
+ ); // #1678
396
+
397
+ point.labelPos = [
398
+ positions[0] + pointRadiusX +
399
+ // first break of connector
400
+ Math.cos(angle) * point.labelDistance,
401
+ positions[1] + pointRadiusY +
402
+ Math.sin(angle) * point.labelDistance, // a/a
403
+ positions[0] + pointRadiusX +
404
+ // second break, right outside pie
405
+ Math.cos(angle) * finalConnectorOffset,
406
+ positions[1] + pointRadiusY +
407
+ Math.sin(angle) * finalConnectorOffset, // a/a
408
+ positions[0] + pointRadiusX, // landing point for connector
409
+ positions[1] + pointRadiusY, // a/a
410
+ point.labelDistance < 0 ? // alignment
411
+ 'center' :
412
+ point.half ? 'right' : 'left', // alignment
413
+ angle // center angle
414
+ ];
415
+ }
416
+ }
417
+ }
418
+ );
419
+
420
+ /**
421
+ * A `variablepie` series. If the [type](#series.variablepie.type) option is not
422
+ * specified, it is inherited from [chart.type](#chart.type).
423
+ *
424
+ * For options that apply to multiple series, it is recommended to add
425
+ * them to the [plotOptions.series](#plotOptions.series) options structure.
426
+ * To apply to all series of this specific type, apply it to [plotOptions.
427
+ * variablepie](#plotOptions.variablepie).
428
+ *
429
+ * @type {Object}
430
+ * @extends series,plotOptions.variablepie
431
+ * @excluding dataParser,dataURL,stack,xAxis,yAxis
432
+ * @product highcharts
433
+ * @apioption series.variablepie
434
+ */
435
+
436
+ /**
437
+ * An array of data points for the series. For the `variablepie` series type,
438
+ * points can be given in the following ways:
439
+ *
440
+ * 1. An array of arrays with 2 values. In this case, the numerical values
441
+ * will be interpreted as `y, z` options. Example:
442
+ *
443
+ * ```js
444
+ * data: [
445
+ * [40, 75],
446
+ * [50, 50],
447
+ * [60, 40]
448
+ * ]
449
+ * ```
450
+ *
451
+ * 2. An array of objects with named values. The objects are point
452
+ * configuration objects as seen below. If the total number of data
453
+ * points exceeds the series'
454
+ * [turboThreshold](#series.variablepie.turboThreshold), this option is not
455
+ * available.
456
+ *
457
+ * ```js
458
+ * data: [{
459
+ * y: 1,
460
+ * z: 4,
461
+ * name: "Point2",
462
+ * color: "#00FF00"
463
+ * }, {
464
+ * y: 7,
465
+ * z: 10,
466
+ * name: "Point1",
467
+ * color: "#FF00FF"
468
+ * }]
469
+ * ```
470
+ *
471
+ * @type {Array<Object|Number>}
472
+ * @extends series.pie.data
473
+ * @excluding marker,x
474
+ * @sample {highcharts} highcharts/chart/reflow-true/
475
+ * Numerical values
476
+ * @sample {highcharts} highcharts/series/data-array-of-arrays/
477
+ * Arrays of numeric x and y
478
+ * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
479
+ * Arrays of datetime x and y
480
+ * @sample {highcharts} highcharts/series/data-array-of-name-value/
481
+ * Arrays of point.name and y
482
+ * @sample {highcharts} highcharts/series/data-array-of-objects/
483
+ * Config objects
484
+ * @product highcharts
485
+ * @apioption series.variablepie.data
486
+ */
487
+
488
+
489
+ }(Highcharts));
490
+ }));