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,588 @@
1
+ /**
2
+ * @license Highcharts JS v6.0.0 (2017-10-04)
3
+ * Drag-panes module
4
+ *
5
+ * (c) 2010-2017 Highsoft AS
6
+ * Author: Kacper Madej
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
+ * Plugin for resizing axes / panes in a chart.
21
+ *
22
+ * (c) 2010-2017 Highsoft AS
23
+ * Author: Kacper Madej
24
+ *
25
+ * License: www.highcharts.com/license
26
+ */
27
+
28
+ var hasTouch = H.hasTouch,
29
+ merge = H.merge,
30
+ wrap = H.wrap,
31
+ each = H.each,
32
+ isNumber = H.isNumber,
33
+ addEvent = H.addEvent,
34
+ relativeLength = H.relativeLength,
35
+ objectEach = H.objectEach,
36
+ Axis = H.Axis,
37
+ Pointer = H.Pointer,
38
+
39
+ /**
40
+ * Default options for AxisResizer.
41
+ * @product highstock
42
+ * @optionparent yAxis
43
+ */
44
+ resizerOptions = {
45
+ /**
46
+ * Minimal size of a resizable axis. Could be set as a percent
47
+ * of plot area or pixel size.
48
+ *
49
+ * This feature requires the `drag-panes.js` module.
50
+ *
51
+ * @type {Number|String}
52
+ * @sample {highstock} stock/yaxis/resize-min-max-length minLength and maxLength
53
+ */
54
+ minLength: '10%',
55
+
56
+ /**
57
+ * Maximal size of a resizable axis. Could be set as a percent
58
+ * of plot area or pixel size.
59
+ *
60
+ * This feature requires the `drag-panes.js` module.
61
+ *
62
+ * @type {String|Number}
63
+ * @sample {highstock} stock/yaxis/resize-min-max-length minLength and maxLength
64
+ */
65
+ maxLength: '100%',
66
+
67
+ /**
68
+ * Options for axis resizing for Drag Panes module.
69
+ *
70
+ * This feature requires the `drag-panes.js` module.
71
+ */
72
+ resize: {
73
+
74
+ /**
75
+ * Contains two arrays of axes that are controlled by control line
76
+ * of the axis.
77
+ *
78
+ * This feature requires the `drag-panes.js` module.
79
+ */
80
+ controlledAxis: {
81
+
82
+ /**
83
+ * Array of axes that should move out of the way of resizing
84
+ * being done for the current axis. If not set, the next axis
85
+ * will be used.
86
+ *
87
+ * This feature requires the `drag-panes.js` module.
88
+ *
89
+ * @type {Array.<String|Number>}
90
+ * @default []
91
+ * @sample {highstock} stock/yaxis/multiple-resizers Three panes with resizers
92
+ * @sample {highstock} stock/yaxis/resize-multiple-axes One resizer controlling multiple axes
93
+ */
94
+ next: [],
95
+
96
+ /**
97
+ * Array of axes that should move with the current axis
98
+ * while resizing.
99
+ *
100
+ * This feature requires the `drag-panes.js` module.
101
+ *
102
+ * @type {Array.<String|Number>}
103
+ * @default []
104
+ * @sample {highstock} stock/yaxis/multiple-resizers Three panes with resizers
105
+ * @sample {highstock} stock/yaxis/resize-multiple-axes One resizer controlling multiple axes
106
+ */
107
+ prev: []
108
+ },
109
+
110
+ /**
111
+ * Enable or disable resize by drag for the axis.
112
+ *
113
+ * This feature requires the `drag-panes.js` module.
114
+ *
115
+ * @sample {highstock} stock/demo/candlestick-and-volume Enabled resizer
116
+ */
117
+ enabled: false,
118
+
119
+
120
+
121
+ /**
122
+ * Cursor style for the control line.
123
+ *
124
+ * In styled mode use class `highcharts-axis-resizer` instead.
125
+ *
126
+ * This feature requires the `drag-panes.js` module.
127
+ */
128
+ cursor: 'ns-resize',
129
+
130
+ /**
131
+ * Color of the control line.
132
+ *
133
+ * In styled mode use class `highcharts-axis-resizer` instead.
134
+ *
135
+ * This feature requires the `drag-panes.js` module.
136
+ *
137
+ * @type {Color}
138
+ * @sample {highstock} stock/yaxis/styled-resizer Styled resizer
139
+ */
140
+ lineColor: '#cccccc',
141
+
142
+ /**
143
+ * Dash style of the control line.
144
+ *
145
+ * In styled mode use class `highcharts-axis-resizer` instead.
146
+ *
147
+ * This feature requires the `drag-panes.js` module.
148
+ *
149
+ * @default Solid
150
+ * @sample {highstock} stock/yaxis/styled-resizer Styled resizer
151
+ * @see For supported options check
152
+ * [dashStyle](#plotOptions.series.dashStyle)
153
+ */
154
+ lineDashStyle: 'Solid',
155
+
156
+ /**
157
+ * Width of the control line.
158
+ *
159
+ * In styled mode use class `highcharts-axis-resizer` instead.
160
+ *
161
+ * This feature requires the `drag-panes.js` module.
162
+ *
163
+ * @sample {highstock} stock/yaxis/styled-resizer Styled resizer
164
+ */
165
+ lineWidth: 4,
166
+
167
+
168
+
169
+ /**
170
+ * Horizontal offset of the control line.
171
+ *
172
+ * This feature requires the `drag-panes.js` module.
173
+ *
174
+ * @sample {highstock} stock/yaxis/styled-resizer Styled resizer
175
+ */
176
+ x: 0,
177
+
178
+ /**
179
+ * Vertical offset of the control line.
180
+ *
181
+ * This feature requires the `drag-panes.js` module.
182
+ *
183
+ * @sample {highstock} stock/yaxis/styled-resizer Styled resizer
184
+ */
185
+ y: 0
186
+ }
187
+ };
188
+ merge(true, Axis.prototype.defaultYAxisOptions, resizerOptions);
189
+
190
+ /**
191
+ * The AxisResizer class.
192
+ * @param {Object} axis - main axis for the AxisResizer.
193
+ * @class
194
+ */
195
+ H.AxisResizer = function(axis) {
196
+ this.init(axis);
197
+ };
198
+
199
+ H.AxisResizer.prototype = {
200
+ /**
201
+ * Initiate the AxisResizer object.
202
+ * @param {Object} axis - main axis for the AxisResizer.
203
+ */
204
+ init: function(axis, update) {
205
+ this.axis = axis;
206
+ this.options = axis.options.resize;
207
+ this.render();
208
+
209
+ if (!update) {
210
+ // Add mouse events.
211
+ this.addMouseEvents();
212
+ }
213
+ },
214
+
215
+ /**
216
+ * Render the AxisResizer
217
+ */
218
+ render: function() {
219
+ var resizer = this,
220
+ axis = resizer.axis,
221
+ chart = axis.chart,
222
+ options = resizer.options,
223
+ x = options.x,
224
+ y = options.y,
225
+ // Normalize control line position according to the plot area
226
+ pos = Math.min(
227
+ Math.max(
228
+ axis.top + axis.height + y,
229
+ chart.plotTop
230
+ ),
231
+ chart.plotTop + chart.plotHeight
232
+ ),
233
+ attr = {},
234
+ lineWidth;
235
+
236
+
237
+ attr = {
238
+ cursor: options.cursor,
239
+ stroke: options.lineColor,
240
+ 'stroke-width': options.lineWidth,
241
+ dashstyle: options.lineDashStyle
242
+ };
243
+
244
+
245
+ // Register current position for future reference.
246
+ resizer.lastPos = pos - y;
247
+
248
+ if (!resizer.controlLine) {
249
+ resizer.controlLine = chart.renderer.path()
250
+ .addClass('highcharts-axis-resizer');
251
+ }
252
+
253
+ // Add to axisGroup after axis update, because the group is recreated
254
+
255
+ resizer.controlLine.add(axis.axisGroup);
256
+
257
+
258
+ lineWidth = options.lineWidth;
259
+
260
+ attr.d = chart.renderer.crispLine(
261
+ [
262
+ 'M', axis.left + x, pos,
263
+ 'L', axis.left + axis.width + x, pos
264
+ ],
265
+ lineWidth
266
+ );
267
+
268
+ resizer.controlLine.attr(attr);
269
+ },
270
+
271
+ /**
272
+ * Set up the mouse and touch events for the control line.
273
+ */
274
+ addMouseEvents: function() {
275
+ var resizer = this,
276
+ ctrlLineElem = resizer.controlLine.element,
277
+ container = resizer.axis.chart.container,
278
+ eventsToUnbind = [],
279
+ mouseMoveHandler,
280
+ mouseUpHandler,
281
+ mouseDownHandler;
282
+
283
+ /**
284
+ * Create mouse events' handlers.
285
+ * Make them as separate functions to enable wrapping them:
286
+ */
287
+ resizer.mouseMoveHandler = mouseMoveHandler = function(e) {
288
+ resizer.onMouseMove(e);
289
+ };
290
+ resizer.mouseUpHandler = mouseUpHandler = function(e) {
291
+ resizer.onMouseUp(e);
292
+ };
293
+ resizer.mouseDownHandler = mouseDownHandler = function(e) {
294
+ resizer.onMouseDown(e);
295
+ };
296
+
297
+ /**
298
+ * Add mouse move and mouseup events. These are bind to doc/container,
299
+ * because resizer.grabbed flag is stored in mousedown events.
300
+ */
301
+ eventsToUnbind.push(
302
+ addEvent(container, 'mousemove', mouseMoveHandler),
303
+ addEvent(container.ownerDocument, 'mouseup', mouseUpHandler),
304
+ addEvent(ctrlLineElem, 'mousedown', mouseDownHandler)
305
+ );
306
+
307
+ // Touch events.
308
+ if (hasTouch) {
309
+ eventsToUnbind.push(
310
+ addEvent(container, 'touchmove', mouseMoveHandler),
311
+ addEvent(container.ownerDocument, 'touchend', mouseUpHandler),
312
+ addEvent(ctrlLineElem, 'touchstart', mouseDownHandler)
313
+ );
314
+ }
315
+
316
+ resizer.eventsToUnbind = eventsToUnbind;
317
+ },
318
+
319
+ /**
320
+ * Mouse move event based on x/y mouse position.
321
+ * @param {Object} e - mouse event.
322
+ */
323
+ onMouseMove: function(e) {
324
+ /*
325
+ * In iOS, a mousemove event with e.pageX === 0 is fired when holding
326
+ * the finger down in the center of the scrollbar. This should
327
+ * be ignored. Borrowed from Navigator.
328
+ */
329
+ if (!e.touches || e.touches[0].pageX !== 0) {
330
+ // Drag the control line
331
+ if (this.grabbed) {
332
+ this.hasDragged = true;
333
+ this.updateAxes(this.axis.chart.pointer.normalize(e).chartY -
334
+ this.options.y);
335
+ }
336
+ }
337
+ },
338
+
339
+ /**
340
+ * Mouse up event based on x/y mouse position.
341
+ * @param {Object} e - mouse event.
342
+ */
343
+ onMouseUp: function(e) {
344
+ if (this.hasDragged) {
345
+ this.updateAxes(this.axis.chart.pointer.normalize(e).chartY -
346
+ this.options.y);
347
+ }
348
+
349
+ // Restore runPointActions.
350
+ this.grabbed = this.hasDragged = this.axis.chart.activeResizer = null;
351
+ },
352
+
353
+ /**
354
+ * Mousedown on a control line.
355
+ * Will store necessary information for drag&drop.
356
+ */
357
+ onMouseDown: function() {
358
+ // Clear all hover effects.
359
+ this.axis.chart.pointer.reset(false, 0);
360
+
361
+ // Disable runPointActions.
362
+ this.grabbed = this.axis.chart.activeResizer = true;
363
+ },
364
+
365
+ /**
366
+ * Update all connected axes after a change of control line position
367
+ */
368
+ updateAxes: function(chartY) {
369
+ var resizer = this,
370
+ chart = resizer.axis.chart,
371
+ axes = resizer.options.controlledAxis,
372
+ nextAxes = axes.next.length === 0 ? [H.inArray(resizer.axis, chart.yAxis) + 1] : axes.next,
373
+ // Main axis is included in the prev array by default
374
+ prevAxes = [resizer.axis].concat(axes.prev),
375
+ axesConfigs = [], // prev and next configs
376
+ stopDrag = false,
377
+ plotTop = chart.plotTop,
378
+ plotHeight = chart.plotHeight,
379
+ plotBottom = plotTop + plotHeight,
380
+ yDelta,
381
+ normalize = function(val, min, max) {
382
+ return Math.round(Math.min(Math.max(val, min), max));
383
+ };
384
+
385
+ // Normalize chartY to plot area limits
386
+ chartY = Math.max(Math.min(chartY, plotBottom), plotTop);
387
+
388
+ yDelta = chartY - resizer.lastPos;
389
+
390
+ // Update on changes of at least 1 pixel in the desired direction
391
+ if (yDelta * yDelta < 1) {
392
+ return;
393
+ }
394
+
395
+ // First gather info how axes should behave
396
+ each([prevAxes, nextAxes], function(axesGroup, isNext) {
397
+ each(axesGroup, function(axisInfo, i) {
398
+ // Axes given as array index, axis object or axis id
399
+ var axis = isNumber(axisInfo) ?
400
+ // If it's a number - it's an index
401
+ chart.yAxis[axisInfo] :
402
+ (
403
+ // If it's first elem. in first group
404
+ (!isNext && !i) ?
405
+ // then it's an Axis object
406
+ axisInfo :
407
+ // else it should be an id
408
+ chart.get(axisInfo)
409
+ ),
410
+ axisOptions = axis && axis.options,
411
+ optionsToUpdate = {},
412
+ hDelta = 0,
413
+ height, top,
414
+ minLength, maxLength;
415
+
416
+ // Skip if axis is not found
417
+ if (!axisOptions) {
418
+ return;
419
+ }
420
+
421
+ top = axis.top;
422
+
423
+ minLength = Math.round(
424
+ relativeLength(
425
+ axisOptions.minLength,
426
+ plotHeight
427
+ )
428
+ );
429
+ maxLength = Math.round(
430
+ relativeLength(
431
+ axisOptions.maxLength,
432
+ plotHeight
433
+ )
434
+ );
435
+
436
+ if (isNext) {
437
+ // Try to change height first. yDelta could had changed
438
+ yDelta = chartY - resizer.lastPos;
439
+
440
+ // Normalize height to option limits
441
+ height = normalize(axis.len - yDelta, minLength, maxLength);
442
+
443
+ // Adjust top, so the axis looks like shrinked from top
444
+ top = axis.top + yDelta;
445
+
446
+ // Check for plot area limits
447
+ if (top + height > plotBottom) {
448
+ hDelta = plotBottom - height - top;
449
+ chartY += hDelta;
450
+ top += hDelta;
451
+ }
452
+
453
+ // Fit to plot - when overflowing on top
454
+ if (top < plotTop) {
455
+ top = plotTop;
456
+ if (top + height > plotBottom) {
457
+ height = plotHeight;
458
+ }
459
+ }
460
+
461
+ // If next axis meets min length, stop dragging:
462
+ if (height === minLength) {
463
+ stopDrag = true;
464
+ }
465
+
466
+ axesConfigs.push({
467
+ axis: axis,
468
+ options: {
469
+ top: Math.round(top),
470
+ height: height
471
+ }
472
+ });
473
+ } else {
474
+ // Normalize height to option limits
475
+ height = normalize(chartY - top, minLength, maxLength);
476
+
477
+ // If prev axis meets max length, stop dragging:
478
+ if (height === maxLength) {
479
+ stopDrag = true;
480
+ }
481
+
482
+ // Check axis size limits
483
+ chartY = top + height;
484
+ axesConfigs.push({
485
+ axis: axis,
486
+ options: {
487
+ height: height
488
+ }
489
+ });
490
+ }
491
+
492
+ optionsToUpdate.height = height;
493
+ });
494
+ });
495
+
496
+ // If we hit the min/maxLength with dragging, don't do anything:
497
+ if (!stopDrag) {
498
+ // Now update axes:
499
+ each(axesConfigs, function(config) {
500
+ config.axis.update(config.options, false);
501
+ });
502
+
503
+ chart.redraw(false);
504
+ }
505
+ },
506
+
507
+ /**
508
+ * Destroy AxisResizer. Clear outside references, clear events,
509
+ * destroy elements, nullify properties.
510
+ */
511
+ destroy: function() {
512
+ var resizer = this,
513
+ axis = resizer.axis;
514
+
515
+ // Clear resizer in axis
516
+ delete axis.resizer;
517
+
518
+ // Clear control line events
519
+ if (this.eventsToUnbind) {
520
+ each(this.eventsToUnbind, function(unbind) {
521
+ unbind();
522
+ });
523
+ }
524
+
525
+ // Destroy AxisResizer elements
526
+ resizer.controlLine.destroy();
527
+
528
+ // Nullify properties
529
+ objectEach(resizer, function(val, key) {
530
+ resizer[key] = null;
531
+ });
532
+ }
533
+ };
534
+
535
+ // Keep resizer reference on axis update
536
+ Axis.prototype.keepProps.push('resizer');
537
+
538
+ // Add new AxisResizer, update or remove it
539
+ wrap(Axis.prototype, 'render', function(proceed) {
540
+ proceed.apply(this, Array.prototype.slice.call(arguments, 1));
541
+
542
+ var axis = this,
543
+ resizer = axis.resizer,
544
+ resizerOptions = axis.options.resize,
545
+ enabled;
546
+
547
+ if (resizerOptions) {
548
+ enabled = resizerOptions.enabled !== false;
549
+
550
+ if (resizer) {
551
+ // Resizer present and enabled
552
+ if (enabled) {
553
+ // Update options
554
+ resizer.init(axis, true);
555
+
556
+ // Resizer present, but disabled
557
+ } else {
558
+ // Destroy the resizer
559
+ resizer.destroy();
560
+ }
561
+ } else {
562
+ // Resizer not present and enabled
563
+ if (enabled) {
564
+ // Add new resizer
565
+ axis.resizer = new H.AxisResizer(axis);
566
+ }
567
+ // Resizer not present and disabled, so do nothing
568
+ }
569
+ }
570
+ });
571
+
572
+ // Clear resizer on axis remove.
573
+ wrap(Axis.prototype, 'destroy', function(proceed, keepEvents) {
574
+ if (!keepEvents && this.resizer) {
575
+ this.resizer.destroy();
576
+ }
577
+ proceed.apply(this, Array.prototype.slice.call(arguments, 1));
578
+ });
579
+
580
+ // Prevent any hover effects while dragging a control line of AxisResizer.
581
+ wrap(Pointer.prototype, 'runPointActions', function(proceed) {
582
+ if (!this.chart.activeResizer) {
583
+ proceed.apply(this, Array.prototype.slice.call(arguments, 1));
584
+ }
585
+ });
586
+
587
+ }(Highcharts));
588
+ }));