highcharts-rails 5.0.14 → 6.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 (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,513 @@
1
+ /**
2
+ * @license Highcharts JS v6.0.0 (2017-10-04)
3
+ *
4
+ * (c) 2010-2017 Highsoft AS
5
+ * Author: Sebastian Domas
6
+ *
7
+ * License: www.highcharts.com/license
8
+ */
9
+ 'use strict';
10
+ (function(factory) {
11
+ if (typeof module === 'object' && module.exports) {
12
+ module.exports = factory;
13
+ } else {
14
+ factory(Highcharts);
15
+ }
16
+ }(function(Highcharts) {
17
+ var derivedSeriesMixin = (function(H) {
18
+
19
+ var each = H.each,
20
+ Series = H.Series,
21
+ addEvent = H.addEvent,
22
+ fireEvent = H.fireEvent,
23
+ wrap = H.wrap,
24
+ noop = H.noop;
25
+
26
+
27
+ /* ***************************************************************************
28
+ *
29
+ * DERIVED SERIES MIXIN
30
+ *
31
+ **************************************************************************** */
32
+
33
+ /**
34
+ * Provides methods for auto setting/updating series data based on the based series data,
35
+ *
36
+ * @mixin
37
+ **/
38
+ var derivedSeriesMixin = {
39
+ /**
40
+ * Initialise series
41
+ *
42
+ * returns {undefined}
43
+ **/
44
+ init: function() {
45
+ Series.prototype.init.apply(this, arguments);
46
+
47
+ this.initialised = false;
48
+ this.baseSeries = null;
49
+ this.eventRemovers = [];
50
+
51
+ this.addEvents();
52
+ },
53
+
54
+ /**
55
+ * Method to be implemented - inside the method the series has already access to the base series
56
+ * via m `this.baseSeries` and the bases data is initialised. It should
57
+ * return data in the format accepted by Series.setData() method
58
+ *
59
+ * @returns {Array} - an array of data
60
+ **/
61
+ setDerivedData: noop,
62
+
63
+ /**
64
+ * Sets base series for the series
65
+ *
66
+ * returns {undefined}
67
+ **/
68
+ setBaseSeries: function() {
69
+ var chart = this.chart,
70
+ baseSeriesOptions = this.options.baseSeries,
71
+ baseSeries =
72
+ baseSeriesOptions &&
73
+ (chart.series[baseSeriesOptions] || chart.get(baseSeriesOptions));
74
+
75
+ this.baseSeries = baseSeries || null;
76
+ },
77
+
78
+ /**
79
+ * Adds events for the series
80
+ *
81
+ * @returns {undefined}
82
+ **/
83
+ addEvents: function() {
84
+ var derivedSeries = this,
85
+ chartSeriesLinked;
86
+
87
+ chartSeriesLinked = addEvent(this.chart, 'seriesLinked', function() {
88
+ derivedSeries.setBaseSeries();
89
+
90
+ if (derivedSeries.baseSeries && !derivedSeries.initialised) {
91
+ derivedSeries.setDerivedData();
92
+ derivedSeries.addBaseSeriesEvents();
93
+ derivedSeries.initialised = true;
94
+ }
95
+ });
96
+
97
+ this.eventRemovers.push(
98
+ chartSeriesLinked
99
+ );
100
+ },
101
+
102
+ /**
103
+ * Adds events to the base series - it required for recalculating the data in
104
+ * the series if the base series is updated / removed / etc.
105
+ *
106
+ * @returns {undefined}
107
+ **/
108
+ addBaseSeriesEvents: function() {
109
+ var derivedSeries = this,
110
+ updatedDataRemover,
111
+ destroyRemover;
112
+
113
+ updatedDataRemover = addEvent(derivedSeries.baseSeries, 'updatedData', function() {
114
+ derivedSeries.setDerivedData();
115
+ });
116
+
117
+ destroyRemover = addEvent(derivedSeries.baseSeries, 'destroy', function() {
118
+ derivedSeries.baseSeries = null;
119
+ derivedSeries.initialised = false;
120
+ });
121
+
122
+ derivedSeries.eventRemovers.push(
123
+ updatedDataRemover,
124
+ destroyRemover
125
+ );
126
+ },
127
+
128
+ /**
129
+ * Destroys the series
130
+ *
131
+ * @returns {undefined}
132
+ **/
133
+ destroy: function() {
134
+ each(this.eventRemovers, function(remover) {
135
+ remover();
136
+ });
137
+
138
+ Series.prototype.destroy.apply(this, arguments);
139
+ }
140
+ };
141
+
142
+ /**
143
+ * Adds a new chart event after the series are linked
144
+ **/
145
+ wrap(H.Chart.prototype, 'linkSeries', function(p) {
146
+ p.call(this);
147
+
148
+ fireEvent(this, 'seriesLinked');
149
+ });
150
+ return derivedSeriesMixin;
151
+ }(Highcharts));
152
+ (function(H, derivedSeriesMixin) {
153
+
154
+
155
+
156
+ var each = H.each,
157
+ objectEach = H.objectEach,
158
+ seriesType = H.seriesType,
159
+ correctFloat = H.correctFloat,
160
+ isNumber = H.isNumber,
161
+ arrayMax = H.arrayMax,
162
+ arrayMin = H.arrayMin,
163
+ merge = H.merge;
164
+
165
+ /* ***************************************************************************
166
+ *
167
+ * HISTOGRAM
168
+ *
169
+ **************************************************************************** */
170
+
171
+ /**
172
+ * A dictionary with formulas for calculating number of bins based on the base series
173
+ **/
174
+ var binsNumberFormulas = {
175
+ 'square-root': function(baseSeries) {
176
+ return Math.round(Math.sqrt(baseSeries.options.data.length));
177
+ },
178
+
179
+ 'sturges': function(baseSeries) {
180
+ return Math.ceil(Math.log(baseSeries.options.data.length) * Math.LOG2E);
181
+ },
182
+
183
+ 'rice': function(baseSeries) {
184
+ return Math.ceil(2 * Math.pow(baseSeries.options.data.length, 1 / 3));
185
+ }
186
+ };
187
+
188
+ /**
189
+ * Returns a function for mapping number to the closed (right opened) bins
190
+ *
191
+ * @param {number} binWidth - width of the bin
192
+ * @returns {function}
193
+ **/
194
+ function fitToBinLeftClosed(binWidth) {
195
+ return function(y) {
196
+ return Math.floor(y / binWidth) * binWidth;
197
+ };
198
+ }
199
+
200
+ /**
201
+ * Histogram class
202
+ *
203
+ * @constructor seriesTypes.histogram
204
+ * @augments seriesTypes.column
205
+ * @mixes DerivedSeriesMixin
206
+ **/
207
+
208
+ /**
209
+ * A histogram is a column series which represents the distribution of the data
210
+ * set in the base series. Histogram splits data into bins and shows their frequencies.
211
+ *
212
+ * @product highcharts
213
+ * @sample {highcharts} highcharts/demo/histogram/ Histogram
214
+ * @since 6.0.0
215
+ * @extends plotOptions.column
216
+ * @excluding boostThreshold, pointInterval, pointIntervalUnit, stacking
217
+ * @optionparent plotOptions.histogram
218
+ **/
219
+ seriesType('histogram', 'column', {
220
+ /**
221
+ * A preferable number of bins. It is a suggestion, so a histogram may have
222
+ * a different number of bins. By default it is set to the square of the
223
+ * base series' data length. Available options are: `square-root`,
224
+ * `sturges`, `rice`. You can also define a function which takes a
225
+ * `baseSeries` as a parameter and should return a positive integer.
226
+ *
227
+ * @type {String|Number|Function}
228
+ * @validvalue ["square-root", "sturges", "rice"]
229
+ */
230
+ binsNumber: 'square-root',
231
+
232
+ /**
233
+ * Width of each bin. By default the bin's width is calculated as `(max - min) / number of bins`.
234
+ * This option takes precedence over [binsNumber](#plotOptions.histogram.binsNumber).
235
+ *
236
+ * @type {Number}
237
+ */
238
+ binWidth: undefined,
239
+ pointPadding: 0,
240
+ groupPadding: 0,
241
+ grouping: false,
242
+ pointPlacement: 'between',
243
+ tooltip: {
244
+ headerFormat: '',
245
+ pointFormat: '<span style="font-size:10px">{point.x} - {point.x2}</span><br/>' +
246
+ '<span style="color:{point.color}">\u25CF</span> {series.name} <b>{point.y}</b><br/>'
247
+ }
248
+
249
+ /**
250
+ * A `histogram` series. If the [type](#series.histogram.type) option is not
251
+ * specified, it is inherited from [chart.type](#chart.type).
252
+ *
253
+ * For options that apply to multiple series, it is recommended to add
254
+ * them to the [plotOptions.series](#plotOptions.series) options structure.
255
+ * To apply to all series of this specific type, apply it to [plotOptions.
256
+ * histogram](#plotOptions.histogram).
257
+ *
258
+ * @type {Object}
259
+ * @since 6.0.0
260
+ * @extends series,plotOptions.histogram
261
+ * @excluding dataParser,dataURL,data
262
+ * @product highcharts
263
+ * @apioption series.histogram
264
+ */
265
+
266
+ /**
267
+ * An integer identifying the index to use for the base series, or a string
268
+ * representing the id of the series.
269
+ *
270
+ * @type {Number|String}
271
+ * @default undefined
272
+ * @apioption series.histogram.baseSeries
273
+ */
274
+
275
+ /**
276
+ * An array of data points for the series. For the `histogram` series type,
277
+ * points are calculated dynamically. See
278
+ * [histogram.baseSeries](#series.histogram.baseSeries).
279
+ *
280
+ * @type {Array<Object|Array>}
281
+ * @since 6.0.0
282
+ * @extends series.histogram.data
283
+ * @product highcharts
284
+ * @apioption series.histogram.data
285
+ */
286
+ }, merge(derivedSeriesMixin, {
287
+ setDerivedData: function() {
288
+ var data = this.derivedData(
289
+ this.baseSeries.yData,
290
+ this.binsNumber(),
291
+ this.options.binWidth
292
+ );
293
+
294
+ this.setData(data, false);
295
+ },
296
+
297
+ derivedData: function(baseData, binsNumber, binWidth) {
298
+ var max = arrayMax(baseData),
299
+ min = arrayMin(baseData),
300
+ frequencies = {},
301
+ data = [],
302
+ x,
303
+ fitToBin;
304
+
305
+ binWidth = this.binWidth = isNumber(binWidth) ? binWidth : (max - min) / binsNumber;
306
+ fitToBin = fitToBinLeftClosed(binWidth);
307
+
308
+ for (x = fitToBin(min); x <= max; x += binWidth) {
309
+ frequencies[correctFloat(x)] = 0;
310
+ }
311
+
312
+ each(baseData, function(y) {
313
+ var x = correctFloat(fitToBin(y));
314
+ frequencies[x]++;
315
+ });
316
+
317
+ objectEach(frequencies, function(frequency, x) {
318
+ data.push({
319
+ x: Number(x),
320
+ y: frequency,
321
+ x2: correctFloat(Number(x) + binWidth)
322
+ });
323
+ });
324
+
325
+ data.sort(function(a, b) {
326
+ return a.x - b.x;
327
+ });
328
+
329
+ return data;
330
+ },
331
+
332
+ binsNumber: function() {
333
+ var binsNumberOption = this.options.binsNumber;
334
+ var binsNumber = binsNumberFormulas[binsNumberOption] || typeof binsNumberOption === 'function';
335
+
336
+ return Math.ceil(
337
+ (binsNumber && binsNumber(this.baseSeries)) ||
338
+ (isNumber(binsNumberOption) ? binsNumberOption : binsNumberFormulas['square-root'](this.baseSeries))
339
+ );
340
+ }
341
+ }));
342
+
343
+ }(Highcharts, derivedSeriesMixin));
344
+ (function(H, derivedSeriesMixin) {
345
+
346
+
347
+
348
+ var seriesType = H.seriesType,
349
+ correctFloat = H.correctFloat,
350
+ isNumber = H.isNumber,
351
+ merge = H.merge,
352
+ reduce = H.reduce;
353
+
354
+
355
+ /* ***************************************************************************
356
+ *
357
+ * BELL CURVE
358
+ *
359
+ **************************************************************************** */
360
+
361
+ function mean(data) {
362
+ var length = data.length,
363
+ sum = reduce(data, function(sum, value) {
364
+ return (sum += value);
365
+ }, 0);
366
+
367
+ return length > 0 && sum / length;
368
+ }
369
+
370
+ function standardDeviation(data, average) {
371
+ var len = data.length,
372
+ sum;
373
+
374
+ average = isNumber(average) ? average : mean(data);
375
+
376
+ sum = reduce(data, function(sum, value) {
377
+ var diff = value - average;
378
+ return (sum += diff * diff);
379
+ }, 0);
380
+
381
+ return len > 1 && Math.sqrt(sum / (len - 1));
382
+ }
383
+
384
+ function normalDensity(x, mean, standardDeviation) {
385
+ var translation = x - mean;
386
+ return Math.exp(-(translation * translation) /
387
+ (2 * standardDeviation * standardDeviation)
388
+ ) / (standardDeviation * Math.sqrt(2 * Math.PI));
389
+ }
390
+
391
+
392
+ /**
393
+ * Bell curve class
394
+ *
395
+ * @constructor seriesTypes.bellcurve
396
+ * @augments seriesTypes.areaspline
397
+ * @mixes DerivedSeriesMixin
398
+ **/
399
+
400
+ /**
401
+ * A bell curve is an areaspline series which represents the probability density
402
+ * function of the normal distribution. It calculates mean and standard
403
+ * deviation of the base series data and plots the curve according to the
404
+ * calculated parameters.
405
+ *
406
+ * @product highcharts
407
+ * @sample {highcharts} highcharts/demo/bellcurve/ Bell curve
408
+ * @since 6.0.0
409
+ * @extends plotOptions.areaspline
410
+ * @excluding boostThreshold,connectNulls,stacking,pointInterval,
411
+ * pointIntervalUnit
412
+ * @optionparent plotOptions.bellcurve
413
+ **/
414
+ seriesType('bellcurve', 'areaspline', {
415
+ /**
416
+ * This option allows to define the length of the bell curve. A unit of the
417
+ * length of the bell curve is standard deviation.
418
+ *
419
+ * @sample highcharts/plotoptions/bellcurve-intervals-pointsininterval
420
+ * Intervals and points in interval
421
+ */
422
+ intervals: 3,
423
+
424
+ /**
425
+ * Defines how many points should be plotted within 1 interval. See
426
+ * `plotOptions.bellcurve.intervals`.
427
+ *
428
+ * @sample highcharts/plotoptions/bellcurve-intervals-pointsininterval
429
+ * Intervals and points in interval
430
+ */
431
+ pointsInInterval: 3,
432
+
433
+ marker: {
434
+ enabled: false
435
+ }
436
+
437
+ /**
438
+ * A `bellcurve` series. If the [type](#series.bellcurve.type) option is not
439
+ * specified, it is inherited from [chart.type](#chart.type).
440
+ *
441
+ * For options that apply to multiple series, it is recommended to add
442
+ * them to the [plotOptions.series](#plotOptions.series) options structure.
443
+ * To apply to all series of this specific type, apply it to [plotOptions.
444
+ * bellcurve](#plotOptions.bellcurve).
445
+ *
446
+ * @type {Object}
447
+ * @since 6.0.0
448
+ * @extends series,plotOptions.bellcurve
449
+ * @excluding dataParser,dataURL,data
450
+ * @product highcharts
451
+ * @apioption series.bellcurve
452
+ **/
453
+
454
+ /**
455
+ * An integer identifying the index to use for the base series, or a string
456
+ * representing the id of the series.
457
+ *
458
+ * @type {Number|String}
459
+ * @default undefined
460
+ * @apioption series.bellcurve.baseSeries
461
+ **/
462
+
463
+ /**
464
+ * An array of data points for the series. For the `bellcurve` series type,
465
+ * points are calculated dynamically.
466
+ *
467
+ * @type {Array<Object|Array>}
468
+ * @since 6.0.0
469
+ * @extends series.bellcurve.data
470
+ * @product highcharts
471
+ * @apioption series.bellcurve.data
472
+ **/
473
+ }, merge(derivedSeriesMixin, {
474
+ setMean: function() {
475
+ this.mean = correctFloat(mean(this.baseSeries.yData));
476
+ },
477
+
478
+ setStandardDeviation: function() {
479
+ this.standardDeviation = correctFloat(
480
+ standardDeviation(this.baseSeries.yData, this.mean)
481
+ );
482
+ },
483
+
484
+ setDerivedData: function() {
485
+ if (this.baseSeries.yData.length > 1) {
486
+ this.setMean();
487
+ this.setStandardDeviation();
488
+ this.setData(
489
+ this.derivedData(this.mean, this.standardDeviation), false
490
+ );
491
+ }
492
+ },
493
+
494
+ derivedData: function(mean, standardDeviation) {
495
+ var intervals = this.options.intervals,
496
+ pointsInInterval = this.options.pointsInInterval,
497
+ x = mean - intervals * standardDeviation,
498
+ stop = intervals * pointsInInterval * 2 + 1,
499
+ increment = standardDeviation / pointsInInterval,
500
+ data = [],
501
+ i;
502
+
503
+ for (i = 0; i < stop; i++) {
504
+ data.push([x, normalDensity(x, mean, standardDeviation)]);
505
+ x += increment;
506
+ }
507
+
508
+ return data;
509
+ }
510
+ }));
511
+
512
+ }(Highcharts, derivedSeriesMixin));
513
+ }));