highcharts-rails 5.0.6 → 5.0.7

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 +54 -0
  3. data/app/assets/javascripts/highcharts.js +542 -324
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +12 -2
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +41 -47
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +20 -4
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +1 -1
  8. data/app/assets/javascripts/highcharts/modules/boost.js +9 -3
  9. data/app/assets/javascripts/highcharts/modules/broken-axis.js +11 -13
  10. data/app/assets/javascripts/highcharts/modules/data.js +1 -1
  11. data/app/assets/javascripts/highcharts/modules/drilldown.js +28 -13
  12. data/app/assets/javascripts/highcharts/modules/exporting.js +1 -1
  13. data/app/assets/javascripts/highcharts/modules/funnel.js +1 -1
  14. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  15. data/app/assets/javascripts/highcharts/modules/heatmap.js +12 -7
  16. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +1 -1
  17. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +71 -18
  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 +1 -1
  21. data/app/assets/javascripts/highcharts/modules/stock.js +6360 -0
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +88 -90
  23. data/app/assets/javascripts/highcharts/modules/xrange-series.js +5 -1
  24. data/lib/highcharts/version.rb +1 -1
  25. metadata +2 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  *
4
4
  * 3D features for Highcharts JS
5
5
  *
@@ -246,6 +246,7 @@
246
246
  SVGRenderer.prototype.cuboid = function(shapeArgs) {
247
247
 
248
248
  var result = this.g(),
249
+ destroy = result.destroy,
249
250
  paths = this.cuboidPath(shapeArgs);
250
251
 
251
252
 
@@ -358,7 +359,7 @@
358
359
  this.top.destroy();
359
360
  this.side.destroy();
360
361
 
361
- return null;
362
+ return destroy.call(this);
362
363
  };
363
364
 
364
365
  // Apply the Z index to the cuboid group
@@ -1403,6 +1404,15 @@
1403
1404
  proceed.apply(this, [].slice.call(args, 1));
1404
1405
  });
1405
1406
 
1407
+ wrap(Axis.prototype, 'destroy', function(proceed) {
1408
+ each(['backFrame', 'bottomFrame', 'sideFrame'], function(prop) {
1409
+ if (this[prop]) {
1410
+ this[prop] = this[prop].destroy();
1411
+ }
1412
+ }, this);
1413
+ proceed.apply(this, [].slice.call(arguments, 1));
1414
+ });
1415
+
1406
1416
  /***
1407
1417
  Z-AXIS
1408
1418
  ***/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -827,6 +827,7 @@
827
827
  linePath,
828
828
  lowerPath,
829
829
  options = this.options,
830
+ connectEnds = this.chart.polar && options.connectEnds !== false,
830
831
  step = options.step,
831
832
  higherPath,
832
833
  higherAreaPath;
@@ -841,7 +842,10 @@
841
842
  while (i--) {
842
843
  point = points[i];
843
844
 
844
- if (!point.isNull && !options.connectEnds && (!points[i + 1] || points[i + 1].isNull)) {
845
+ if (!point.isNull &&
846
+ !connectEnds &&
847
+ (!points[i + 1] || points[i + 1].isNull)
848
+ ) {
845
849
  highAreaPoints.push({
846
850
  plotX: point.plotX,
847
851
  plotY: point.plotY,
@@ -859,7 +863,11 @@
859
863
  };
860
864
  highAreaPoints.push(pointShim);
861
865
  highPoints.push(pointShim);
862
- if (!point.isNull && !options.connectEnds && (!points[i - 1] || points[i - 1].isNull)) {
866
+
867
+ if (!point.isNull &&
868
+ !connectEnds &&
869
+ (!points[i - 1] || points[i - 1].isNull)
870
+ ) {
863
871
  highAreaPoints.push({
864
872
  plotX: point.plotX,
865
873
  plotY: point.plotY,
@@ -1115,10 +1123,12 @@
1115
1123
 
1116
1124
  point.tooltipPos = chart.inverted ? [
1117
1125
  yAxis.len + yAxis.pos - chart.plotLeft - y - height / 2,
1118
- xAxis.len + xAxis.pos - chart.plotTop - shapeArgs.x - shapeArgs.width / 2,
1126
+ xAxis.len + xAxis.pos - chart.plotTop - shapeArgs.x -
1127
+ shapeArgs.width / 2,
1119
1128
  height
1120
1129
  ] : [
1121
- xAxis.left - chart.plotLeft + shapeArgs.x + shapeArgs.width / 2,
1130
+ xAxis.left - chart.plotLeft + shapeArgs.x +
1131
+ shapeArgs.width / 2,
1122
1132
  yAxis.pos - chart.plotTop + y + height / 2,
1123
1133
  height
1124
1134
  ]; // don't inherit from column tooltip position - #3372
@@ -2197,7 +2207,8 @@
2197
2207
  hover: {
2198
2208
  radiusPlus: 0
2199
2209
  }
2200
- }
2210
+ },
2211
+ symbol: 'circle'
2201
2212
  },
2202
2213
  minSize: 8,
2203
2214
  maxSize: '20%',
@@ -2222,10 +2233,9 @@
2222
2233
  }, {
2223
2234
  pointArrayMap: ['y', 'z'],
2224
2235
  parallelArrays: ['x', 'y', 'z'],
2225
- trackerGroups: ['group', 'dataLabelsGroup'],
2236
+ trackerGroups: ['markerGroup', 'dataLabelsGroup'],
2226
2237
  bubblePadding: true,
2227
2238
  zoneAxis: 'z',
2228
- markerAttribs: null,
2229
2239
 
2230
2240
 
2231
2241
  pointAttribs: function(point, state) {
@@ -2300,16 +2310,26 @@
2300
2310
  if (!init) { // run the animation
2301
2311
  each(this.points, function(point) {
2302
2312
  var graphic = point.graphic,
2303
- shapeArgs = point.shapeArgs;
2313
+ animationTarget;
2304
2314
 
2305
- if (graphic && shapeArgs) {
2306
- // start values
2307
- graphic.attr('r', 1);
2315
+ if (graphic && graphic.width) { // URL symbols don't have width
2316
+ animationTarget = {
2317
+ x: graphic.x,
2318
+ y: graphic.y,
2319
+ width: graphic.width,
2320
+ height: graphic.height
2321
+ };
2308
2322
 
2309
- // animate
2310
- graphic.animate({
2311
- r: shapeArgs.r
2312
- }, animation);
2323
+ // Start values
2324
+ graphic.attr({
2325
+ x: point.plotX,
2326
+ y: point.plotY,
2327
+ width: 1,
2328
+ height: 1
2329
+ });
2330
+
2331
+ // Run animation
2332
+ graphic.animate(animationTarget, animation);
2313
2333
  }
2314
2334
  });
2315
2335
 
@@ -2341,11 +2361,10 @@
2341
2361
 
2342
2362
  if (isNumber(radius) && radius >= this.minPxSize / 2) {
2343
2363
  // Shape arguments
2344
- point.shapeType = 'circle';
2345
- point.shapeArgs = {
2346
- x: point.plotX,
2347
- y: point.plotY,
2348
- r: radius
2364
+ point.marker = {
2365
+ radius: radius,
2366
+ width: 2 * radius,
2367
+ height: 2 * radius
2349
2368
  };
2350
2369
 
2351
2370
  // Alignment box for the data label
@@ -2361,31 +2380,6 @@
2361
2380
  }
2362
2381
  },
2363
2382
 
2364
- /**
2365
- * Get the series' symbol in the legend
2366
- *
2367
- * @param {Object} legend The legend object
2368
- * @param {Object} item The series (this) or point
2369
- */
2370
- drawLegendSymbol: function(legend, item) {
2371
- var renderer = this.chart.renderer,
2372
- radius = renderer.fontMetrics(
2373
- legend.itemStyle && legend.itemStyle.fontSize,
2374
- item.legendItem
2375
- ).f / 2;
2376
-
2377
- item.legendSymbol = renderer.circle(
2378
- radius,
2379
- legend.baseline - radius,
2380
- radius
2381
- ).attr({
2382
- zIndex: 3
2383
- }).add(item.legendGroup);
2384
- item.legendSymbol.isMarker = true;
2385
-
2386
- },
2387
-
2388
- drawPoints: seriesTypes.column.prototype.drawPoints,
2389
2383
  alignDataLabel: seriesTypes.column.prototype.alignDataLabel,
2390
2384
  buildKDTree: noop,
2391
2385
  applyZones: noop
@@ -2395,7 +2389,7 @@
2395
2389
  haloPath: function(size) {
2396
2390
  return Point.prototype.haloPath.call(
2397
2391
  this,
2398
- size === 0 ? 0 : this.shapeArgs.r + size // #6067
2392
+ size === 0 ? 0 : this.marker.radius + size // #6067
2399
2393
  );
2400
2394
  },
2401
2395
  ttBelow: false
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * Accessibility module
4
4
  *
5
5
  * (c) 2010-2016 Highsoft AS
@@ -88,6 +88,21 @@
88
88
  }
89
89
  });
90
90
 
91
+ /**
92
+ * HTML encode some characters vulnerable for XSS.
93
+ * @param {string} html The input string
94
+ * @return {string} The excaped string
95
+ */
96
+ function htmlencode(html) {
97
+ return html
98
+ .replace(/&/g, '&')
99
+ .replace(/</g, '&lt;')
100
+ .replace(/>/g, '&gt;')
101
+ .replace(/"/g, '&quot;')
102
+ .replace(/'/g, '&#x27;')
103
+ .replace(/\//g, '&#x2F;');
104
+ }
105
+
91
106
  // Utility function. Reverses child nodes of a DOM element
92
107
  function reverseChildNodes(node) {
93
108
  var i = node.childNodes.length;
@@ -894,8 +909,9 @@
894
909
 
895
910
  hiddenSection.innerHTML = a11yOptions.screenReaderSectionFormatter && a11yOptions.screenReaderSectionFormatter(chart) ||
896
911
  '<div tabindex="0">Use regions/landmarks to skip ahead to chart' +
897
- (series.length > 1 ? ' and navigate between data series' : '') + '.</div><h3>Summary.</h3><div>' + (options.title.text || 'Chart') +
898
- (options.subtitle && options.subtitle.text ? '. ' + options.subtitle.text : '') +
912
+ (series.length > 1 ? ' and navigate between data series' : '') +
913
+ '.</div><h3>Summary.</h3><div>' + (options.title.text ? htmlencode(options.title.text) : 'Chart') +
914
+ (options.subtitle && options.subtitle.text ? '. ' + htmlencode(options.subtitle.text) : '') +
899
915
  '</div><h3>Long description.</h3><div>' + (options.chart.description || 'No description available.') +
900
916
  '</div><h3>Structure.</h3><div>Chart type: ' + (options.chart.typeDescription || chart.getTypeDescription()) + '</div>' +
901
917
  (series.length === 1 ? '<div>' + chartTypeInfo[0] + ' with ' + series[0].points.length + ' ' +
@@ -947,7 +963,7 @@
947
963
  topLevelColumns = [];
948
964
 
949
965
  // Add SVG title/desc tags
950
- titleElement.textContent = chartTitle;
966
+ titleElement.textContent = htmlencode(chartTitle);
951
967
  titleElement.id = titleId;
952
968
  descElement.parentNode.insertBefore(titleElement, descElement);
953
969
  chart.renderTo.setAttribute('role', 'region');
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * Boost module
4
4
  *
5
5
  * (c) 2010-2016 Highsoft AS
@@ -604,10 +604,16 @@
604
604
  * @returns {Object} A Point object as per http://api.highcharts.com/highcharts#Point
605
605
  */
606
606
  Series.prototype.getPoint = function(boostPoint) {
607
- var point = boostPoint;
607
+ var point = boostPoint,
608
+ xData = this.xData || this.options.xData || this.processedXData || false;
608
609
 
609
610
  if (boostPoint && !(boostPoint instanceof this.pointClass)) {
610
- point = (new this.pointClass()).init(this, this.options.data[boostPoint.i]); // eslint-disable-line new-cap
611
+ point = (new this.pointClass()).init( // eslint-disable-line new-cap
612
+ this,
613
+ this.options.data[boostPoint.i],
614
+ xData ? xData[boostPoint.i] : undefined
615
+ );
616
+
611
617
  point.category = point.x;
612
618
 
613
619
  point.dist = boostPoint.dist;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -24,6 +24,7 @@
24
24
  wrap = H.wrap,
25
25
  each = H.each,
26
26
  extend = H.extend,
27
+ isArray = H.isArray,
27
28
  fireEvent = H.fireEvent,
28
29
  Axis = H.Axis,
29
30
  Series = H.Series;
@@ -100,20 +101,17 @@
100
101
  });
101
102
 
102
103
  wrap(Axis.prototype, 'init', function(proceed, chart, userOptions) {
104
+ var axis = this,
105
+ breaks;
103
106
  // Force Axis to be not-ordinal when breaks are defined
104
107
  if (userOptions.breaks && userOptions.breaks.length) {
105
108
  userOptions.ordinal = false;
106
109
  }
107
-
108
110
  proceed.call(this, chart, userOptions);
109
-
110
- if (this.options.breaks) {
111
-
112
- var axis = this;
113
-
114
- axis.isBroken = true;
115
-
116
- this.val2lin = function(val) {
111
+ breaks = this.options.breaks;
112
+ axis.isBroken = (isArray(breaks) && !!breaks.length);
113
+ if (axis.isBroken) {
114
+ axis.val2lin = function(val) {
117
115
  var nval = val,
118
116
  brk,
119
117
  i;
@@ -133,7 +131,7 @@
133
131
  return nval;
134
132
  };
135
133
 
136
- this.lin2val = function(val) {
134
+ axis.lin2val = function(val) {
137
135
  var nval = val,
138
136
  brk,
139
137
  i;
@@ -151,7 +149,7 @@
151
149
  return nval;
152
150
  };
153
151
 
154
- this.setExtremes = function(newMin, newMax, redraw, animation, eventArguments) {
152
+ axis.setExtremes = function(newMin, newMax, redraw, animation, eventArguments) {
155
153
  // If trying to set extremes inside a break, extend it to before and after the break ( #3857 )
156
154
  while (this.isInAnyBreak(newMin)) {
157
155
  newMin -= this.closestPointRange;
@@ -162,7 +160,7 @@
162
160
  Axis.prototype.setExtremes.call(this, newMin, newMax, redraw, animation, eventArguments);
163
161
  };
164
162
 
165
- this.setAxisTranslation = function(saveOld) {
163
+ axis.setAxisTranslation = function(saveOld) {
166
164
  Axis.prototype.setAxisTranslation.call(this, saveOld);
167
165
 
168
166
  var breaks = axis.options.breaks,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * Data module
4
4
  *
5
5
  * (c) 2012-2016 Torstein Honsi
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * Highcharts Drilldown module
4
4
  *
5
5
  * Author: Torstein Honsi
@@ -403,15 +403,25 @@
403
403
  var newSeries = this,
404
404
  level = newSeries.drilldownLevel;
405
405
 
406
+ // First hide all items before animating in again
406
407
  each(this.points, function(point) {
408
+ var dataLabel = point.dataLabel;
409
+
407
410
  if (point.graphic) { // #3407
408
411
  point.graphic.hide();
409
412
  }
410
- if (point.dataLabel) {
411
- point.dataLabel.hide();
412
- }
413
- if (point.connector) {
414
- point.connector.hide();
413
+
414
+ if (dataLabel) {
415
+ // The data label is initially hidden, make sure it is not faded
416
+ // in (#6127)
417
+ dataLabel.hidden = dataLabel.attr('visibility') === 'hidden';
418
+
419
+ if (!dataLabel.hidden) {
420
+ dataLabel.hide();
421
+ if (point.connector) {
422
+ point.connector.hide();
423
+ }
424
+ }
415
425
  }
416
426
  });
417
427
 
@@ -421,16 +431,21 @@
421
431
  if (newSeries.points) { // May be destroyed in the meantime, #3389
422
432
  each(newSeries.points, function(point, i) {
423
433
  // Fade in other points
424
- var verb = i === (level && level.pointIndex) ? 'show' : 'fadeIn',
425
- inherit = verb === 'show' ? true : undefined;
434
+ var verb =
435
+ i === (level && level.pointIndex) ? 'show' : 'fadeIn',
436
+ inherit = verb === 'show' ? true : undefined,
437
+ dataLabel = point.dataLabel;
438
+
439
+
426
440
  if (point.graphic) { // #3407
427
441
  point.graphic[verb](inherit);
428
442
  }
429
- if (point.dataLabel) {
430
- point.dataLabel[verb](inherit);
431
- }
432
- if (point.connector) {
433
- point.connector[verb](inherit);
443
+
444
+ if (dataLabel && !dataLabel.hidden) { // #6127
445
+ dataLabel[verb](inherit);
446
+ if (point.connector) {
447
+ point.connector[verb](inherit);
448
+ }
434
449
  }
435
450
  });
436
451
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * Exporting module
4
4
  *
5
5
  * (c) 2010-2016 Torstein Honsi
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * Highcharts funnel module
4
4
  *
5
5
  * (c) 2010-2016 Torstein Honsi
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * GridAxis
4
4
  *
5
5
  * (c) 2016 Lars A. V. Cabrera