highcharts-rails 5.0.11 → 5.0.12

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +32 -0
  3. data/app/assets/javascripts/highcharts.js +1199 -379
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +1542 -209
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +6 -1
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +13 -6
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +1 -1
  8. data/app/assets/javascripts/highcharts/modules/boost.js +66 -24
  9. data/app/assets/javascripts/highcharts/modules/broken-axis.js +1 -1
  10. data/app/assets/javascripts/highcharts/modules/data.js +1 -1
  11. data/app/assets/javascripts/highcharts/modules/drilldown.js +6 -44
  12. data/app/assets/javascripts/highcharts/modules/exporting.js +8 -4
  13. data/app/assets/javascripts/highcharts/modules/funnel.js +1 -8
  14. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  15. data/app/assets/javascripts/highcharts/modules/heatmap.js +17 -51
  16. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +19 -10
  17. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +7 -2
  18. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +1 -1
  19. data/app/assets/javascripts/highcharts/modules/series-label.js +1 -1
  20. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +7 -51
  21. data/app/assets/javascripts/highcharts/modules/stock.js +82 -9
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +1 -1
  23. data/app/assets/javascripts/highcharts/modules/xrange-series.js +1 -1
  24. data/lib/highcharts/version.rb +1 -1
  25. metadata +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -917,6 +917,7 @@
917
917
  lowerPath,
918
918
  options = this.options,
919
919
  connectEnds = this.chart.polar && options.connectEnds !== false,
920
+ connectNulls = options.connectNulls,
920
921
  step = options.step,
921
922
  higherPath,
922
923
  higherAreaPath;
@@ -933,6 +934,7 @@
933
934
 
934
935
  if (!point.isNull &&
935
936
  !connectEnds &&
937
+ !connectNulls &&
936
938
  (!points[i + 1] || points[i + 1].isNull)
937
939
  ) {
938
940
  highAreaPoints.push({
@@ -950,11 +952,14 @@
950
952
  plotY: point.plotHigh,
951
953
  isNull: point.isNull
952
954
  };
955
+
953
956
  highAreaPoints.push(pointShim);
957
+
954
958
  highPoints.push(pointShim);
955
959
 
956
960
  if (!point.isNull &&
957
961
  !connectEnds &&
962
+ !connectNulls &&
958
963
  (!points[i - 1] || points[i - 1].isNull)
959
964
  ) {
960
965
  highAreaPoints.push({
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * Accessibility module
4
4
  *
5
5
  * (c) 2010-2017 Highsoft AS
@@ -158,14 +158,21 @@
158
158
  if (point.graphic) {
159
159
  point.graphic.element.setAttribute('role', 'img');
160
160
  point.graphic.element.setAttribute('tabindex', '-1');
161
- point.graphic.element.setAttribute('aria-label', a11yOptions.pointDescriptionFormatter && a11yOptions.pointDescriptionFormatter(point) ||
161
+ point.graphic.element.setAttribute('aria-label',
162
+ point.series.options.pointDescriptionFormatter &&
163
+ point.series.options.pointDescriptionFormatter(point) ||
164
+ a11yOptions.pointDescriptionFormatter &&
165
+ a11yOptions.pointDescriptionFormatter(point) ||
162
166
  point.buildPointInfoString());
163
167
  }
164
168
  });
165
169
  }
166
170
  // Make series element accessible
167
171
  if (this.chart.series.length > 1 || a11yOptions.describeSingleSeries) {
168
- seriesEl.setAttribute('role', 'region');
172
+ seriesEl.setAttribute(
173
+ 'role',
174
+ this.options.exposeElementToA11y ? 'img' : 'region'
175
+ );
169
176
  seriesEl.setAttribute('tabindex', '-1');
170
177
  seriesEl.setAttribute('aria-label', a11yOptions.seriesDescriptionFormatter && a11yOptions.seriesDescriptionFormatter(this) ||
171
178
  this.buildSeriesInfoString());
@@ -414,7 +421,7 @@
414
421
  if (
415
422
  newPoint.isNull &&
416
423
  this.options.accessibility.keyboardNavigation.skipNullPoints ||
417
- newPoint.series.options.skipKeyboardNavigation // docs
424
+ newPoint.series.options.skipKeyboardNavigation
418
425
  ) {
419
426
  this.highlightedPoint = newPoint;
420
427
  return this.highlightAdjacentPoint(next);
@@ -1000,7 +1007,7 @@
1000
1007
  titleElement.id = titleId;
1001
1008
  descElement.parentNode.insertBefore(titleElement, descElement);
1002
1009
  chart.renderTo.setAttribute('role', 'region');
1003
- chart.container.setAttribute('aria-details', hiddenSectionId);
1010
+ //chart.container.setAttribute('aria-details', hiddenSectionId); // JAWS currently doesn't handle this too well
1004
1011
  chart.renderTo.setAttribute('aria-label', 'Interactive chart. ' + chartTitle +
1005
1012
  '. Use up and down arrows to navigate with most screen readers.');
1006
1013
 
@@ -1086,7 +1093,7 @@
1086
1093
 
1087
1094
  // Add accessibility attributes and top level columns
1088
1095
  H.wrap(chart, 'viewData', function(proceed) {
1089
- if (!this.insertedTable) {
1096
+ if (!this.dataTableDiv) {
1090
1097
  proceed.apply(this, Array.prototype.slice.call(arguments, 1));
1091
1098
 
1092
1099
  var table = doc.getElementById(tableId),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  *
4
4
  * (c) 2009-2017 Torstein Honsi
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * Boost module
4
4
  *
5
5
  * (c) 2010-2017 Highsoft AS
@@ -284,6 +284,51 @@
284
284
  yellowgreen: '#9acd32'
285
285
  };
286
286
 
287
+ /**
288
+ * Tolerant max() funciton
289
+ * @return {number} max value
290
+ */
291
+ function patientMax() {
292
+ var args = Array.prototype.slice.call(arguments),
293
+ r = -Number.MAX_VALUE;
294
+
295
+ each(args, function(t) {
296
+ if (typeof t !== 'undefined' && typeof t.length !== 'undefined') {
297
+ //r = r < t.length ? t.length : r;
298
+ if (t.length > 0) {
299
+ r = t.length;
300
+ return true;
301
+ }
302
+ }
303
+ });
304
+
305
+ return r;
306
+ }
307
+
308
+ /*
309
+ * Returns true if we should force chart series boosting
310
+ */
311
+ function shouldForceChartSeriesBoosting(chart) {
312
+ // If there are more than five series currently boosting,
313
+ // we should boost the whole chart to avoid running out of webgl contexts.
314
+ var sboostCount = 0,
315
+ series;
316
+
317
+ if (chart.series.length > 1) {
318
+ for (var i = 0; i < chart.series.length; i++) {
319
+ series = chart.series[i];
320
+ if (patientMax(
321
+ series.processedXData,
322
+ series.options.data,
323
+ series.points
324
+ ) >= (series.options.boostThreshold || Number.MAX_VALUE)) {
325
+ sboostCount++;
326
+ }
327
+ }
328
+ }
329
+
330
+ return sboostCount > 5;
331
+ }
287
332
 
288
333
  /*
289
334
  * Returns true if the chart is in series boost mode
@@ -291,9 +336,9 @@
291
336
  * @returns {Boolean} - true if the chart is in series boost mode
292
337
  */
293
338
  function isChartSeriesBoosting(chart) {
294
- return chart.series.length >= pick(
295
- chart.options.boost && chart.options.boost.seriesThreshold, // docs
296
- 10
339
+ return shouldForceChartSeriesBoosting(chart) || chart.series.length >= pick(
340
+ chart.options.boost && chart.options.boost.seriesThreshold,
341
+ 50
297
342
  );
298
343
  }
299
344
 
@@ -303,23 +348,6 @@
303
348
  * @returns {boolean} - true if the series is in boost mode
304
349
  */
305
350
  function isSeriesBoosting(series) {
306
- function patientMax() {
307
- var args = Array.prototype.slice.call(arguments),
308
- r = -Number.MAX_VALUE;
309
-
310
- each(args, function(t) {
311
- if (typeof t !== 'undefined' && typeof t.length !== 'undefined') {
312
- //r = r < t.length ? t.length : r;
313
- if (t.length > 0) {
314
- r = t.length;
315
- return true;
316
- }
317
- }
318
- });
319
-
320
- return r;
321
- }
322
-
323
351
  return isChartSeriesBoosting(series.chart) ||
324
352
  patientMax(
325
353
  series.processedXData,
@@ -1662,7 +1690,7 @@
1662
1690
  }
1663
1691
 
1664
1692
  //Blending
1665
- if (options.boostBlending === 'add') { // docs
1693
+ if (options.boostBlending === 'add') {
1666
1694
  gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
1667
1695
  gl.blendEquation(gl.FUNC_ADD);
1668
1696
 
@@ -2656,18 +2684,32 @@
2656
2684
 
2657
2685
  /* Clear chart-level canvas */
2658
2686
  function preRender() {
2687
+
2688
+ if (!isChartSeriesBoosting(chart) && chart.didBoost) {
2689
+ chart.didBoost = false;
2690
+ // Clear the canvas
2691
+ if (chart.image) {
2692
+ chart.image.attr({
2693
+ href: ''
2694
+ });
2695
+ }
2696
+ }
2697
+
2659
2698
  if (chart.canvas && chart.ogl && isChartSeriesBoosting(chart)) {
2699
+ chart.didBoost = true;
2700
+
2660
2701
  // Allocate
2661
2702
  chart.ogl.allocateBuffer(chart);
2662
2703
  }
2663
2704
 
2664
- //see #6518
2665
- if (chart.markerGroup) {
2705
+ //see #6518 + #6739
2706
+ if (chart.markerGroup && chart.xAxis && chart.xAxis.length > 0 && chart.yAxis && chart.yAxis.length > 0) {
2666
2707
  chart.markerGroup.translate(
2667
2708
  chart.xAxis[0].pos,
2668
2709
  chart.yAxis[0].pos
2669
2710
  );
2670
2711
  }
2712
+
2671
2713
  }
2672
2714
 
2673
2715
  addEvent(chart, 'predraw', preRender);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  *
4
4
  * (c) 2009-2017 Torstein Honsi
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * Data module
4
4
  *
5
5
  * (c) 2012-2017 Torstein Honsi
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * Highcharts Drilldown module
4
4
  *
5
5
  * Author: Torstein Honsi
@@ -42,49 +42,6 @@
42
42
  inArray = H.inArray,
43
43
  ddSeriesId = 1;
44
44
 
45
- // Utilities
46
- /*
47
- * Return an intermediate color between two colors, according to pos where 0
48
- * is the from color and 1 is the to color. This method is copied from ColorAxis.js
49
- * and should always be kept updated, until we get AMD support.
50
- */
51
- function tweenColors(from, to, pos) {
52
- // Check for has alpha, because rgba colors perform worse due to lack of
53
- // support in WebKit.
54
- var hasAlpha,
55
- ret;
56
-
57
- // Unsupported color, return to-color (#3920)
58
- if (!to.rgba.length || !from.rgba.length) {
59
- ret = to.input || 'none';
60
-
61
- // Interpolate
62
- } else {
63
- from = from.rgba;
64
- to = to.rgba;
65
- hasAlpha = (to[3] !== 1 || from[3] !== 1);
66
- ret = (hasAlpha ? 'rgba(' : 'rgb(') +
67
- Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
68
- Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
69
- Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
70
- (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
71
- }
72
- return ret;
73
- }
74
- /**
75
- * Handle animation of the color attributes directly
76
- */
77
- each(['fill', 'stroke'], function(prop) {
78
- H.Fx.prototype[prop + 'Setter'] = function() {
79
- this.elem.attr(
80
- prop,
81
- tweenColors(color(this.start), color(this.end), this.pos),
82
- null,
83
- true
84
- );
85
- };
86
- });
87
-
88
45
  // Add language
89
46
  extend(defaultOptions.lang, {
90
47
  drillUpText: '◁ Back to {series.name}'
@@ -233,6 +190,11 @@
233
190
  // Push it to the lookup array
234
191
  this.drilldownLevels.push(level);
235
192
 
193
+ // Reset names to prevent extending (#6704)
194
+ if (xAxis && xAxis.names) {
195
+ xAxis.names.length = 0;
196
+ }
197
+
236
198
  newSeries = level.lowerSeries = this.addSeries(ddOptions, false);
237
199
  newSeries.options._levelNumber = levelNumber + 1;
238
200
  if (xAxis) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * Exporting module
4
4
  *
5
5
  * (c) 2010-2017 Torstein Honsi
@@ -42,9 +42,11 @@
42
42
  extend = H.extend,
43
43
  isTouchDevice = H.isTouchDevice,
44
44
  win = H.win,
45
- SVGRenderer = H.SVGRenderer;
46
-
47
- var symbols = H.Renderer.prototype.symbols;
45
+ userAgent = win.navigator.userAgent,
46
+ SVGRenderer = H.SVGRenderer,
47
+ symbols = H.Renderer.prototype.symbols,
48
+ isMSBrowser = /Edge\/|Trident\/|MSIE /.test(userAgent),
49
+ isFirefoxBrowser = /firefox/i.test(userAgent);
48
50
 
49
51
  // Add language
50
52
  extend(defaultOptions.lang, {
@@ -436,6 +438,8 @@
436
438
  * PDF type and custom filename
437
439
  * @sample highcharts/members/chart-exportchart-custom-background/
438
440
  * Different chart background in export
441
+ * @sample stock/members/chart-exportchart/
442
+ * Export with Highstock
439
443
  */
440
444
  exportChart: function(exportingOptions, chartOptions) {
441
445
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * Highcharts funnel module
4
4
  *
5
5
  * (c) 2010-2017 Torstein Honsi
@@ -230,13 +230,6 @@
230
230
  }
231
231
  });
232
232
  },
233
- /**
234
- * Draw a single point (wedge)
235
- * @param {Object} point The point object
236
- * @param {Object} color The color of the point
237
- * @param {Number} brightness The brightness relative to the color
238
- */
239
- drawPoints: seriesTypes.column.prototype.drawPoints,
240
233
 
241
234
  /**
242
235
  * Funnel items don't have angles (#2289)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  * GridAxis
4
4
  *
5
5
  * (c) 2016 Lars A. V. Cabrera
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  *
4
4
  * (c) 2009-2017 Torstein Honsi
5
5
  *
@@ -106,7 +106,7 @@
106
106
  if (userOptions.dataClasses) {
107
107
  this.initDataClasses(userOptions);
108
108
  }
109
- this.initStops(userOptions);
109
+ this.initStops();
110
110
 
111
111
  // Override original axis properties
112
112
  this.horiz = horiz;
@@ -116,39 +116,8 @@
116
116
  this.defaultLegendLength = 200;
117
117
  },
118
118
 
119
- /*
120
- * Return an intermediate color between two colors, according to pos where 0
121
- * is the from color and 1 is the to color.
122
- * NOTE: Changes here should be copied
123
- * to the same function in drilldown.src.js and solid-gauge-src.js.
124
- */
125
- tweenColors: function(from, to, pos) {
126
- // Check for has alpha, because rgba colors perform worse due to lack of
127
- // support in WebKit.
128
- var hasAlpha,
129
- ret;
130
-
131
- // Unsupported color, return to-color (#3920)
132
- if (!to.rgba.length || !from.rgba.length) {
133
- ret = to.input || 'none';
134
-
135
- // Interpolate
136
- } else {
137
- from = from.rgba;
138
- to = to.rgba;
139
- hasAlpha = (to[3] !== 1 || from[3] !== 1);
140
- ret = (hasAlpha ? 'rgba(' : 'rgb(') +
141
- Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
142
- Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
143
- Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
144
- (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
145
- }
146
- return ret;
147
- },
148
-
149
119
  initDataClasses: function(userOptions) {
150
- var axis = this,
151
- chart = this.chart,
120
+ var chart = this.chart,
152
121
  dataClasses,
153
122
  colorCounter = 0,
154
123
  colorCount = chart.options.chart.colorCount,
@@ -177,8 +146,7 @@
177
146
  colorCounter = 0;
178
147
  }
179
148
  } else {
180
- dataClass.color = axis.tweenColors(
181
- color(options.minColor),
149
+ dataClass.color = color(options.minColor).tweenTo(
182
150
  color(options.maxColor),
183
151
  len < 2 ? 0.5 : i / (len - 1) // #3219
184
152
  );
@@ -187,8 +155,8 @@
187
155
  });
188
156
  },
189
157
 
190
- initStops: function(userOptions) {
191
- this.stops = userOptions.stops || [
158
+ initStops: function() {
159
+ this.stops = this.options.stops || [
192
160
  [0, this.options.minColor],
193
161
  [1, this.options.maxColor]
194
162
  ];
@@ -232,6 +200,13 @@
232
200
  }
233
201
  },
234
202
 
203
+ normalizedValue: function(value) {
204
+ if (this.isLog) {
205
+ value = this.val2lin(value);
206
+ }
207
+ return 1 - ((this.max - value) / ((this.max - this.min) || 1));
208
+ },
209
+
235
210
  /**
236
211
  * Translate from a value to a color
237
212
  */
@@ -263,10 +238,7 @@
263
238
 
264
239
  } else {
265
240
 
266
- if (this.isLog) {
267
- value = this.val2lin(value);
268
- }
269
- pos = 1 - ((this.max - value) / ((this.max - this.min) || 1));
241
+ pos = this.normalizedValue(value);
270
242
  i = stops.length;
271
243
  while (i--) {
272
244
  if (pos > stops[i][0]) {
@@ -279,8 +251,7 @@
279
251
  // The position within the gradient
280
252
  pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
281
253
 
282
- color = this.tweenColors(
283
- from.color,
254
+ color = from.color.tweenTo(
284
255
  to.color,
285
256
  pos
286
257
  );
@@ -322,7 +293,6 @@
322
293
  setLegendColor: function() {
323
294
  var grad,
324
295
  horiz = this.horiz,
325
- options = this.options,
326
296
  reversed = this.reversed,
327
297
  one = reversed ? 1 : 0,
328
298
  zero = reversed ? 0 : 1;
@@ -335,10 +305,7 @@
335
305
  x2: grad[2],
336
306
  y2: grad[3]
337
307
  },
338
- stops: options.stops || [
339
- [0, options.minColor],
340
- [1, options.maxColor]
341
- ]
308
+ stops: this.stops
342
309
  };
343
310
  },
344
311
 
@@ -538,8 +505,7 @@
538
505
  H.Fx.prototype[prop + 'Setter'] = function() {
539
506
  this.elem.attr(
540
507
  prop,
541
- ColorAxis.prototype.tweenColors(
542
- color(this.start),
508
+ color(this.start).tweenTo(
543
509
  color(this.end),
544
510
  this.pos
545
511
  ),