highcharts-rails 4.2.0 → 4.2.2

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.
@@ -2,7 +2,7 @@
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
4
  /**
5
- * @license Highcharts JS v4.2.0 (2105-12-15)
5
+ * @license Highcharts JS v4.2.2 (2016-02-04)
6
6
  *
7
7
  * 3D features for Highcharts JS
8
8
  *
@@ -251,7 +251,7 @@
251
251
  this.top.attr({ d: paths[1], zIndex: paths[4] });
252
252
  this.side.attr({ d: paths[2], zIndex: paths[5] });
253
253
  } else {
254
- Highcharts.SVGElement.prototype.attr.call(this, args);
254
+ return Highcharts.SVGElement.prototype.attr.call(this, args); // getter returns value
255
255
  }
256
256
 
257
257
  return this;
@@ -263,6 +263,9 @@
263
263
  this.front.attr({ zIndex: paths[3] }).animate({ d: paths[0] }, duration, complete);
264
264
  this.top.attr({ zIndex: paths[4] }).animate({ d: paths[1] }, duration, complete);
265
265
  this.side.attr({ zIndex: paths[5] }).animate({ d: paths[2] }, duration, complete);
266
+ this.attr({
267
+ zIndex: -paths[6] // #4774
268
+ });
266
269
  } else if (args.opacity) {
267
270
  this.front.animate(args, duration, complete);
268
271
  this.top.animate(args, duration, complete);
@@ -283,7 +286,7 @@
283
286
  };
284
287
 
285
288
  // Apply the Z index to the cuboid group
286
- result.attr({ zIndex: -paths[3] });
289
+ result.attr({ zIndex: -paths[6] });
287
290
 
288
291
  return result;
289
292
  };
@@ -321,15 +324,13 @@
321
324
  return pArr[i];
322
325
  }
323
326
  var pickShape = function (path1, path2) {
324
- var ret;
327
+ var ret = [];
325
328
  path1 = map(path1, mapPath);
326
329
  path2 = map(path2, mapPath);
327
330
  if (shapeArea(path1) < 0) {
328
331
  ret = path1;
329
332
  } else if (shapeArea(path2) < 0) {
330
333
  ret = path2;
331
- } else {
332
- ret = [];
333
334
  }
334
335
  return ret;
335
336
  };
@@ -349,7 +350,7 @@
349
350
  var left = [0, 7, 4, 3];
350
351
  var path3 = pickShape(right, left);
351
352
 
352
- return [this.toLinePath(path1, true), this.toLinePath(path2, true), this.toLinePath(path3, true), averageZ(path1), averageZ(path2), averageZ(path3)];
353
+ return [this.toLinePath(path1, true), this.toLinePath(path2, true), this.toLinePath(path3, true), averageZ(path1), averageZ(path2), averageZ(path3), averageZ(map(bottom, mapPath)) * 9e9]; // #4774
353
354
  };
354
355
 
355
356
  ////// SECTORS //////
@@ -747,7 +748,7 @@
747
748
  plotOptions,
748
749
  pieOptions;
749
750
 
750
- if (args[0].chart.options3d && args[0].chart.options3d.enabled) {
751
+ if (args[0].chart && args[0].chart.options3d && args[0].chart.options3d.enabled) {
751
752
  // Normalize alpha and beta to (-360, 360) range
752
753
  args[0].chart.options3d.alpha = (args[0].chart.options3d.alpha || 0) % 360;
753
754
  args[0].chart.options3d.beta = (args[0].chart.options3d.beta || 0) % 360;
@@ -2,9 +2,9 @@
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
4
  /**
5
- * @license Highcharts JS v4.2.0 (2105-12-15)
5
+ * @license Highcharts JS v4.2.2 (2016-02-04)
6
6
  *
7
- * (c) 2009-2014 Torstein Honsi
7
+ * (c) 2009-2016 Torstein Honsi
8
8
  *
9
9
  * License: www.highcharts.com/license
10
10
  */
@@ -563,6 +563,17 @@ var arrayMin = Highcharts.arrayMin,
563
563
 
564
564
  });
565
565
 
566
+ /**
567
+ * Wrap auto label align to avoid setting axis-wide rotation on radial axes (#4920)
568
+ * @param {Function} proceed
569
+ * @returns {String} Alignment
570
+ */
571
+ wrap(axisProto, 'autoLabelAlign', function (proceed) {
572
+ if (!this.isRadial) {
573
+ return proceed.apply(this, [].slice.call(arguments, 1));
574
+ } // else return undefined
575
+ });
576
+
566
577
  /**
567
578
  * Add special cases within the Tick class' methods for radial axes.
568
579
  */
@@ -709,22 +720,6 @@ var arrayMin = Highcharts.arrayMin,
709
720
  point.plotHigh = xy.y - chart.plotTop;
710
721
  },
711
722
 
712
- /**
713
- * Extend getSegments to force null points if the higher value is null. #1703.
714
- */
715
- getSegments: function () {
716
- var series = this;
717
-
718
- each(series.points, function (point) {
719
- if (!series.options.connectNulls && (point.low === null || point.high === null)) {
720
- point.y = null;
721
- } else if (point.low === null && point.high !== null) {
722
- point.y = point.high;
723
- }
724
- });
725
- Series.prototype.getSegments.call(this);
726
- },
727
-
728
723
  /**
729
724
  * Translate data points from raw values x and y to plotX and plotY
730
725
  */
@@ -741,14 +736,8 @@ var arrayMin = Highcharts.arrayMin,
741
736
  high = point.high,
742
737
  plotY = point.plotY;
743
738
 
744
- if (high === null && low === null) {
745
- point.y = null;
746
- } else if (low === null) {
747
- point.plotLow = point.plotY = null;
748
- point.plotHigh = yAxis.translate(high, 0, 1, 0, 1);
749
- } else if (high === null) {
750
- point.plotLow = plotY;
751
- point.plotHigh = null;
739
+ if (high === null || low === null) {
740
+ point.isNull = true;
752
741
  } else {
753
742
  point.plotLow = plotY;
754
743
  point.plotHigh = yAxis.translate(high, 0, 1, 0, 1);
@@ -767,44 +756,60 @@ var arrayMin = Highcharts.arrayMin,
767
756
  * Extend the line series' getSegmentPath method by applying the segment
768
757
  * path to both lower and higher values of the range
769
758
  */
770
- getSegmentPath: function (segment) {
771
-
772
- var lowSegment,
773
- highSegment = [],
774
- i = segment.length,
775
- baseGetSegmentPath = Series.prototype.getSegmentPath,
759
+ getGraphPath: function () {
760
+
761
+ var points = this.points,
762
+ highPoints = [],
763
+ highAreaPoints = [],
764
+ i = points.length,
765
+ getGraphPath = Series.prototype.getGraphPath,
776
766
  point,
767
+ pointShim,
777
768
  linePath,
778
769
  lowerPath,
779
770
  options = this.options,
780
771
  step = options.step,
781
- higherPath;
782
-
783
- // Remove nulls from low segment
784
- lowSegment = Highcharts.grep(segment, function (point) {
785
- return point.plotLow !== null;
786
- });
772
+ higherPath,
773
+ higherAreaPath;
787
774
 
788
- // Make a segment with plotX and plotY for the top values
775
+ // Create the top line and the top part of the area fill. The area fill compensates for
776
+ // null points by drawing down to the lower graph, moving across the null gap and
777
+ // starting again at the lower graph.
778
+ i = points.length;
789
779
  while (i--) {
790
- point = segment[i];
791
- if (point.plotHigh !== null) {
792
- highSegment.push({
793
- plotX: point.plotHighX || point.plotX, // plotHighX is for polar charts
794
- plotY: point.plotHigh
780
+ point = points[i];
781
+
782
+ if (!point.isNull && (!points[i + 1] || points[i + 1].isNull)) {
783
+ highAreaPoints.push({
784
+ plotX: point.plotX,
785
+ plotY: point.plotLow
786
+ });
787
+ }
788
+ pointShim = {
789
+ plotX: point.plotX,
790
+ plotY: point.plotHigh,
791
+ isNull: point.isNull
792
+ };
793
+ highAreaPoints.push(pointShim);
794
+ highPoints.push(pointShim);
795
+ if (!point.isNull && (!points[i - 1] || points[i - 1].isNull)) {
796
+ highAreaPoints.push({
797
+ plotX: point.plotX,
798
+ plotY: point.plotLow
795
799
  });
796
800
  }
797
801
  }
798
802
 
799
803
  // Get the paths
800
- lowerPath = baseGetSegmentPath.call(this, lowSegment);
804
+ lowerPath = getGraphPath.call(this, points);
801
805
  if (step) {
802
806
  if (step === true) {
803
807
  step = 'left';
804
808
  }
805
- options.step = { left: 'right', center: 'center', right: 'left' }[step]; // swap for reading in getSegmentPath
809
+ options.step = { left: 'right', center: 'center', right: 'left' }[step]; // swap for reading in getGraphPath
806
810
  }
807
- higherPath = baseGetSegmentPath.call(this, highSegment);
811
+ higherPath = getGraphPath.call(this, highPoints);
812
+ higherAreaPath = getGraphPath.call(this, highAreaPoints);
808
813
  options.step = step;
809
814
 
810
815
  // Create a line on both top and bottom of the range
@@ -812,10 +817,10 @@ var arrayMin = Highcharts.arrayMin,
812
817
 
813
818
  // For the area path, we need to change the 'move' statement into 'lineTo' or 'curveTo'
814
819
  if (!this.chart.polar) {
815
- higherPath[0] = 'L'; // this probably doesn't work for spline
820
+ higherAreaPath[0] = 'L'; // this probably doesn't work for spline
816
821
  }
817
- this.areaPath = this.areaPath.concat(lowerPath, higherPath);
818
-
822
+ this.areaPath = this.areaPath.concat(lowerPath, higherAreaPath);
823
+
819
824
  return linePath;
820
825
  },
821
826
 
@@ -1289,7 +1294,7 @@ var arrayMin = Highcharts.arrayMin,
1289
1294
  //stemWidth: null,
1290
1295
  threshold: null,
1291
1296
  tooltip: {
1292
- pointFormat: '<span style="color:{point.color}">\u25CF</span> <b> {series.name}</b><br/>' + // docs
1297
+ pointFormat: '<span style="color:{point.color}">\u25CF</span> <b> {series.name}</b><br/>' +
1293
1298
  'Maximum: {point.high}<br/>' +
1294
1299
  'Upper quartile: {point.q3}<br/>' +
1295
1300
  'Median: {point.median}<br/>' +
@@ -1551,7 +1556,7 @@ var arrayMin = Highcharts.arrayMin,
1551
1556
  grouping: false,
1552
1557
  linkedTo: ':previous',
1553
1558
  tooltip: {
1554
- pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>' // docs
1559
+ pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'
1555
1560
  },
1556
1561
  whiskerWidth: null
1557
1562
  });
@@ -1627,12 +1632,14 @@ var arrayMin = Highcharts.arrayMin,
1627
1632
  previousY,
1628
1633
  previousIntermediate,
1629
1634
  range,
1635
+ minPointLength = pick(options.minPointLength, 5),
1630
1636
  threshold = options.threshold,
1631
1637
  stacking = options.stacking,
1632
1638
  tooltipY;
1633
1639
 
1634
1640
  // run column series translate
1635
1641
  seriesTypes.column.prototype.translate.apply(this);
1642
+ series.minPointLengthOffset = 0;
1636
1643
 
1637
1644
  previousY = previousIntermediate = threshold;
1638
1645
  points = series.points;
@@ -1664,11 +1671,11 @@ var arrayMin = Highcharts.arrayMin,
1664
1671
  // sum points
1665
1672
  if (point.isSum) {
1666
1673
  shapeArgs.y = yAxis.translate(range[1], 0, 1);
1667
- shapeArgs.height = Math.min(yAxis.translate(range[0], 0, 1), yAxis.len) - shapeArgs.y; // #4256
1674
+ shapeArgs.height = Math.min(yAxis.translate(range[0], 0, 1), yAxis.len) - shapeArgs.y + series.minPointLengthOffset; // #4256
1668
1675
 
1669
1676
  } else if (point.isIntermediateSum) {
1670
1677
  shapeArgs.y = yAxis.translate(range[1], 0, 1);
1671
- shapeArgs.height = Math.min(yAxis.translate(previousIntermediate, 0, 1), yAxis.len) - shapeArgs.y;
1678
+ shapeArgs.height = Math.min(yAxis.translate(previousIntermediate, 0, 1), yAxis.len) - shapeArgs.y + series.minPointLengthOffset;
1672
1679
  previousIntermediate = range[1];
1673
1680
 
1674
1681
  // If it's not the sum point, update previous stack end position and get
@@ -1691,8 +1698,15 @@ var arrayMin = Highcharts.arrayMin,
1691
1698
  shapeArgs.height = mathMax(mathRound(shapeArgs.height), 0.001); // #3151
1692
1699
  point.yBottom = shapeArgs.y + shapeArgs.height;
1693
1700
 
1701
+ if (shapeArgs.height <= minPointLength) {
1702
+ shapeArgs.height = minPointLength;
1703
+ series.minPointLengthOffset += minPointLength;
1704
+ }
1705
+
1706
+ shapeArgs.y -= series.minPointLengthOffset;
1707
+
1694
1708
  // Correct tooltip placement (#3014)
1695
- tooltipY = point.plotY + (point.negative ? shapeArgs.height : 0);
1709
+ tooltipY = point.plotY + (point.negative ? shapeArgs.height : 0) - series.minPointLengthOffset;
1696
1710
  if (series.chart.inverted) {
1697
1711
  point.tooltipPos[0] = yAxis.len - tooltipY;
1698
1712
  } else {
@@ -2283,40 +2297,6 @@ var arrayMin = Highcharts.arrayMin,
2283
2297
  }
2284
2298
  };
2285
2299
 
2286
- /**
2287
- * Add some special init logic to areas and areasplines
2288
- */
2289
- function initArea(proceed, chart, options) {
2290
- proceed.call(this, chart, options);
2291
- if (this.chart.polar) {
2292
-
2293
- /**
2294
- * Overridden method to close a segment path. While in a cartesian plane the area
2295
- * goes down to the threshold, in the polar chart it goes to the center.
2296
- */
2297
- this.closeSegment = function (path) {
2298
- var center = this.xAxis.center;
2299
- path.push(
2300
- 'L',
2301
- center[0],
2302
- center[1]
2303
- );
2304
- };
2305
-
2306
- // Instead of complicated logic to draw an area around the inner area in a stack,
2307
- // just draw it behind
2308
- this.closedStacks = true;
2309
- }
2310
- }
2311
-
2312
-
2313
- if (seriesTypes.area) {
2314
- wrap(seriesTypes.area.prototype, 'init', initArea);
2315
- }
2316
- if (seriesTypes.areaspline) {
2317
- wrap(seriesTypes.areaspline.prototype, 'init', initArea);
2318
- }
2319
-
2320
2300
  if (seriesTypes.spline) {
2321
2301
  /**
2322
2302
  * Overridden method for calculating a spline from one point to the next
@@ -2455,20 +2435,29 @@ var arrayMin = Highcharts.arrayMin,
2455
2435
  * Extend getSegmentPath to allow connecting ends across 0 to provide a closed circle in
2456
2436
  * line-like series.
2457
2437
  */
2458
- wrap(seriesProto, 'getSegmentPath', function (proceed, segment) {
2459
-
2460
- var points = this.points;
2461
-
2438
+ wrap(seriesProto, 'getGraphPath', function (proceed, points) {
2439
+ var series = this;
2440
+
2462
2441
  // Connect the path
2463
- if (this.chart.polar && this.options.connectEnds !== false &&
2464
- segment[segment.length - 1] === points[points.length - 1] && points[0].y !== null) {
2465
- this.connectEnds = true; // re-used in splines
2466
- segment = [].concat(segment, [points[0]]);
2442
+ if (this.chart.polar) {
2443
+ points = points || this.points;
2444
+
2445
+ if (this.options.connectEnds !== false && points[0].y !== null) {
2446
+ this.connectEnds = true; // re-used in splines
2447
+ points.splice(points.length, 0, points[0]);
2448
+ }
2449
+
2450
+ // For area charts, pseudo points are added to the graph, now we need to translate these
2451
+ each(points, function (point) {
2452
+ if (point.polarPlotY === undefined) {
2453
+ series.toXY(point);
2454
+ }
2455
+ });
2467
2456
  }
2468
2457
 
2469
2458
  // Run uber method
2470
- return proceed.call(this, segment);
2471
-
2459
+ return proceed.apply(this, [].slice.call(arguments, 1));
2460
+
2472
2461
  });
2473
2462
 
2474
2463
 
@@ -68,18 +68,28 @@
68
68
  pick = H.pick,
69
69
  wrap = H.wrap,
70
70
  plotOptions = H.getOptions().plotOptions,
71
- CHUNK_SIZE = 50000;
71
+ CHUNK_SIZE = 50000,
72
+ destroyLoadingDiv;
72
73
 
73
74
  function eachAsync(arr, fn, finalFunc, chunkSize, i) {
74
75
  i = i || 0;
75
76
  chunkSize = chunkSize || CHUNK_SIZE;
76
- each(arr.slice(i, i + chunkSize), fn);
77
- if (i + chunkSize < arr.length) {
78
- setTimeout(function () {
79
- eachAsync(arr, fn, finalFunc, chunkSize, i + chunkSize);
80
- });
81
- } else if (finalFunc) {
82
- finalFunc();
77
+
78
+ var threshold = i + chunkSize,
79
+ proceed = true;
80
+
81
+ while (proceed && i < threshold && i < arr.length) {
82
+ proceed = fn(arr[i], i);
83
+ i = i + 1;
84
+ }
85
+ if (proceed) {
86
+ if (i < arr.length) {
87
+ setTimeout(function () {
88
+ eachAsync(arr, fn, finalFunc, chunkSize, i);
89
+ });
90
+ } else if (finalFunc) {
91
+ finalFunc();
92
+ }
83
93
  }
84
94
  }
85
95
 
@@ -240,7 +250,6 @@
240
250
  xAxis = this.xAxis,
241
251
  yAxis = this.yAxis,
242
252
  ctx,
243
- i,
244
253
  c = 0,
245
254
  xData = series.processedXData,
246
255
  yData = series.processedYData,
@@ -382,112 +391,106 @@
382
391
  opacity: 1
383
392
  }
384
393
  });
394
+ clearTimeout(destroyLoadingDiv);
385
395
  chart.showLoading('Drawing...');
386
396
  chart.options.loading = loadingOptions; // reset
387
- if (chart.loadingShown === true) {
388
- chart.loadingShown = 1;
389
- } else {
390
- chart.loadingShown = chart.loadingShown + 1;
391
- }
392
397
  }
393
398
 
394
399
  // Loop over the points
395
- i = 0;
396
- eachAsync(isStacked ? series.data : (xData || rawData), function (d) {
397
-
400
+ eachAsync(isStacked ? series.data : (xData || rawData), function (d, i) {
398
401
  var x,
399
402
  y,
400
403
  clientX,
401
404
  plotY,
402
405
  isNull,
403
406
  low,
407
+ chartDestroyed = typeof chart.index === 'undefined',
404
408
  isYInside = true;
405
409
 
406
- if (useRaw) {
407
- x = d[0];
408
- y = d[1];
409
- } else {
410
- x = d;
411
- y = yData[i];
412
- }
413
-
414
- // Resolve low and high for range series
415
- if (isRange) {
410
+ if (!chartDestroyed) {
416
411
  if (useRaw) {
417
- y = d.slice(1, 3);
412
+ x = d[0];
413
+ y = d[1];
414
+ } else {
415
+ x = d;
416
+ y = yData[i];
418
417
  }
419
- low = y[0];
420
- y = y[1];
421
- } else if (isStacked) {
422
- x = d.x;
423
- y = d.stackY;
424
- low = y - d.y;
425
- }
426
418
 
427
- isNull = y === null;
419
+ // Resolve low and high for range series
420
+ if (isRange) {
421
+ if (useRaw) {
422
+ y = d.slice(1, 3);
423
+ }
424
+ low = y[0];
425
+ y = y[1];
426
+ } else if (isStacked) {
427
+ x = d.x;
428
+ y = d.stackY;
429
+ low = y - d.y;
430
+ }
428
431
 
429
- // Optimize for scatter zooming
430
- if (!requireSorting) {
431
- isYInside = y >= yMin && y <= yMax;
432
- }
432
+ isNull = y === null;
433
433
 
434
- if (!isNull && x >= xMin && x <= xMax && isYInside) {
434
+ // Optimize for scatter zooming
435
+ if (!requireSorting) {
436
+ isYInside = y >= yMin && y <= yMax;
437
+ }
435
438
 
436
- clientX = Math.round(xAxis.toPixels(x, true));
439
+ if (!isNull && x >= xMin && x <= xMax && isYInside) {
437
440
 
438
- if (sampling) {
439
- if (minI === undefined || clientX === lastClientX) {
440
- if (!isRange) {
441
- low = y;
442
- }
443
- if (maxI === undefined || y > maxVal) {
444
- maxVal = y;
445
- maxI = i;
446
- }
447
- if (minI === undefined || low < minVal) {
448
- minVal = low;
449
- minI = i;
450
- }
441
+ clientX = Math.round(xAxis.toPixels(x, true));
451
442
 
452
- }
453
- if (clientX !== lastClientX) { // Add points and reset
454
- if (minI !== undefined) { // then maxI is also a number
455
- plotY = yAxis.toPixels(maxVal, true);
456
- yBottom = yAxis.toPixels(minVal, true);
457
- drawPoint(
458
- clientX,
459
- hasThreshold ? Math.min(plotY, translatedThreshold) : plotY,
460
- hasThreshold ? Math.max(yBottom, translatedThreshold) : yBottom
461
- );
462
- addKDPoint(clientX, plotY, maxI);
463
- if (yBottom !== plotY) {
464
- addKDPoint(clientX, yBottom, minI);
443
+ if (sampling) {
444
+ if (minI === undefined || clientX === lastClientX) {
445
+ if (!isRange) {
446
+ low = y;
447
+ }
448
+ if (maxI === undefined || y > maxVal) {
449
+ maxVal = y;
450
+ maxI = i;
465
451
  }
452
+ if (minI === undefined || low < minVal) {
453
+ minVal = low;
454
+ minI = i;
455
+ }
456
+
466
457
  }
458
+ if (clientX !== lastClientX) { // Add points and reset
459
+ if (minI !== undefined) { // then maxI is also a number
460
+ plotY = yAxis.toPixels(maxVal, true);
461
+ yBottom = yAxis.toPixels(minVal, true);
462
+ drawPoint(
463
+ clientX,
464
+ hasThreshold ? Math.min(plotY, translatedThreshold) : plotY,
465
+ hasThreshold ? Math.max(yBottom, translatedThreshold) : yBottom
466
+ );
467
+ addKDPoint(clientX, plotY, maxI);
468
+ if (yBottom !== plotY) {
469
+ addKDPoint(clientX, yBottom, minI);
470
+ }
471
+ }
467
472
 
468
473
 
469
- minI = maxI = undefined;
470
- lastClientX = clientX;
474
+ minI = maxI = undefined;
475
+ lastClientX = clientX;
476
+ }
477
+ } else {
478
+ plotY = Math.round(yAxis.toPixels(y, true));
479
+ drawPoint(clientX, plotY, yBottom);
480
+ addKDPoint(clientX, plotY, i);
471
481
  }
472
- } else {
473
- plotY = Math.round(yAxis.toPixels(y, true));
474
- drawPoint(clientX, plotY, yBottom);
475
- addKDPoint(clientX, plotY, i);
476
482
  }
477
- }
478
- wasNull = isNull && !connectNulls;
483
+ wasNull = isNull && !connectNulls;
479
484
 
480
- i = i + 1;
481
-
482
- if (i % CHUNK_SIZE === 0) {
483
- series.canvasToSVG();
485
+ if (i % CHUNK_SIZE === 0) {
486
+ series.canvasToSVG();
487
+ }
484
488
  }
485
489
 
490
+ return !chartDestroyed;
486
491
  }, function () {
487
-
488
492
  var loadingDiv = chart.loadingDiv,
489
- loadingShown = +chart.loadingShown;
490
-
493
+ loadingShown = chart.loadingShown;
491
494
  stroke();
492
495
  series.canvasToSVG();
493
496
 
@@ -496,23 +499,19 @@
496
499
  // Do not use chart.hideLoading, as it runs JS animation and will be blocked by buildKDTree.
497
500
  // CSS animation looks good, but then it must be deleted in timeout. If we add the module to core,
498
501
  // change hideLoading so we can skip this block.
499
- if (loadingShown === 1) {
502
+ if (loadingShown) {
500
503
  extend(loadingDiv.style, {
501
504
  transition: 'opacity 250ms',
502
505
  opacity: 0
503
506
  });
504
-
505
507
  chart.loadingShown = false;
506
- setTimeout(function () {
508
+ destroyLoadingDiv = setTimeout(function () {
507
509
  if (loadingDiv.parentNode) { // In exporting it is falsy
508
510
  loadingDiv.parentNode.removeChild(loadingDiv);
509
511
  }
510
512
  chart.loadingDiv = chart.loadingSpan = null;
511
513
  }, 250);
512
514
  }
513
- if (loadingShown) {
514
- chart.loadingShown = loadingShown - 1;
515
- }
516
515
 
517
516
  // Pass tests in Pointer.
518
517
  // Replace this with a single property, and replace when zooming in