highcharts-rails 4.2.6 → 4.2.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.
@@ -2,7 +2,7 @@
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
4
  /**
5
- * @license Highcharts JS v4.2.6 (2016-08-02)
5
+ * @license Highcharts JS v4.2.7 (2016-09-21)
6
6
  *
7
7
  * 3D features for Highcharts JS
8
8
  *
@@ -503,6 +503,7 @@
503
503
  }));
504
504
  };
505
505
  }
506
+ animation = anim; // Only when duration (#5572)
506
507
  }
507
508
  return proceed.call(this, params, animation, complete);
508
509
  });
@@ -2,7 +2,7 @@
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
4
  /**
5
- * @license Highcharts JS v4.2.6 (2016-08-02)
5
+ * @license Highcharts JS v4.2.7 (2016-09-21)
6
6
  *
7
7
  * (c) 2009-2016 Torstein Honsi
8
8
  *
@@ -241,21 +241,30 @@ var arrayMin = Highcharts.arrayMin,
241
241
  * method.
242
242
  */
243
243
  getLinePath: function (lineWidth, radius) {
244
- var center = this.center;
245
- radius = pick(radius, center[2] / 2 - this.offset);
244
+ var center = this.center,
245
+ end,
246
+ chart = this.chart,
247
+ r = pick(radius, center[2] / 2 - this.offset),
248
+ path;
246
249
 
247
- return this.chart.renderer.symbols.arc(
248
- this.left + center[0],
249
- this.top + center[1],
250
- radius,
251
- radius,
252
- {
253
- start: this.startAngleRad,
254
- end: this.endAngleRad,
255
- open: true,
256
- innerR: 0
257
- }
258
- );
250
+ if (this.isCircular || radius !== undefined) {
251
+ path = this.chart.renderer.symbols.arc(
252
+ this.left + center[0],
253
+ this.top + center[1],
254
+ r,
255
+ r,
256
+ {
257
+ start: this.startAngleRad,
258
+ end: this.endAngleRad,
259
+ open: true,
260
+ innerR: 0
261
+ }
262
+ );
263
+ } else {
264
+ end = this.postTranslate(this.angleRad, r);
265
+ path = ['M', center[0] + chart.plotLeft, center[1] + chart.plotTop, 'L', end.x, end.y];
266
+ }
267
+ return path;
259
268
  },
260
269
 
261
270
  /**
@@ -294,6 +303,11 @@ var arrayMin = Highcharts.arrayMin,
294
303
  * tickPositions are computed, so that ticks will extend passed the real max.
295
304
  */
296
305
  beforeSetTickPositions: function () {
306
+ // If autoConnect is true, polygonal grid lines are connected, and one closestPointRange
307
+ // is added to the X axis to prevent the last point from overlapping the first.
308
+ this.autoConnect = this.isCircular && pick(this.userMax, this.options.max) === undefined &&
309
+ this.endAngleRad - this.startAngleRad === 2 * Math.PI;
310
+
297
311
  if (this.autoConnect) {
298
312
  this.max += (this.categories && 1) || this.pointRange || this.closestPointRange || 0; // #1197, #2260
299
313
  }
@@ -330,7 +344,7 @@ var arrayMin = Highcharts.arrayMin,
330
344
  */
331
345
  getPosition: function (value, length) {
332
346
  return this.postTranslate(
333
- this.isCircular ? this.translate(value) : 0, // #2848
347
+ this.isCircular ? this.translate(value) : this.angleRad, // #2848
334
348
  pick(this.isCircular ? length : this.translate(value), this.center[2] / 2) - this.offset
335
349
  );
336
350
  },
@@ -505,8 +519,6 @@ var arrayMin = Highcharts.arrayMin,
505
519
  isX = userOptions.isX,
506
520
  isHidden = angular && isX,
507
521
  isCircular,
508
- startAngleRad,
509
- endAngleRad,
510
522
  options,
511
523
  chartOptions = chart.options,
512
524
  paneIndex = userOptions.pane || 0,
@@ -555,16 +567,13 @@ var arrayMin = Highcharts.arrayMin,
555
567
  // Start and end angle options are
556
568
  // given in degrees relative to top, while internal computations are
557
569
  // in radians relative to right (like SVG).
558
- this.startAngleRad = startAngleRad = (paneOptions.startAngle - 90) * Math.PI / 180;
559
- this.endAngleRad = endAngleRad = (pick(paneOptions.endAngle, paneOptions.startAngle + 360) - 90) * Math.PI / 180;
570
+ this.angleRad = (options.angle || 0) * Math.PI / 180; // Y axis in polar charts
571
+ this.startAngleRad = (paneOptions.startAngle - 90) * Math.PI / 180; // Gauges
572
+ this.endAngleRad = (pick(paneOptions.endAngle, paneOptions.startAngle + 360) - 90) * Math.PI / 180; // Gauges
560
573
  this.offset = options.offset || 0;
561
574
 
562
575
  this.isCircular = isCircular;
563
576
 
564
- // Automatically connect grid lines?
565
- if (isCircular && userOptions.max === UNDEFINED && endAngleRad - startAngleRad === 2 * Math.PI) {
566
- this.autoConnect = true;
567
- }
568
577
  }
569
578
 
570
579
  });
@@ -603,7 +612,7 @@ var arrayMin = Highcharts.arrayMin,
603
612
  align = labelOptions.align,
604
613
  angle = ((axis.translate(this.pos) + axis.startAngleRad + Math.PI / 2) / Math.PI * 180) % 360;
605
614
 
606
- if (axis.isRadial) {
615
+ if (axis.isRadial) { // Both X and Y axes in a polar chart
607
616
  ret = axis.getPosition(this.pos, (axis.center[2] / 2) + pick(labelOptions.distance, -25));
608
617
 
609
618
  // Automatically rotated
@@ -619,7 +628,7 @@ var arrayMin = Highcharts.arrayMin,
619
628
 
620
629
  // Automatic alignment
621
630
  if (align === null) {
622
- if (axis.isCircular) {
631
+ if (axis.isCircular) { // Y axis
623
632
  if (this.label.getBBox().width > axis.len * axis.tickInterval / (axis.max - axis.min)) { // #3506
624
633
  centerSlot = 0;
625
634
  }
@@ -669,7 +678,8 @@ var arrayMin = Highcharts.arrayMin,
669
678
  ret = proceed.call(this, x, y, tickLength, tickWidth, horiz, renderer);
670
679
  }
671
680
  return ret;
672
- });/*
681
+ });
682
+ /*
673
683
  * The AreaRangeSeries class
674
684
  *
675
685
  */
@@ -762,13 +772,12 @@ var arrayMin = Highcharts.arrayMin,
762
772
  * Extend the line series' getSegmentPath method by applying the segment
763
773
  * path to both lower and higher values of the range
764
774
  */
765
- getGraphPath: function () {
775
+ getGraphPath: function (points) {
766
776
 
767
- var points = this.points,
768
- highPoints = [],
777
+ var highPoints = [],
769
778
  highAreaPoints = [],
770
- i = points.length,
771
- getGraphPath = Series.prototype.getGraphPath,
779
+ i,
780
+ getGraphPath = seriesTypes.area.prototype.getGraphPath,
772
781
  point,
773
782
  pointShim,
774
783
  linePath,
@@ -778,6 +787,9 @@ var arrayMin = Highcharts.arrayMin,
778
787
  higherPath,
779
788
  higherAreaPath;
780
789
 
790
+ points = points || this.points;
791
+ i = points.length;
792
+
781
793
  // Create the top line and the top part of the area fill. The area fill compensates for
782
794
  // null points by drawing down to the lower graph, moving across the null gap and
783
795
  // starting again at the lower graph.
@@ -785,23 +797,29 @@ var arrayMin = Highcharts.arrayMin,
785
797
  while (i--) {
786
798
  point = points[i];
787
799
 
788
- if (!point.isNull && (!points[i + 1] || points[i + 1].isNull)) {
800
+ if (!point.isNull && !options.connectEnds && (!points[i + 1] || points[i + 1].isNull)) {
789
801
  highAreaPoints.push({
790
802
  plotX: point.plotX,
791
- plotY: point.plotLow
803
+ plotY: point.plotY,
804
+ doCurve: false // #5186, gaps in areasplinerange fill
792
805
  });
793
806
  }
807
+
794
808
  pointShim = {
795
- plotX: point.plotX,
809
+ polarPlotY: point.polarPlotY,
810
+ rectPlotX: point.rectPlotX,
811
+ yBottom: point.yBottom,
812
+ plotX: pick(point.plotHighX, point.plotX), // plotHighX is for polar charts
796
813
  plotY: point.plotHigh,
797
814
  isNull: point.isNull
798
815
  };
799
816
  highAreaPoints.push(pointShim);
800
817
  highPoints.push(pointShim);
801
- if (!point.isNull && (!points[i - 1] || points[i - 1].isNull)) {
818
+ if (!point.isNull && !options.connectEnds && (!points[i - 1] || points[i - 1].isNull)) {
802
819
  highAreaPoints.push({
803
820
  plotX: point.plotX,
804
- plotY: point.plotLow
821
+ plotY: point.plotY,
822
+ doCurve: false // #5186, gaps in areasplinerange fill
805
823
  });
806
824
  }
807
825
  }
@@ -1602,7 +1620,14 @@ var arrayMin = Highcharts.arrayMin,
1602
1620
  },
1603
1621
  pointValKey: 'high', // defines the top of the tracker
1604
1622
  doQuartiles: false,
1605
- drawDataLabels: seriesTypes.arearange ? seriesTypes.arearange.prototype.drawDataLabels : noop,
1623
+ drawDataLabels: seriesTypes.arearange ? function () {
1624
+ var valKey = this.pointValKey;
1625
+ seriesTypes.arearange.prototype.drawDataLabels.call(this);
1626
+ // Arearange drawDataLabels does not reset point.y to high, but to low after drawing. #4133
1627
+ each(this.data, function (point) {
1628
+ point.y = point[valKey];
1629
+ });
1630
+ } : noop,
1606
1631
 
1607
1632
  /**
1608
1633
  * Get the width and X offset, either on top of the linked series column
@@ -1646,6 +1671,15 @@ var arrayMin = Highcharts.arrayMin,
1646
1671
 
1647
1672
  pointValKey: 'y',
1648
1673
 
1674
+ /**
1675
+ * Pass the null test in ColumnSeries.translate.
1676
+ */
1677
+ pointClass: extendClass(Point, {
1678
+ isValid: function () {
1679
+ return isNumber(this.y, true) || this.isSum || this.isIntermediateSum;
1680
+ }
1681
+ }),
1682
+
1649
1683
  /**
1650
1684
  * Translate data points from raw values
1651
1685
  */
@@ -1697,27 +1731,25 @@ var arrayMin = Highcharts.arrayMin,
1697
1731
  }
1698
1732
  // up points
1699
1733
  y = mathMax(previousY, previousY + point.y) + range[0];
1700
- shapeArgs.y = yAxis.translate(y, 0, 1);
1734
+ shapeArgs.y = yAxis.toPixels(y, true);
1701
1735
 
1702
1736
 
1703
1737
  // sum points
1704
1738
  if (point.isSum) {
1705
- shapeArgs.y = yAxis.translate(range[1], 0, 1);
1706
- shapeArgs.height = Math.min(yAxis.translate(range[0], 0, 1), yAxis.len) - shapeArgs.y + series.minPointLengthOffset; // #4256
1739
+ shapeArgs.y = yAxis.toPixels(range[1], true);
1740
+ shapeArgs.height = Math.min(yAxis.toPixels(range[0], true), yAxis.len) - shapeArgs.y + series.minPointLengthOffset; // #4256
1707
1741
 
1708
1742
  } else if (point.isIntermediateSum) {
1709
- shapeArgs.y = yAxis.translate(range[1], 0, 1);
1710
- shapeArgs.height = Math.min(yAxis.translate(previousIntermediate, 0, 1), yAxis.len) - shapeArgs.y + series.minPointLengthOffset;
1743
+ shapeArgs.y = yAxis.toPixels(range[1], true);
1744
+ shapeArgs.height = Math.min(yAxis.toPixels(previousIntermediate, true), yAxis.len) - shapeArgs.y + series.minPointLengthOffset;
1711
1745
  previousIntermediate = range[1];
1712
1746
 
1713
1747
  // If it's not the sum point, update previous stack end position and get
1714
1748
  // shape height (#3886)
1715
1749
  } else {
1716
- if (previousY !== 0) { // Not the first point
1717
- shapeArgs.height = yValue > 0 ?
1718
- yAxis.translate(previousY, 0, 1) - shapeArgs.y :
1719
- yAxis.translate(previousY, 0, 1) - yAxis.translate(previousY - yValue, 0, 1);
1720
- }
1750
+ shapeArgs.height = yValue > 0 ?
1751
+ yAxis.toPixels(previousY, true) - shapeArgs.y :
1752
+ yAxis.toPixels(previousY, true) - yAxis.toPixels(previousY - yValue, true);
1721
1753
  previousY += yValue;
1722
1754
  }
1723
1755
  // #3952 Negative sum or intermediate sum not rendered correctly
@@ -1919,11 +1951,10 @@ var arrayMin = Highcharts.arrayMin,
1919
1951
 
1920
1952
  // Close all segments
1921
1953
  while (i--) {
1922
- if (i === graphPath.length || (graphPath[i] === 'M' && i > 0)) {
1954
+ if ((i === graphPath.length || graphPath[i] === 'M') && i > 0) {
1923
1955
  graphPath.splice(i, 0, 'z');
1924
1956
  }
1925
1957
  }
1926
-
1927
1958
  this.areaPath = graphPath;
1928
1959
  return graphPath;
1929
1960
  },
@@ -307,6 +307,10 @@
307
307
  drawPoint = function (clientX, plotY, yBottom) {
308
308
  if (c === 0) {
309
309
  ctx.beginPath();
310
+
311
+ if (cvsLineTo) {
312
+ ctx.lineJoin = 'round';
313
+ }
310
314
  }
311
315
 
312
316
  if (wasNull) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Highcharts JS v4.2.6 (2016-08-02)
2
+ * Highcharts JS v4.2.7 (2016-09-21)
3
3
  * Highcharts Broken Axis module
4
4
  *
5
5
  * License: www.highcharts.com/license
@@ -2908,7 +2908,7 @@ if (CanvasRenderingContext2D) {
2908
2908
  });
2909
2909
  }
2910
2910
  }/**
2911
- * @license Highcharts JS v4.2.6 (2016-08-02)
2911
+ * @license Highcharts JS v4.2.7 (2016-09-21)
2912
2912
  * CanVGRenderer Extension module
2913
2913
  *
2914
2914
  * (c) 2011-2016 Torstein Honsi, Erik Olsson
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v4.2.6 (2016-08-02)
2
+ * @license Highcharts JS v4.2.7 (2016-09-21)
3
3
  * Data module
4
4
  *
5
5
  * (c) 2012-2016 Torstein Honsi
@@ -766,6 +766,9 @@
766
766
  chartOptions.xAxis = {
767
767
  type: type
768
768
  };
769
+ if (type === 'category') {
770
+ chartOptions.xAxis.nameToX = false;
771
+ }
769
772
  }
770
773
 
771
774
  if (options.complete) {
@@ -84,7 +84,6 @@
84
84
  },
85
85
  activeDataLabelStyle: {
86
86
  cursor: 'pointer',
87
- color: '#0d233a',
88
87
  fontWeight: 'bold',
89
88
  textDecoration: 'underline'
90
89
  },
@@ -179,7 +178,7 @@
179
178
  levelSeries: levelSeries,
180
179
  shapeArgs: point.shapeArgs,
181
180
  bBox: point.graphic ? point.graphic.getBBox() : {}, // no graphic in line series with markers disabled
182
- color: color,
181
+ color: point.isNull ? new Highcharts.Color(color).setOpacity(0).get() : color,
183
182
  lowerSeriesOptions: ddOptions,
184
183
  pointOptions: oldSeries.options.data[pointIndex],
185
184
  pointIndex: pointIndex,
@@ -514,15 +513,17 @@
514
513
 
515
514
  if (!init) {
516
515
  each(this.points, function (point, i) {
517
- point.graphic
518
- .attr(H.merge(animateFrom, {
519
- start: start + i * startAngle,
520
- end: start + (i + 1) * startAngle,
521
- fill: level.color
522
- }))[animationOptions ? 'animate' : 'attr'](
523
- extend(point.shapeArgs, { fill: point.color }),
524
- animationOptions
525
- );
516
+ if (point.graphic) {
517
+ point.graphic
518
+ .attr(H.merge(animateFrom, {
519
+ start: start + i * startAngle,
520
+ end: start + (i + 1) * startAngle,
521
+ fill: level.color
522
+ }))[animationOptions ? 'animate' : 'attr'](
523
+ extend(point.shapeArgs, { fill: point.color }),
524
+ animationOptions
525
+ );
526
+ }
526
527
  });
527
528
  this.animate = null;
528
529
  }
@@ -555,7 +556,7 @@
555
556
  seriesOptions: seriesOptions,
556
557
  category: category,
557
558
  originalEvent: originalEvent,
558
- points: category !== undefined && this.series.xAxis.ddPoints[category].slice(0)
559
+ points: category !== undefined && this.series.xAxis.getDDPoints(category).slice(0)
559
560
  }, function (e) {
560
561
  var chart = e.point.series && e.point.series.chart,
561
562
  seriesOptions = e.seriesOptions;
@@ -577,7 +578,7 @@
577
578
  H.Axis.prototype.drilldownCategory = function (x, e) {
578
579
  var key,
579
580
  point,
580
- ddPointsX = this.ddPoints[x];
581
+ ddPointsX = this.getDDPoints(x);
581
582
  for (key in ddPointsX) {
582
583
  point = ddPointsX[key];
583
584
  if (point && point.series && point.series.visible && point.doDrilldown) { // #3197
@@ -588,20 +589,23 @@
588
589
  };
589
590
 
590
591
  /**
591
- * Create and return a collection of points associated with the X position. Reset it for each level.
592
- */
593
- H.Axis.prototype.getDDPoints = function (x, levelNumber) {
594
- var ddPoints = this.ddPoints;
595
- if (!ddPoints) {
596
- this.ddPoints = ddPoints = {};
597
- }
598
- if (!ddPoints[x]) {
599
- ddPoints[x] = [];
600
- }
601
- if (ddPoints[x].levelNumber !== levelNumber) {
602
- ddPoints[x].length = 0; // reset
603
- }
604
- return ddPoints[x];
592
+ * Return drillable points for this specific X value
593
+ */
594
+ H.Axis.prototype.getDDPoints = function (x) {
595
+ var ret = [];
596
+ each(this.series, function (series) {
597
+ var i,
598
+ xData = series.xData,
599
+ points = series.points;
600
+
601
+ for (i = 0; i < xData.length; i++) {
602
+ if (xData[i] === x && series.options.data[i].drilldown) {
603
+ ret.push(points ? points[i] : true);
604
+ break;
605
+ }
606
+ }
607
+ });
608
+ return ret;
605
609
  };
606
610
 
607
611
 
@@ -612,23 +616,26 @@
612
616
  var pos = this.pos,
613
617
  label = this.label,
614
618
  axis = this.axis,
615
- ddPointsX = axis.ddPoints && axis.ddPoints[pos];
619
+ isDrillable = axis.coll === 'xAxis' && axis.getDDPoints,
620
+ ddPointsX = isDrillable && axis.getDDPoints(pos);
616
621
 
617
- if (label && ddPointsX && ddPointsX.length) {
618
- if (!label.basicStyles) {
619
- label.basicStyles = H.merge(label.styles);
620
- }
621
- label
622
- .addClass('highcharts-drilldown-axis-label')
623
- .css(axis.chart.options.drilldown.activeAxisLabelStyle)
624
- .on('click', function (e) {
625
- axis.drilldownCategory(pos, e);
626
- });
622
+ if (isDrillable) {
623
+ if (label && ddPointsX.length) {
624
+ if (!label.basicStyles) {
625
+ label.basicStyles = H.merge(label.styles);
626
+ }
627
+ label
628
+ .addClass('highcharts-drilldown-axis-label')
629
+ .css(axis.chart.options.drilldown.activeAxisLabelStyle)
630
+ .on('click', function (e) {
631
+ axis.drilldownCategory(pos, e);
632
+ });
627
633
 
628
- } else if (label && label.basicStyles) {
629
- label.styles = {}; // reset for full overwrite of styles
630
- label.css(label.basicStyles);
631
- label.on('click', null); // #3806
634
+ } else if (label && label.basicStyles) {
635
+ label.styles = {}; // reset for full overwrite of styles
636
+ label.css(label.basicStyles);
637
+ label.on('click', null); // #3806
638
+ }
632
639
  }
633
640
  };
634
641
 
@@ -648,8 +655,7 @@
648
655
  wrap(H.Point.prototype, 'init', function (proceed, series, options, x) {
649
656
  var point = proceed.call(this, series, options, x),
650
657
  xAxis = series.xAxis,
651
- tick = xAxis && xAxis.ticks[x],
652
- ddPointsX = xAxis && xAxis.getDDPoints(x, series.options._levelNumber);
658
+ tick = xAxis && xAxis.ticks[x];
653
659
 
654
660
  if (point.drilldown) {
655
661
 
@@ -670,13 +676,6 @@
670
676
  }
671
677
  });*/
672
678
 
673
-
674
- // Register drilldown points on this X value
675
- if (ddPointsX) {
676
- ddPointsX.push(point);
677
- ddPointsX.levelNumber = series.options._levelNumber;
678
- }
679
-
680
679
  }
681
680
 
682
681
  // Add or remove click handler and style on the tick label