highcharts-rails 6.0.1 → 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +16 -0
  3. data/app/assets/javascripts/highcharts.js +188 -51
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +3 -4
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +21 -5
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +4 -2
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +2 -2
  8. data/app/assets/javascripts/highcharts/modules/boost-canvas.js +50 -195
  9. data/app/assets/javascripts/highcharts/modules/boost.js +202 -135
  10. data/app/assets/javascripts/highcharts/modules/broken-axis.js +1 -1
  11. data/app/assets/javascripts/highcharts/modules/bullet.js +1 -1
  12. data/app/assets/javascripts/highcharts/modules/data.js +88 -59
  13. data/app/assets/javascripts/highcharts/modules/drag-panes.js +1 -1
  14. data/app/assets/javascripts/highcharts/modules/drilldown.js +25 -2
  15. data/app/assets/javascripts/highcharts/modules/export-data.js +6 -2
  16. data/app/assets/javascripts/highcharts/modules/exporting.js +1 -1
  17. data/app/assets/javascripts/highcharts/modules/funnel.js +1 -1
  18. data/app/assets/javascripts/highcharts/modules/gantt.js +2 -2
  19. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  20. data/app/assets/javascripts/highcharts/modules/heatmap.js +826 -820
  21. data/app/assets/javascripts/highcharts/modules/histogram-bellcurve.js +1 -1
  22. data/app/assets/javascripts/highcharts/modules/item-series.js +1 -1
  23. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +1 -1
  24. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +2 -2
  25. data/app/assets/javascripts/highcharts/modules/oldie.js +16 -2
  26. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +1 -1
  27. data/app/assets/javascripts/highcharts/modules/parallel-coordinates.js +1 -1
  28. data/app/assets/javascripts/highcharts/modules/pareto.js +1 -1
  29. data/app/assets/javascripts/highcharts/modules/sankey.js +39 -9
  30. data/app/assets/javascripts/highcharts/modules/series-label.js +8 -3
  31. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +1 -1
  32. data/app/assets/javascripts/highcharts/modules/static-scale.js +6 -2
  33. data/app/assets/javascripts/highcharts/modules/stock.js +19 -47
  34. data/app/assets/javascripts/highcharts/modules/streamgraph.js +1 -1
  35. data/app/assets/javascripts/highcharts/modules/sunburst.js +40 -15
  36. data/app/assets/javascripts/highcharts/modules/tilemap.js +7 -6
  37. data/app/assets/javascripts/highcharts/modules/treemap.js +13 -3
  38. data/app/assets/javascripts/highcharts/modules/variable-pie.js +1 -1
  39. data/app/assets/javascripts/highcharts/modules/variwide.js +1 -1
  40. data/app/assets/javascripts/highcharts/modules/vector.js +1 -1
  41. data/app/assets/javascripts/highcharts/modules/windbarb.js +1 -1
  42. data/app/assets/javascripts/highcharts/modules/wordcloud.js +130 -37
  43. data/app/assets/javascripts/highcharts/modules/xrange.js +2 -2
  44. data/app/assets/javascripts/highcharts/themes/avocado.js +1 -1
  45. data/app/assets/javascripts/highcharts/themes/dark-blue.js +1 -1
  46. data/app/assets/javascripts/highcharts/themes/dark-green.js +1 -1
  47. data/app/assets/javascripts/highcharts/themes/dark-unica.js +1 -1
  48. data/app/assets/javascripts/highcharts/themes/gray.js +1 -1
  49. data/app/assets/javascripts/highcharts/themes/grid-light.js +1 -1
  50. data/app/assets/javascripts/highcharts/themes/grid.js +1 -1
  51. data/app/assets/javascripts/highcharts/themes/sand-signika.js +1 -1
  52. data/app/assets/javascripts/highcharts/themes/skies.js +1 -1
  53. data/app/assets/javascripts/highcharts/themes/sunset.js +1 -1
  54. data/lib/highcharts/version.rb +1 -1
  55. metadata +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v6.0.1 (2017-10-05)
2
+ * @license Highcharts JS v6.0.2 (2017-10-20)
3
3
  *
4
4
  * 3D features for Highcharts JS
5
5
  *
@@ -2919,7 +2919,6 @@
2919
2919
  wrap = H.wrap;
2920
2920
 
2921
2921
  /**
2922
- * Options to render axis in 3 dimensions.
2923
2922
  * @optionparent xAxis
2924
2923
  */
2925
2924
  var extendedOptions = {
@@ -3013,7 +3012,7 @@
3013
3012
  wrap(Axis.prototype, 'setOptions', function(proceed, userOptions) {
3014
3013
  var options;
3015
3014
  proceed.call(this, userOptions);
3016
- if (this.chart.is3d() && this.coll !== 'colorAxis') {
3015
+ if (this.chart.is3d && this.chart.is3d() && this.coll !== 'colorAxis') {
3017
3016
  options = this.options;
3018
3017
  options.tickWidth = pick(options.tickWidth, 0);
3019
3018
  options.gridLineWidth = pick(options.gridLineWidth, 1);
@@ -3905,7 +3904,7 @@
3905
3904
  function pointAttribs(proceed) {
3906
3905
  var attr = proceed.apply(this, [].slice.call(arguments, 1));
3907
3906
 
3908
- if (this.chart.is3d()) {
3907
+ if (this.chart.is3d && this.chart.is3d()) {
3909
3908
  // Set the fill color to the fill color to provide a smooth edge
3910
3909
  attr.stroke = this.options.edgeColor || attr.fill;
3911
3910
  attr['stroke-width'] = pick(this.options.edgeWidth, 1); // #4055
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v6.0.1 (2017-10-05)
2
+ * @license Highcharts JS v6.0.2 (2017-10-20)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -337,12 +337,28 @@
337
337
  * @product highcharts
338
338
  */
339
339
  backgroundColor: {
340
+ /**
341
+ * Definition of the gradient, similar to SVG: object literal holds
342
+ * start position (x1, y1) and the end position (x2, y2) relative
343
+ * to the shape, where 0 means top/left and 1 is bottom/right.
344
+ * All positions are floats between 0 and 1.
345
+ *
346
+ * @type {Object}
347
+ */
340
348
  linearGradient: {
341
349
  x1: 0,
342
350
  y1: 0,
343
351
  x2: 0,
344
352
  y2: 1
345
353
  },
354
+ /**
355
+ * The stops is an array of tuples, where the first
356
+ * item is a float between 0 and 1 assigning the relative position in
357
+ * the gradient, and the second item is the color.
358
+ *
359
+ * @default [[0, #ffffff], [1, #e6e6e6]]
360
+ * @type {Array<Array>}
361
+ */
346
362
  stops: [
347
363
  [0, '#ffffff'],
348
364
  [1, '#e6e6e6']
@@ -845,8 +861,8 @@
845
861
  options,
846
862
  chartOptions = chart.options,
847
863
  paneIndex = userOptions.pane || 0,
848
- pane = this.pane = chart.pane[paneIndex],
849
- paneOptions = pane.options;
864
+ pane = this.pane = chart.pane && chart.pane[paneIndex],
865
+ paneOptions = pane && pane.options;
850
866
 
851
867
  // Before prototype.init
852
868
  if (angular) {
@@ -873,14 +889,14 @@
873
889
  }
874
890
 
875
891
  // A pointer back to this axis to borrow geometry
876
- if (isCircular) {
892
+ if (pane && isCircular) {
877
893
  pane.axis = this;
878
894
  }
879
895
 
880
896
  // Run prototype.init
881
897
  proceed.call(this, chart, userOptions);
882
898
 
883
- if (!isHidden && (angular || polar)) {
899
+ if (!isHidden && pane && (angular || polar)) {
884
900
  options = this.options;
885
901
 
886
902
  // Start and end angle options are
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v6.0.1 (2017-10-05)
2
+ * @license Highcharts JS v6.0.2 (2017-10-20)
3
3
  * Accessibility module
4
4
  *
5
5
  * (c) 2010-2017 Highsoft AS
@@ -1502,7 +1502,9 @@
1502
1502
  // Handle keyboard events
1503
1503
  addEvent(chart.renderTo, 'keydown', keydownHandler);
1504
1504
  addEvent(chart, 'destroy', function() {
1505
- removeEvent(chart.renderTo, 'keydown', keydownHandler);
1505
+ if (chart.renderTo) {
1506
+ removeEvent(chart.renderTo, 'keydown', keydownHandler);
1507
+ }
1506
1508
  });
1507
1509
  };
1508
1510
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v6.0.1 (2017-10-05)
2
+ * @license Highcharts JS v6.0.2 (2017-10-20)
3
3
  * Annotations module
4
4
  *
5
5
  * (c) 2009-2017 Torstein Honsi
@@ -558,7 +558,7 @@
558
558
  **/
559
559
  style: {
560
560
  fontSize: '11px',
561
- fontWeigth: 'bold',
561
+ fontWeight: 'normal',
562
562
  color: 'contrast'
563
563
  },
564
564
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v6.0.1 (2017-10-05)
2
+ * @license Highcharts JS v6.0.2 (2017-10-20)
3
3
  * Boost module
4
4
  *
5
5
  * (c) 2010-2017 Highsoft AS
@@ -19,51 +19,12 @@
19
19
  /**
20
20
  * License: www.highcharts.com/license
21
21
  * Author: Torstein Honsi, Christer Vasseng
22
- *
23
- * This is an experimental Highcharts module that draws long data series on a canvas
24
- * in order to increase performance of the initial load time and tooltip responsiveness.
25
22
  *
26
- * Compatible with HTML5 canvas compatible browsers (not IE < 9).
23
+ * This module serves as a fallback for the Boost module in IE9 and IE10. Newer
24
+ * browsers support WebGL which is faster.
27
25
  *
28
- *
29
- *
30
- * Development plan
31
- * - Column range.
32
- * - Heatmap. Modify the heatmap-canvas demo so that it uses this module.
33
- * - Treemap.
34
- * - Check how it works with Highstock and data grouping. Currently it only works when navigator.adaptToUpdatedData
35
- * is false. It is also recommended to set scrollbar.liveRedraw to false.
36
- * - Check inverted charts.
37
- * - Check reversed axes.
38
- * - Chart callback should be async after last series is drawn. (But not necessarily, we don't do
39
- that with initial series animation).
40
- * - Cache full-size image so we don't have to redraw on hide/show and zoom up. But k-d-tree still
41
- * needs to be built.
42
- * - Test IE9 and IE10.
43
- * - Stacking is not perhaps not correct since it doesn't use the translation given in
44
- * the translate method. If this gets to complicated, a possible way out would be to
45
- * have a simplified renderCanvas method that simply draws the areaPath on a canvas.
46
- *
47
- * If this module is taken in as part of the core
48
- * - All the loading logic should be merged with core. Update styles in the core.
49
- * - Most of the method wraps should probably be added directly in parent methods.
50
- *
51
- * Notes for boost mode
52
- * - Area lines are not drawn
53
- * - Point markers are not drawn on line-type series
54
- * - Lines are not drawn on scatter charts
55
- * - Zones and negativeColor don't work
56
- * - Initial point colors aren't rendered
57
- * - Columns are always one pixel wide. Don't set the threshold too low.
58
- *
59
- * Optimizing tips for users
60
- * - For scatter plots, use a marker.radius of 1 or less. It results in a rectangle being drawn, which is
61
- * considerably faster than a circle.
62
- * - Set extremes (min, max) explicitly on the axes in order for Highcharts to avoid computing extremes.
63
- * - Set enableMouseTracking to false on the series to improve total rendering time.
64
- * - The default threshold is set based on one series. If you have multiple, dense series, the combined
65
- * number of points drawn gets higher, and you may want to set the threshold lower in order to
66
- * use optimizations.
26
+ * It is recommended to include this module in conditional comments targeting
27
+ * IE9 and IE10.
67
28
  */
68
29
 
69
30
 
@@ -84,43 +45,7 @@
84
45
  CHUNK_SIZE = 50000,
85
46
  destroyLoadingDiv;
86
47
 
87
- function eachAsync(arr, fn, finalFunc, chunkSize, i) {
88
- i = i || 0;
89
- chunkSize = chunkSize || CHUNK_SIZE;
90
-
91
- var threshold = i + chunkSize,
92
- proceed = true;
93
-
94
- while (proceed && i < threshold && i < arr.length) {
95
- proceed = fn(arr[i], i);
96
- i = i + 1;
97
- }
98
- if (proceed) {
99
- if (i < arr.length) {
100
- setTimeout(function() {
101
- eachAsync(arr, fn, finalFunc, chunkSize, i);
102
- });
103
- } else if (finalFunc) {
104
- finalFunc();
105
- }
106
- }
107
- }
108
-
109
- /*
110
- * Returns true if the chart is in series boost mode
111
- * @param chart {Highchart.Chart} - the chart to check
112
- * @returns {Boolean} - true if the chart is in series boost mode
113
- */
114
- function isChartSeriesBoosting(chart) {
115
- var threshold = (chart.options.boost ? chart.options.boost.seriesThreshold : 0) ||
116
- chart.options.chart.seriesBoostThreshold ||
117
- 10;
118
-
119
- return chart.series.length >= threshold;
120
- }
121
-
122
48
  H.initCanvasBoost = function() {
123
-
124
49
  if (H.seriesTypes.heatmap) {
125
50
  H.wrap(H.seriesTypes.heatmap.prototype, 'drawPoints', function() {
126
51
  var ctx = this.getContext();
@@ -157,97 +82,24 @@
157
82
  }
158
83
 
159
84
 
160
- /**
161
- * Override a bunch of methods the same way. If the number of points is below the threshold,
162
- * run the original method. If not, check for a canvas version or do nothing.
163
- */
164
- // each(['translate', 'generatePoints', 'drawTracker', 'drawPoints', 'render'], function (method) {
165
- // function branch(proceed) {
166
- // var letItPass = this.options.stacking && (method === 'translate' || method === 'generatePoints');
167
- // if (((this.processedXData || this.options.data).length < (this.options.boostThreshold || Number.MAX_VALUE) ||
168
- // letItPass) || !isChartSeriesBoosting(this.chart)) {
169
-
170
- // // Clear image
171
- // if (method === 'render' && this.image) {
172
- // this.image.attr({ href: '' });
173
- // this.animate = null; // We're zooming in, don't run animation
174
- // }
175
-
176
- // proceed.call(this);
177
-
178
- // // If a canvas version of the method exists, like renderCanvas(), run
179
- // } else if (this[method + 'Canvas']) {
180
-
181
- // this[method + 'Canvas']();
182
- // }
183
- // }
184
- // wrap(Series.prototype, method, branch);
185
-
186
- // // A special case for some types - its translate method is already wrapped
187
- // if (method === 'translate') {
188
- // each(['arearange', 'bubble', 'column'], function (type) {
189
- // if (seriesTypes[type]) {
190
- // wrap(seriesTypes[type].prototype, method, branch);
191
- // }
192
- // });
193
- // }
194
- // });
195
-
196
85
  H.extend(Series.prototype, {
197
- directTouch: false,
198
- pointRange: 0,
199
- allowDG: false, // No data grouping, let boost handle large data
200
- hasExtremes: function(checkX) {
201
- var options = this.options,
202
- data = options.data,
203
- xAxis = this.xAxis && this.xAxis.options,
204
- yAxis = this.yAxis && this.yAxis.options;
205
- return data.length > (options.boostThreshold || Number.MAX_VALUE) && isNumber(yAxis.min) && isNumber(yAxis.max) &&
206
- (!checkX || (isNumber(xAxis.min) && isNumber(xAxis.max)));
207
- },
208
86
 
209
87
  /**
210
- * If implemented in the core, parts of this can probably be shared with other similar
211
- * methods in Highcharts.
212
- */
213
- destroyGraphics: function() {
214
- var series = this,
215
- points = this.points,
216
- point,
217
- i;
218
-
219
- if (points) {
220
- for (i = 0; i < points.length; i = i + 1) {
221
- point = points[i];
222
- if (point && point.graphic) {
223
- point.graphic = point.graphic.destroy();
224
- }
225
- }
226
- }
227
-
228
- each(['graph', 'area', 'tracker'], function(prop) {
229
- if (series[prop]) {
230
- series[prop] = series[prop].destroy();
231
- }
232
- });
233
- },
234
-
235
- /**
236
- * Create a hidden canvas to draw the graph on. The contents is later copied over
88
+ * Create a hidden canvas to draw the graph on. The contents is later copied over
237
89
  * to an SVG image element.
238
90
  */
239
91
  getContext: function() {
240
92
  var chart = this.chart,
241
93
  width = chart.chartWidth,
242
94
  height = chart.chartHeight,
243
- targetGroup = this.group,
95
+ targetGroup = chart.seriesGroup || this.group,
244
96
  target = this,
245
97
  ctx,
246
98
  swapXY = function(proceed, x, y, a, b, c, d) {
247
99
  proceed.call(this, y, x, a, b, c, d);
248
100
  };
249
101
 
250
- if (isChartSeriesBoosting(chart)) {
102
+ if (chart.isChartSeriesBoosting()) {
251
103
  target = chart;
252
104
  targetGroup = chart.seriesGroup;
253
105
  }
@@ -257,7 +109,7 @@
257
109
  if (!target.canvas) {
258
110
  target.canvas = doc.createElement('canvas');
259
111
 
260
- target.image = chart.renderer.image(
112
+ target.renderTarget = chart.renderer.image(
261
113
  '',
262
114
  0,
263
115
  0,
@@ -273,6 +125,16 @@
273
125
  });
274
126
  }
275
127
 
128
+ target.boostClear = function() {
129
+ ctx.clearRect(0, 0, target.canvas.width, target.canvas.height);
130
+
131
+ if (target.renderTarget) {
132
+ target.renderTarget.attr({
133
+ href: ''
134
+ });
135
+ }
136
+ };
137
+
276
138
  target.boostClipRect = chart.renderer.clipRect(
277
139
  chart.plotLeft,
278
140
  chart.plotTop,
@@ -280,7 +142,7 @@
280
142
  chart.chartHeight
281
143
  );
282
144
 
283
- target.image.clip(target.boostClipRect);
145
+ target.renderTarget.clip(target.boostClipRect);
284
146
 
285
147
  } else if (!(target instanceof H.Chart)) {
286
148
  // ctx.clearRect(0, 0, width, height);
@@ -294,17 +156,18 @@
294
156
  target.canvas.height = height;
295
157
  }
296
158
 
297
- target.image.attr({
159
+ target.renderTarget.attr({
298
160
  x: 0,
299
161
  y: 0,
300
162
  width: width,
301
163
  height: height,
302
- style: 'pointer-events: none'
164
+ style: 'pointer-events: none',
165
+ href: ''
303
166
  });
304
167
 
305
168
  target.boostClipRect.attr({
306
- x: 0,
307
- y: 0,
169
+ x: chart.plotLeft,
170
+ y: chart.plotTop,
308
171
  width: chart.plotWidth,
309
172
  height: chart.chartHeight
310
173
  });
@@ -316,14 +179,12 @@
316
179
  * Draw the canvas image inside an SVG image
317
180
  */
318
181
  canvasToSVG: function() {
319
- if (!isChartSeriesBoosting(this.chart)) {
320
- this.image.attr({
182
+ if (!this.chart.isChartSeriesBoosting()) {
183
+ this.renderTarget.attr({
321
184
  href: this.canvas.toDataURL('image/png')
322
185
  });
323
- } else if (this.image) {
324
- this.image.attr({
325
- href: ''
326
- });
186
+ } else {
187
+ this.boostClear();
327
188
  }
328
189
  },
329
190
 
@@ -453,7 +314,7 @@
453
314
  // Avoid more string concatination than required
454
315
  kdIndex = clientX + ',' + plotY;
455
316
 
456
- // The k-d tree requires series points. Reduce the amount of points, since the time to build the
317
+ // The k-d tree requires series points. Reduce the amount of points, since the time to build the
457
318
  // tree increases exponentially.
458
319
  if (enableMouseTracking && !pointTaken[kdIndex]) {
459
320
  pointTaken[kdIndex] = true;
@@ -487,13 +348,18 @@
487
348
  );
488
349
 
489
350
  series.markerGroup = series.group;
490
- // addEvent(series, 'destroy', function () {
491
- // series.markerGroup = null;
492
- // });
351
+ addEvent(series, 'destroy', function() { // Prevent destroy twice
352
+ series.markerGroup = null;
353
+ });
493
354
 
494
355
  points = this.points = [];
495
356
  ctx = this.getContext();
496
- series.buildKDTree = noop; // Do not start building while drawing
357
+ series.buildKDTree = noop; // Do not start building while drawing
358
+ ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
359
+
360
+ if (!this.visible) {
361
+ return;
362
+ }
497
363
 
498
364
  // Display a loading indicator
499
365
  if (rawData.length > 99999) {
@@ -518,7 +384,7 @@
518
384
  }
519
385
 
520
386
  // Loop over the points
521
- eachAsync(sdata, function(d, i) {
387
+ H.eachAsync(sdata, function(d, i) {
522
388
  var x,
523
389
  y,
524
390
  clientX,
@@ -671,12 +537,6 @@
671
537
  }, 250);
672
538
  }
673
539
 
674
- // Pass tests in Pointer.
675
- // Replace this with a single property, and replace when zooming in
676
- // below boostThreshold.
677
- series.directTouch = false;
678
- series.options.stickyTracking = true;
679
-
680
540
  delete series.buildKDTree; // Go back to prototype, ready to build
681
541
  series.buildKDTree();
682
542
 
@@ -685,18 +545,13 @@
685
545
  }
686
546
  });
687
547
 
688
- wrap(Series.prototype, 'setData', function(proceed) {
689
- if (!this.hasExtremes || !this.hasExtremes(true) || this.type === 'heatmap') {
690
- proceed.apply(this, Array.prototype.slice.call(arguments, 1));
691
- }
548
+ /*
549
+ wrap(Series.prototype, 'setData', function (proceed) {
550
+ if (!this.hasExtremes || !this.hasExtremes(true) || this.type === 'heatmap') {
551
+ proceed.apply(this, Array.prototype.slice.call(arguments, 1));
552
+ }
692
553
  });
693
-
694
- wrap(Series.prototype, 'processData', function(proceed) {
695
- if (!this.hasExtremes || !this.hasExtremes(true) || this.type === 'heatmap') {
696
- proceed.apply(this, Array.prototype.slice.call(arguments, 1));
697
- }
698
- });
699
-
554
+ */
700
555
  seriesTypes.scatter.prototype.cvsMarkerCircle = function(ctx, clientX, plotY, r) {
701
556
  ctx.moveTo(clientX, plotY);
702
557
  ctx.arc(clientX, plotY, r, 0, 2 * Math.PI, false);
@@ -740,16 +595,16 @@
740
595
 
741
596
  H.Chart.prototype.callbacks.push(function(chart) {
742
597
  function canvasToSVG() {
743
- if (chart.image && chart.canvas) {
744
- chart.image.attr({
598
+ if (chart.renderTarget && chart.canvas) {
599
+ chart.renderTarget.attr({
745
600
  href: chart.canvas.toDataURL('image/png')
746
601
  });
747
602
  }
748
603
  }
749
604
 
750
605
  function clear() {
751
- if (chart.image) {
752
- chart.image.attr({
606
+ if (chart.renderTarget) {
607
+ chart.renderTarget.attr({
753
608
  href: ''
754
609
  });
755
610
  }