highcharts-rails 5.0.9 → 5.0.10

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 +48 -0
  3. data/app/assets/javascripts/highcharts.js +547 -270
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +13 -11
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +373 -181
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +3 -3
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +3 -3
  8. data/app/assets/javascripts/highcharts/modules/boost.js +11 -5
  9. data/app/assets/javascripts/highcharts/modules/broken-axis.js +3 -3
  10. data/app/assets/javascripts/highcharts/modules/data.js +3 -3
  11. data/app/assets/javascripts/highcharts/modules/drilldown.js +1 -1
  12. data/app/assets/javascripts/highcharts/modules/exporting.js +70 -28
  13. data/app/assets/javascripts/highcharts/modules/funnel.js +3 -3
  14. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  15. data/app/assets/javascripts/highcharts/modules/heatmap.js +5 -5
  16. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +3 -3
  17. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +2 -2
  18. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +43 -20
  19. data/app/assets/javascripts/highcharts/modules/series-label.js +3 -3
  20. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +3 -3
  21. data/app/assets/javascripts/highcharts/modules/stock.js +83 -42
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +1 -1
  23. data/app/assets/javascripts/highcharts/modules/xrange-series.js +3 -3
  24. data/lib/highcharts/version.rb +1 -1
  25. metadata +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.9 (2017-03-08)
2
+ * @license Highcharts JS v5.0.10 (2017-03-31)
3
3
  *
4
4
  * 3D features for Highcharts JS
5
5
  *
@@ -15,7 +15,7 @@
15
15
  }(function(Highcharts) {
16
16
  (function(H) {
17
17
  /**
18
- * (c) 2010-2016 Torstein Honsi
18
+ * (c) 2010-2017 Torstein Honsi
19
19
  *
20
20
  * License: www.highcharts.com/license
21
21
  */
@@ -137,7 +137,7 @@
137
137
  }(Highcharts));
138
138
  (function(H) {
139
139
  /**
140
- * (c) 2010-2016 Torstein Honsi
140
+ * (c) 2010-2017 Torstein Honsi
141
141
  *
142
142
  * License: www.highcharts.com/license
143
143
  */
@@ -477,11 +477,14 @@
477
477
  customAttribs = ['x', 'y', 'r', 'innerR', 'start', 'end'];
478
478
 
479
479
  /**
480
- * Get custom attributes. Mutate the original object and return an object with only custom attr.
480
+ * Get custom attributes. Don't mutate the original object and return an object with only custom attr.
481
481
  */
482
482
  function suckOutCustom(params) {
483
483
  var hasCA = false,
484
484
  ca = {};
485
+
486
+ params = merge(params); // Don't mutate the original object
487
+
485
488
  for (var key in params) {
486
489
  if (inArray(key, customAttribs) !== -1) {
487
490
  ca[key] = params[key];
@@ -638,7 +641,6 @@
638
641
  anim = animObject(pick(animation, this.renderer.globalAnimation));
639
642
 
640
643
  if (anim.duration) {
641
- params = merge(params); // Don't mutate the original object
642
644
  ca = suckOutCustom(params);
643
645
  params.dummy = 1; // Params need to have a property in order for the step to run (#5765)
644
646
 
@@ -871,7 +873,7 @@
871
873
  }(Highcharts));
872
874
  (function(H) {
873
875
  /**
874
- * (c) 2010-2016 Torstein Honsi
876
+ * (c) 2010-2017 Torstein Honsi
875
877
  *
876
878
  * License: www.highcharts.com/license
877
879
  */
@@ -1109,7 +1111,7 @@
1109
1111
  }(Highcharts));
1110
1112
  (function(H) {
1111
1113
  /**
1112
- * (c) 2010-2016 Torstein Honsi
1114
+ * (c) 2010-2017 Torstein Honsi
1113
1115
  *
1114
1116
  * License: www.highcharts.com/license
1115
1117
  */
@@ -1527,7 +1529,7 @@
1527
1529
  }(Highcharts));
1528
1530
  (function(H) {
1529
1531
  /**
1530
- * (c) 2010-2016 Torstein Honsi
1532
+ * (c) 2010-2017 Torstein Honsi
1531
1533
  *
1532
1534
  * License: www.highcharts.com/license
1533
1535
  */
@@ -1782,7 +1784,7 @@
1782
1784
  }(Highcharts));
1783
1785
  (function(H) {
1784
1786
  /**
1785
- * (c) 2010-2016 Torstein Honsi
1787
+ * (c) 2010-2017 Torstein Honsi
1786
1788
  *
1787
1789
  * License: www.highcharts.com/license
1788
1790
  */
@@ -1972,7 +1974,7 @@
1972
1974
  }(Highcharts));
1973
1975
  (function(H) {
1974
1976
  /**
1975
- * (c) 2010-2016 Torstein Honsi
1977
+ * (c) 2010-2017 Torstein Honsi
1976
1978
  *
1977
1979
  * License: www.highcharts.com/license
1978
1980
  */
@@ -2087,7 +2089,7 @@
2087
2089
  }(Highcharts));
2088
2090
  (function(H) {
2089
2091
  /**
2090
- * (c) 2010-2016 Torstein Honsi
2092
+ * (c) 2010-2017 Torstein Honsi
2091
2093
  *
2092
2094
  * License: www.highcharts.com/license
2093
2095
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.9 (2017-03-08)
2
+ * @license Highcharts JS v5.0.10 (2017-03-31)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -15,11 +15,12 @@
15
15
  }(function(Highcharts) {
16
16
  (function(H) {
17
17
  /**
18
- * (c) 2010-2016 Torstein Honsi
18
+ * (c) 2010-2017 Torstein Honsi
19
19
  *
20
20
  * License: www.highcharts.com/license
21
21
  */
22
- var each = H.each,
22
+ var CenteredSeriesMixin = H.CenteredSeriesMixin,
23
+ each = H.each,
23
24
  extend = H.extend,
24
25
  merge = H.merge,
25
26
  splat = H.splat;
@@ -27,53 +28,116 @@
27
28
  * The Pane object allows options that are common to a set of X and Y axes.
28
29
  *
29
30
  * In the future, this can be extended to basic Highcharts and Highstock.
31
+ *
30
32
  */
31
- function Pane(options, chart, firstAxis) {
32
- this.init(options, chart, firstAxis);
33
+ function Pane(options, chart) {
34
+ this.init(options, chart);
33
35
  }
34
36
 
35
37
  // Extend the Pane prototype
36
38
  extend(Pane.prototype, {
37
39
 
40
+ coll: 'pane', // Member of chart.pane
41
+
38
42
  /**
39
43
  * Initiate the Pane object
40
44
  */
41
- init: function(options, chart, firstAxis) {
42
- var pane = this,
43
- backgroundOption,
44
- defaultOptions = pane.defaultOptions;
45
+ init: function(options, chart) {
46
+ this.chart = chart;
47
+ this.background = [];
45
48
 
46
- pane.chart = chart;
49
+ chart.pane.push(this);
50
+
51
+ this.setOptions(options);
52
+ },
53
+
54
+ setOptions: function(options) {
47
55
 
48
56
  // Set options. Angular charts have a default background (#3318)
49
- pane.options = options = merge(defaultOptions, chart.angular ? {
50
- background: {}
51
- } : undefined, options);
57
+ this.options = options = merge(
58
+ this.defaultOptions,
59
+ this.chart.angular ? {
60
+ background: {}
61
+ } : undefined,
62
+ options
63
+ );
64
+ },
52
65
 
53
- backgroundOption = options.background;
66
+ /**
67
+ * Render the pane with its backgrounds.
68
+ */
69
+ render: function() {
54
70
 
55
- // To avoid having weighty logic to place, update and remove the backgrounds,
56
- // push them to the first axis' plot bands and borrow the existing logic there.
57
- if (backgroundOption) {
58
- each([].concat(splat(backgroundOption)).reverse(), function(config) {
59
- var mConfig,
60
- axisUserOptions = firstAxis.userOptions;
61
- mConfig = merge(pane.defaultBackgroundOptions, config);
71
+ var options = this.options,
72
+ backgroundOption = this.options.background,
73
+ renderer = this.chart.renderer,
74
+ len,
75
+ i;
76
+
77
+ if (!this.group) {
78
+ this.group = renderer.g('pane-group')
79
+ .attr({
80
+ zIndex: options.zIndex || 0
81
+ })
82
+ .add();
83
+ }
62
84
 
85
+ this.updateCenter();
63
86
 
64
- if (config.backgroundColor) {
65
- mConfig.backgroundColor = config.backgroundColor;
87
+ // Render the backgrounds
88
+ if (backgroundOption) {
89
+ backgroundOption = splat(backgroundOption);
90
+ len = Math.max(
91
+ backgroundOption.length,
92
+ this.background.length || 0
93
+ );
94
+
95
+ for (i = 0; i < len; i++) {
96
+ if (backgroundOption[i]) {
97
+ this.renderBackground(
98
+ merge(
99
+ this.defaultBackgroundOptions,
100
+ backgroundOption[i]
101
+ ),
102
+ i
103
+ );
104
+ } else if (this.background[i]) {
105
+ this.background[i] = this.background[i].destroy();
106
+ this.background.splice(i, 1);
66
107
  }
67
- mConfig.color = mConfig.backgroundColor; // due to naming in plotBands
108
+ }
109
+ }
110
+ },
68
111
 
112
+ /**
113
+ * Render an individual pane background.
114
+ * @param {Object} backgroundOptions Background options
115
+ * @param {number} i The index of the background in this.backgrounds
116
+ */
117
+ renderBackground: function(backgroundOptions, i) {
118
+ var method = 'animate';
69
119
 
70
- firstAxis.options.plotBands.unshift(mConfig);
71
- axisUserOptions.plotBands = axisUserOptions.plotBands || []; // #3176
72
- if (axisUserOptions.plotBands !== firstAxis.options.plotBands) {
73
- axisUserOptions.plotBands.unshift(mConfig);
74
- }
75
- });
120
+ if (!this.background[i]) {
121
+ this.background[i] = this.chart.renderer.path()
122
+ .add(this.group);
123
+ method = 'attr';
76
124
  }
125
+
126
+ this.background[i][method]({
127
+ 'd': this.axis.getPlotBandPath(
128
+ backgroundOptions.from,
129
+ backgroundOptions.to,
130
+ backgroundOptions
131
+ )
132
+ }).attr({
133
+
134
+ 'fill': backgroundOptions.backgroundColor,
135
+ 'stroke': backgroundOptions.borderColor,
136
+ 'stroke-width': backgroundOptions.borderWidth,
137
+
138
+ 'class': 'highcharts-pane ' + (backgroundOptions.className || '')
139
+ });
140
+
77
141
  },
78
142
 
79
143
  /**
@@ -91,7 +155,7 @@
91
155
  * The default background options
92
156
  */
93
157
  defaultBackgroundOptions: {
94
- className: 'highcharts-pane',
158
+ //className: 'highcharts-pane',
95
159
  shape: 'circle',
96
160
 
97
161
  borderWidth: 1,
@@ -113,6 +177,44 @@
113
177
  innerRadius: 0,
114
178
  to: Number.MAX_VALUE, // corrected to axis max
115
179
  outerRadius: '105%'
180
+ },
181
+
182
+ /**
183
+ * Gets the center for the pane and its axis.
184
+ */
185
+ updateCenter: function(axis) {
186
+ this.center = (axis || this.axis || {}).center =
187
+ CenteredSeriesMixin.getCenter.call(this);
188
+ },
189
+
190
+ /**
191
+ * Destroy the pane item
192
+ * /
193
+ destroy: function () {
194
+ H.erase(this.chart.pane, this);
195
+ each(this.background, function (background) {
196
+ background.destroy();
197
+ });
198
+ this.background.length = 0;
199
+ this.group = this.group.destroy();
200
+ },
201
+ */
202
+
203
+ /**
204
+ * Update the pane item with new options
205
+ * @param {Object} options New pane options
206
+ */
207
+ update: function(options, redraw) {
208
+
209
+ merge(true, this.options, options);
210
+ this.setOptions(this.options);
211
+ this.render();
212
+ each(this.chart.axes, function(axis) {
213
+ if (axis.pane === this) {
214
+ axis.pane = null;
215
+ axis.update({}, redraw);
216
+ }
217
+ }, this);
116
218
  }
117
219
 
118
220
  });
@@ -122,22 +224,19 @@
122
224
  }(Highcharts));
123
225
  (function(H) {
124
226
  /**
125
- * (c) 2010-2016 Torstein Honsi
227
+ * (c) 2010-2017 Torstein Honsi
126
228
  *
127
229
  * License: www.highcharts.com/license
128
230
  */
129
231
  var Axis = H.Axis,
130
- CenteredSeriesMixin = H.CenteredSeriesMixin,
131
232
  each = H.each,
132
233
  extend = H.extend,
133
234
  map = H.map,
134
235
  merge = H.merge,
135
236
  noop = H.noop,
136
- Pane = H.Pane,
137
237
  pick = H.pick,
138
238
  pInt = H.pInt,
139
239
  Tick = H.Tick,
140
- splat = H.splat,
141
240
  wrap = H.wrap,
142
241
 
143
242
 
@@ -250,8 +349,6 @@
250
349
  // Title or label offsets are not counted
251
350
  this.chart.axisOffset[this.side] = 0;
252
351
 
253
- // Set the center array
254
- this.center = this.pane.center = CenteredSeriesMixin.getCenter.call(this.pane);
255
352
  },
256
353
 
257
354
 
@@ -342,7 +439,7 @@
342
439
  if (this.isRadial) {
343
440
 
344
441
  // Set the center array
345
- this.center = this.pane.center = CenteredSeriesMixin.getCenter.call(this.pane);
442
+ this.pane.updateCenter(this);
346
443
 
347
444
  // The sector is used in Axis.translate to compute the translation of reversed axis points (#2570)
348
445
  if (this.isCircular) {
@@ -534,8 +631,7 @@
534
631
  * Override axisProto.init to mix in special axis instance functions and function overrides
535
632
  */
536
633
  wrap(axisProto, 'init', function(proceed, chart, userOptions) {
537
- var axis = this,
538
- angular = chart.angular,
634
+ var angular = chart.angular,
539
635
  polar = chart.polar,
540
636
  isX = userOptions.isX,
541
637
  isHidden = angular && isX,
@@ -543,8 +639,8 @@
543
639
  options,
544
640
  chartOptions = chart.options,
545
641
  paneIndex = userOptions.pane || 0,
546
- pane,
547
- paneOptions;
642
+ pane = this.pane = chart.pane[paneIndex],
643
+ paneOptions = pane.options;
548
644
 
549
645
  // Before prototype.init
550
646
  if (angular) {
@@ -570,23 +666,17 @@
570
666
  this.isRadial = false;
571
667
  }
572
668
 
669
+ // A pointer back to this axis to borrow geometry
670
+ if (isCircular) {
671
+ pane.axis = this;
672
+ }
673
+
573
674
  // Run prototype.init
574
675
  proceed.call(this, chart, userOptions);
575
676
 
576
677
  if (!isHidden && (angular || polar)) {
577
678
  options = this.options;
578
679
 
579
- // Create the pane and set the pane options.
580
- if (!chart.panes) {
581
- chart.panes = [];
582
- }
583
- this.pane = pane = chart.panes[paneIndex] = chart.panes[paneIndex] || new Pane(
584
- splat(chartOptions.pane)[paneIndex],
585
- chart,
586
- axis
587
- );
588
- paneOptions = pane.options;
589
-
590
680
  // Start and end angle options are
591
681
  // given in degrees relative to top, while internal computations are
592
682
  // in radians relative to right (like SVG).
@@ -706,7 +796,7 @@
706
796
  }(Highcharts));
707
797
  (function(H) {
708
798
  /**
709
- * (c) 2010-2016 Torstein Honsi
799
+ * (c) 2010-2017 Torstein Honsi
710
800
  *
711
801
  * License: www.highcharts.com/license
712
802
  */
@@ -1023,7 +1113,7 @@
1023
1113
  }(Highcharts));
1024
1114
  (function(H) {
1025
1115
  /**
1026
- * (c) 2010-2016 Torstein Honsi
1116
+ * (c) 2010-2017 Torstein Honsi
1027
1117
  *
1028
1118
  * License: www.highcharts.com/license
1029
1119
  */
@@ -1041,7 +1131,7 @@
1041
1131
  }(Highcharts));
1042
1132
  (function(H) {
1043
1133
  /**
1044
- * (c) 2010-2016 Torstein Honsi
1134
+ * (c) 2010-2017 Torstein Honsi
1045
1135
  *
1046
1136
  * License: www.highcharts.com/license
1047
1137
  */
@@ -1150,7 +1240,7 @@
1150
1240
  }(Highcharts));
1151
1241
  (function(H) {
1152
1242
  /**
1153
- * (c) 2010-2016 Torstein Honsi
1243
+ * (c) 2010-2017 Torstein Honsi
1154
1244
  *
1155
1245
  * License: www.highcharts.com/license
1156
1246
  */
@@ -1414,7 +1504,7 @@
1414
1504
  }(Highcharts));
1415
1505
  (function(H) {
1416
1506
  /**
1417
- * (c) 2010-2016 Torstein Honsi
1507
+ * (c) 2010-2017 Torstein Honsi
1418
1508
  *
1419
1509
  * License: www.highcharts.com/license
1420
1510
  */
@@ -1583,36 +1673,38 @@
1583
1673
  point.medianShape = renderer.path(medianPath)
1584
1674
  .addClass('highcharts-boxplot-median')
1585
1675
  .add(graphic);
1676
+ }
1586
1677
 
1587
1678
 
1588
1679
 
1589
1680
 
1590
- // Stem attributes
1591
- stemAttr.stroke = point.stemColor || options.stemColor || color;
1592
- stemAttr['stroke-width'] = pick(point.stemWidth, options.stemWidth, options.lineWidth);
1593
- stemAttr.dashstyle = point.stemDashStyle || options.stemDashStyle;
1594
- point.stem.attr(stemAttr);
1595
1681
 
1596
- // Whiskers attributes
1597
- if (whiskerLength) {
1598
- whiskersAttr.stroke = point.whiskerColor || options.whiskerColor || color;
1599
- whiskersAttr['stroke-width'] = pick(point.whiskerWidth, options.whiskerWidth, options.lineWidth);
1600
- point.whiskers.attr(whiskersAttr);
1601
- }
1602
1682
 
1603
- if (doQuartiles) {
1604
- boxAttr = series.pointAttribs(point);
1605
- point.box.attr(boxAttr);
1606
- }
1683
+ // Stem attributes
1684
+ stemAttr.stroke = point.stemColor || options.stemColor || color;
1685
+ stemAttr['stroke-width'] = pick(point.stemWidth, options.stemWidth, options.lineWidth);
1686
+ stemAttr.dashstyle = point.stemDashStyle || options.stemDashStyle;
1687
+ point.stem.attr(stemAttr);
1688
+
1689
+ // Whiskers attributes
1690
+ if (whiskerLength) {
1691
+ whiskersAttr.stroke = point.whiskerColor || options.whiskerColor || color;
1692
+ whiskersAttr['stroke-width'] = pick(point.whiskerWidth, options.whiskerWidth, options.lineWidth);
1693
+ point.whiskers.attr(whiskersAttr);
1694
+ }
1607
1695
 
1696
+ if (doQuartiles) {
1697
+ boxAttr = series.pointAttribs(point);
1698
+ point.box.attr(boxAttr);
1699
+ }
1608
1700
 
1609
- // Median attributes
1610
- medianAttr.stroke = point.medianColor || options.medianColor || color;
1611
- medianAttr['stroke-width'] = pick(point.medianWidth, options.medianWidth, options.lineWidth);
1612
- point.medianShape.attr(medianAttr);
1701
+
1702
+ // Median attributes
1703
+ medianAttr.stroke = point.medianColor || options.medianColor || color;
1704
+ medianAttr['stroke-width'] = pick(point.medianWidth, options.medianWidth, options.lineWidth);
1705
+ point.medianShape.attr(medianAttr);
1613
1706
 
1614
1707
 
1615
- }
1616
1708
 
1617
1709
 
1618
1710
 
@@ -1717,7 +1809,7 @@
1717
1809
  }(Highcharts));
1718
1810
  (function(H) {
1719
1811
  /**
1720
- * (c) 2010-2016 Torstein Honsi
1812
+ * (c) 2010-2017 Torstein Honsi
1721
1813
  *
1722
1814
  * License: www.highcharts.com/license
1723
1815
  */
@@ -1776,13 +1868,12 @@
1776
1868
  }(Highcharts));
1777
1869
  (function(H) {
1778
1870
  /**
1779
- * (c) 2010-2016 Torstein Honsi
1871
+ * (c) 2010-2017 Torstein Honsi
1780
1872
  *
1781
1873
  * License: www.highcharts.com/license
1782
1874
  */
1783
1875
  var correctFloat = H.correctFloat,
1784
1876
  isNumber = H.isNumber,
1785
- noop = H.noop,
1786
1877
  pick = H.pick,
1787
1878
  Point = H.Point,
1788
1879
  Series = H.Series,
@@ -1838,7 +1929,7 @@
1838
1929
  tooltipY;
1839
1930
 
1840
1931
  // run column series translate
1841
- seriesTypes.column.prototype.translate.apply(this);
1932
+ seriesTypes.column.prototype.translate.apply(series);
1842
1933
 
1843
1934
  previousY = previousIntermediate = threshold;
1844
1935
  points = series.points;
@@ -1846,14 +1937,18 @@
1846
1937
  for (i = 0, len = points.length; i < len; i++) {
1847
1938
  // cache current point object
1848
1939
  point = points[i];
1849
- yValue = this.processedYData[i];
1940
+ yValue = series.processedYData[i];
1850
1941
  shapeArgs = point.shapeArgs;
1851
1942
 
1852
1943
  // get current stack
1853
1944
  stack = stacking && yAxis.stacks[(series.negStacks && yValue < threshold ? '-' : '') + series.stackKey];
1854
- stackIndicator = series.getStackIndicator(stackIndicator, point.x);
1945
+ stackIndicator = series.getStackIndicator(
1946
+ stackIndicator,
1947
+ point.x,
1948
+ series.index
1949
+ );
1855
1950
  range = stack ?
1856
- stack[point.x].points[series.index + ',' + i + ',' + stackIndicator.index] : [0, yValue];
1951
+ stack[point.x].points[stackIndicator.key] : [0, yValue];
1857
1952
 
1858
1953
  // override point value for sums
1859
1954
  // #3710 Update point does not propagate to sum
@@ -1866,7 +1961,6 @@
1866
1961
  y = Math.max(previousY, previousY + point.y) + range[0];
1867
1962
  shapeArgs.y = yAxis.toPixels(y, true);
1868
1963
 
1869
-
1870
1964
  // sum points
1871
1965
  if (point.isSum) {
1872
1966
  shapeArgs.y = yAxis.toPixels(range[1], true);
@@ -1885,8 +1979,10 @@
1885
1979
  shapeArgs.height = yValue > 0 ?
1886
1980
  yAxis.toPixels(previousY, true) - shapeArgs.y :
1887
1981
  yAxis.toPixels(previousY, true) - yAxis.toPixels(previousY - yValue, true);
1888
- previousY += yValue;
1982
+
1983
+ previousY += stack && stack[point.x] ? stack[point.x].total : yValue;
1889
1984
  }
1985
+
1890
1986
  // #3952 Negative sum or intermediate sum not rendered correctly
1891
1987
  if (shapeArgs.height < 0) {
1892
1988
  shapeArgs.y += shapeArgs.height;
@@ -1959,9 +2055,11 @@
1959
2055
 
1960
2056
  Series.prototype.processData.call(this, force);
1961
2057
 
1962
- // Record extremes
1963
- series.dataMin = dataMin;
1964
- series.dataMax = dataMax;
2058
+ // Record extremes only if stacking was not set:
2059
+ if (!series.options.stacking) {
2060
+ series.dataMin = dataMin;
2061
+ series.dataMax = dataMax;
2062
+ }
1965
2063
  },
1966
2064
 
1967
2065
  /**
@@ -2060,9 +2158,39 @@
2060
2158
  },
2061
2159
 
2062
2160
  /**
2063
- * Extremes are recorded in processData
2161
+ * Waterfall has stacking along the x-values too.
2162
+ */
2163
+ setStackedPoints: function() {
2164
+ var series = this,
2165
+ options = series.options,
2166
+ stackedYLength,
2167
+ i;
2168
+
2169
+ Series.prototype.setStackedPoints.apply(series, arguments);
2170
+
2171
+ stackedYLength = series.stackedYData ? series.stackedYData.length : 0;
2172
+
2173
+ // Start from the second point:
2174
+ for (i = 1; i < stackedYLength; i++) {
2175
+ if (!options.data[i].isSum &&
2176
+ !options.data[i].isIntermediateSum
2177
+ ) {
2178
+ // Sum previous stacked data as waterfall can grow up/down:
2179
+ series.stackedYData[i] += series.stackedYData[i - 1];
2180
+ }
2181
+ }
2182
+ },
2183
+
2184
+ /**
2185
+ * Extremes for a non-stacked series are recorded in processData.
2186
+ * In case of stacking, use Series.stackedYData to calculate extremes.
2064
2187
  */
2065
- getExtremes: noop
2188
+ getExtremes: function() {
2189
+ if (this.options.stacking) {
2190
+ return Series.prototype.getExtremes.apply(this, arguments);
2191
+ }
2192
+ }
2193
+
2066
2194
 
2067
2195
  // Point members
2068
2196
  }, {
@@ -2092,7 +2220,7 @@
2092
2220
  }(Highcharts));
2093
2221
  (function(H) {
2094
2222
  /**
2095
- * (c) 2010-2016 Torstein Honsi
2223
+ * (c) 2010-2017 Torstein Honsi
2096
2224
  *
2097
2225
  * License: www.highcharts.com/license
2098
2226
  */
@@ -2151,7 +2279,7 @@
2151
2279
  }(Highcharts));
2152
2280
  (function(H) {
2153
2281
  /**
2154
- * (c) 2010-2016 Torstein Honsi
2282
+ * (c) 2010-2017 Torstein Honsi
2155
2283
  *
2156
2284
  * License: www.highcharts.com/license
2157
2285
  */
@@ -2223,6 +2351,7 @@
2223
2351
  trackerGroups: ['markerGroup', 'dataLabelsGroup'],
2224
2352
  bubblePadding: true,
2225
2353
  zoneAxis: 'z',
2354
+ directTouch: true,
2226
2355
 
2227
2356
 
2228
2357
  pointAttribs: function(point, state) {
@@ -2493,7 +2622,7 @@
2493
2622
  }(Highcharts));
2494
2623
  (function(H) {
2495
2624
  /**
2496
- * (c) 2010-2016 Torstein Honsi
2625
+ * (c) 2010-2017 Torstein Honsi
2497
2626
  *
2498
2627
  * License: www.highcharts.com/license
2499
2628
  */
@@ -2532,6 +2661,96 @@
2532
2661
 
2533
2662
  };
2534
2663
 
2664
+ /**
2665
+ * #6212 Calculate connectors for spline series in polar chart.
2666
+ * @param {Boolean} calculateNeighbours - Check if connectors should be calculated for neighbour points as well
2667
+ * allows short recurence
2668
+ */
2669
+ seriesProto.getConnectors = function(segment, index, calculateNeighbours, connectEnds) {
2670
+
2671
+ var i,
2672
+ prevPointInd,
2673
+ nextPointInd,
2674
+ previousPoint,
2675
+ nextPoint,
2676
+ previousX,
2677
+ previousY,
2678
+ nextX,
2679
+ nextY,
2680
+ plotX,
2681
+ plotY,
2682
+ ret,
2683
+ smoothing = 1.5, // 1 means control points midway between points, 2 means 1/3 from the point, 3 is 1/4 etc;
2684
+ denom = smoothing + 1,
2685
+ leftContX,
2686
+ leftContY,
2687
+ rightContX,
2688
+ rightContY,
2689
+ dLControlPoint, //distance left control point
2690
+ dRControlPoint,
2691
+ leftContAngle,
2692
+ rightContAngle,
2693
+ jointAngle,
2694
+ addedNumber = connectEnds ? 1 : 0;
2695
+
2696
+ /** calculate final index of points depending on the initial index value.
2697
+ * Because of calculating neighbours, index may be outisde segment array.
2698
+ */
2699
+ if (index >= 0 && index <= segment.length - 1) {
2700
+ i = index;
2701
+ } else if (index < 0) {
2702
+ i = segment.length - 1 + index;
2703
+ } else {
2704
+ i = 0;
2705
+ }
2706
+
2707
+ prevPointInd = (i - 1 < 0) ? segment.length - (1 + addedNumber) : i - 1;
2708
+ nextPointInd = (i + 1 > segment.length - 1) ? addedNumber : i + 1;
2709
+ previousPoint = segment[prevPointInd];
2710
+ nextPoint = segment[nextPointInd];
2711
+ previousX = previousPoint.plotX;
2712
+ previousY = previousPoint.plotY;
2713
+ nextX = nextPoint.plotX;
2714
+ nextY = nextPoint.plotY;
2715
+ plotX = segment[i].plotX; // actual point
2716
+ plotY = segment[i].plotY;
2717
+ leftContX = (smoothing * plotX + previousX) / denom;
2718
+ leftContY = (smoothing * plotY + previousY) / denom;
2719
+ rightContX = (smoothing * plotX + nextX) / denom;
2720
+ rightContY = (smoothing * plotY + nextY) / denom;
2721
+ dLControlPoint = Math.sqrt(Math.pow(leftContX - plotX, 2) + Math.pow(leftContY - plotY, 2));
2722
+ dRControlPoint = Math.sqrt(Math.pow(rightContX - plotX, 2) + Math.pow(rightContY - plotY, 2));
2723
+ leftContAngle = Math.atan2(leftContY - plotY, leftContX - plotX);
2724
+ rightContAngle = Math.atan2(rightContY - plotY, rightContX - plotX);
2725
+ jointAngle = (Math.PI / 2) + ((leftContAngle + rightContAngle) / 2);
2726
+ // Ensure the right direction, jointAngle should be in the same quadrant as leftContAngle
2727
+ if (Math.abs(leftContAngle - jointAngle) > Math.PI / 2) {
2728
+ jointAngle -= Math.PI;
2729
+ }
2730
+ // Find the corrected control points for a spline straight through the point
2731
+ leftContX = plotX + Math.cos(jointAngle) * dLControlPoint;
2732
+ leftContY = plotY + Math.sin(jointAngle) * dLControlPoint;
2733
+ rightContX = plotX + Math.cos(Math.PI + jointAngle) * dRControlPoint;
2734
+ rightContY = plotY + Math.sin(Math.PI + jointAngle) * dRControlPoint;
2735
+
2736
+ // push current point's connectors into returned object
2737
+
2738
+ ret = {
2739
+ rightContX: rightContX,
2740
+ rightContY: rightContY,
2741
+ leftContX: leftContX,
2742
+ leftContY: leftContY,
2743
+ plotX: plotX,
2744
+ plotY: plotY
2745
+ };
2746
+
2747
+ // calculate connectors for previous and next point and push them inside returned object
2748
+ if (calculateNeighbours) {
2749
+ ret.prevPointCont = this.getConnectors(segment, prevPointInd, false, connectEnds);
2750
+ }
2751
+ return ret;
2752
+ };
2753
+
2535
2754
  /**
2536
2755
  * Wrap the buildKDTree function so that it searches by angle (clientX) in case of shared tooltip,
2537
2756
  * and by two dimensional distance in case of non-shared.
@@ -2541,7 +2760,7 @@
2541
2760
  if (this.kdByAngle) {
2542
2761
  this.searchPoint = this.searchPointByAngle;
2543
2762
  } else {
2544
- this.kdDimensions = 2;
2763
+ this.options.findNearestPointBy = 'xy';
2545
2764
  }
2546
2765
  }
2547
2766
  proceed.apply(this);
@@ -2585,104 +2804,35 @@
2585
2804
  * Overridden method for calculating a spline from one point to the next
2586
2805
  */
2587
2806
  wrap(seriesTypes.spline.prototype, 'getPointSpline', function(proceed, segment, point, i) {
2588
-
2589
2807
  var ret,
2590
- smoothing = 1.5, // 1 means control points midway between points, 2 means 1/3 from the point, 3 is 1/4 etc;
2591
- denom = smoothing + 1,
2592
- plotX,
2593
- plotY,
2594
- lastPoint,
2595
- nextPoint,
2596
- lastX,
2597
- lastY,
2598
- nextX,
2599
- nextY,
2600
- leftContX,
2601
- leftContY,
2602
- rightContX,
2603
- rightContY,
2604
- distanceLeftControlPoint,
2605
- distanceRightControlPoint,
2606
- leftContAngle,
2607
- rightContAngle,
2608
- jointAngle;
2609
-
2808
+ connectors;
2610
2809
 
2611
2810
  if (this.chart.polar) {
2612
-
2613
- plotX = point.plotX;
2614
- plotY = point.plotY;
2615
- lastPoint = segment[i - 1];
2616
- nextPoint = segment[i + 1];
2617
-
2618
- // Connect ends
2619
- if (this.connectEnds) {
2620
- if (!lastPoint) {
2621
- lastPoint = segment[segment.length - 2]; // not the last but the second last, because the segment is already connected
2622
- }
2623
- if (!nextPoint) {
2624
- nextPoint = segment[1];
2625
- }
2626
- }
2627
-
2628
- // find control points
2629
- if (lastPoint && nextPoint) {
2630
-
2631
- lastX = lastPoint.plotX;
2632
- lastY = lastPoint.plotY;
2633
- nextX = nextPoint.plotX;
2634
- nextY = nextPoint.plotY;
2635
- leftContX = (smoothing * plotX + lastX) / denom;
2636
- leftContY = (smoothing * plotY + lastY) / denom;
2637
- rightContX = (smoothing * plotX + nextX) / denom;
2638
- rightContY = (smoothing * plotY + nextY) / denom;
2639
- distanceLeftControlPoint = Math.sqrt(Math.pow(leftContX - plotX, 2) + Math.pow(leftContY - plotY, 2));
2640
- distanceRightControlPoint = Math.sqrt(Math.pow(rightContX - plotX, 2) + Math.pow(rightContY - plotY, 2));
2641
- leftContAngle = Math.atan2(leftContY - plotY, leftContX - plotX);
2642
- rightContAngle = Math.atan2(rightContY - plotY, rightContX - plotX);
2643
- jointAngle = (Math.PI / 2) + ((leftContAngle + rightContAngle) / 2);
2644
-
2645
-
2646
- // Ensure the right direction, jointAngle should be in the same quadrant as leftContAngle
2647
- if (Math.abs(leftContAngle - jointAngle) > Math.PI / 2) {
2648
- jointAngle -= Math.PI;
2649
- }
2650
-
2651
- // Find the corrected control points for a spline straight through the point
2652
- leftContX = plotX + Math.cos(jointAngle) * distanceLeftControlPoint;
2653
- leftContY = plotY + Math.sin(jointAngle) * distanceLeftControlPoint;
2654
- rightContX = plotX + Math.cos(Math.PI + jointAngle) * distanceRightControlPoint;
2655
- rightContY = plotY + Math.sin(Math.PI + jointAngle) * distanceRightControlPoint;
2656
-
2657
- // Record for drawing in next point
2658
- point.rightContX = rightContX;
2659
- point.rightContY = rightContY;
2660
-
2661
- }
2662
-
2663
-
2664
2811
  // moveTo or lineTo
2665
2812
  if (!i) {
2666
- ret = ['M', plotX, plotY];
2813
+ ret = ['M', point.plotX, point.plotY];
2667
2814
  } else { // curve from last point to this
2815
+ connectors = this.getConnectors(segment, i, true, this.connectEnds);
2668
2816
  ret = [
2669
2817
  'C',
2670
- lastPoint.rightContX || lastPoint.plotX,
2671
- lastPoint.rightContY || lastPoint.plotY,
2672
- leftContX || plotX,
2673
- leftContY || plotY,
2674
- plotX,
2675
- plotY
2818
+ connectors.prevPointCont.rightContX,
2819
+ connectors.prevPointCont.rightContY,
2820
+ connectors.leftContX,
2821
+ connectors.leftContY,
2822
+ connectors.plotX,
2823
+ connectors.plotY
2676
2824
  ];
2677
- lastPoint.rightContX = lastPoint.rightContY = null; // reset for updating series later
2678
2825
  }
2679
-
2680
-
2681
2826
  } else {
2682
2827
  ret = proceed.call(this, segment, point, i);
2683
2828
  }
2684
2829
  return ret;
2685
2830
  });
2831
+
2832
+ // #6430 Areasplinerange series use unwrapped getPointSpline method, so we need to set this method again.
2833
+ if (seriesTypes.areasplinerange) {
2834
+ seriesTypes.areasplinerange.prototype.getPointSpline = seriesTypes.spline.prototype.getPointSpline;
2835
+ }
2686
2836
  }
2687
2837
 
2688
2838
  /**
@@ -2721,7 +2871,8 @@
2721
2871
  wrap(seriesProto, 'getGraphPath', function(proceed, points) {
2722
2872
  var series = this,
2723
2873
  i,
2724
- firstValid;
2874
+ firstValid,
2875
+ popLastPoint;
2725
2876
 
2726
2877
  // Connect the path
2727
2878
  if (this.chart.polar) {
@@ -2737,6 +2888,7 @@
2737
2888
  if (this.options.connectEnds !== false && firstValid !== undefined) {
2738
2889
  this.connectEnds = true; // re-used in splines
2739
2890
  points.splice(points.length, 0, points[firstValid]);
2891
+ popLastPoint = true;
2740
2892
  }
2741
2893
 
2742
2894
  // For area charts, pseudo points are added to the graph, now we need to translate these
@@ -2748,8 +2900,15 @@
2748
2900
  }
2749
2901
 
2750
2902
  // Run uber method
2751
- return proceed.apply(this, [].slice.call(arguments, 1));
2903
+ var ret = proceed.apply(this, [].slice.call(arguments, 1));
2752
2904
 
2905
+ /** #6212 points.splice method is adding points to an array. In case of areaspline getGraphPath method is used two times
2906
+ * and in both times points are added to an array. That is why points.pop is used, to get unmodified points.
2907
+ */
2908
+ if (popLastPoint) {
2909
+ points.pop();
2910
+ }
2911
+ return ret;
2753
2912
  });
2754
2913
 
2755
2914
 
@@ -2958,5 +3117,38 @@
2958
3117
  return ret;
2959
3118
  });
2960
3119
 
3120
+ wrap(H.Chart.prototype, 'getAxes', function(proceed) {
3121
+
3122
+ if (!this.pane) {
3123
+ this.pane = [];
3124
+ }
3125
+ each(H.splat(this.options.pane), function(paneOptions) {
3126
+ new H.Pane( // eslint-disable-line no-new
3127
+ paneOptions,
3128
+ this
3129
+ );
3130
+ }, this);
3131
+
3132
+ proceed.call(this);
3133
+ });
3134
+
3135
+ wrap(H.Chart.prototype, 'drawChartBox', function(proceed) {
3136
+ proceed.call(this);
3137
+
3138
+ each(this.pane, function(pane) {
3139
+ pane.render();
3140
+ });
3141
+ });
3142
+
3143
+ /**
3144
+ * Extend chart.get to also search in panes. Used internally in responsiveness
3145
+ * and chart.update.
3146
+ */
3147
+ wrap(H.Chart.prototype, 'get', function(proceed, id) {
3148
+ return H.find(this.pane, function(pane) {
3149
+ return pane.options.id === id;
3150
+ }) || proceed.call(this, id);
3151
+ });
3152
+
2961
3153
  }(Highcharts));
2962
3154
  }));