highcharts-rails 5.0.12 → 5.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +59 -0
  3. data/app/assets/javascripts/highcharts.js +6250 -788
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +210 -25
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +908 -22
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +272 -64
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +1 -1
  8. data/app/assets/javascripts/highcharts/modules/boost.js +89 -66
  9. data/app/assets/javascripts/highcharts/modules/broken-axis.js +65 -4
  10. data/app/assets/javascripts/highcharts/modules/data.js +1 -1
  11. data/app/assets/javascripts/highcharts/modules/drilldown.js +234 -17
  12. data/app/assets/javascripts/highcharts/modules/exporting.js +508 -69
  13. data/app/assets/javascripts/highcharts/modules/funnel.js +129 -8
  14. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  15. data/app/assets/javascripts/highcharts/modules/heatmap.js +361 -44
  16. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +64 -1
  17. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +44 -44
  18. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +26 -3
  19. data/app/assets/javascripts/highcharts/modules/series-label.js +19 -1
  20. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +14 -5
  21. data/app/assets/javascripts/highcharts/modules/stock.js +1122 -86
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +265 -43
  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.12 (2017-05-24)
2
+ * @license Highcharts JS v5.0.13 (2017-07-27)
3
3
  * Accessibility module
4
4
  *
5
5
  * (c) 2010-2017 Highsoft AS
@@ -86,19 +86,210 @@
86
86
  }
87
87
 
88
88
 
89
- // Default a11y options
89
+ /**
90
+ * Accessibility options
91
+ * @type {Object}
92
+ * @optionparent
93
+ */
90
94
  H.setOptions({
95
+
96
+ /**
97
+ * Options for configuring accessibility for the chart. Requires the
98
+ * [accessibility module](//code.highcharts.com/modules/accessibility.
99
+ * js) to be loaded. For a description of the module and information
100
+ * on its features, see [Highcharts Accessibility](http://www.highcharts.
101
+ * com/docs/chart-concepts/accessibility).
102
+ *
103
+ * @since 5.0.0
104
+ * @product highcharts highstock highmaps
105
+ */
91
106
  accessibility: {
107
+
108
+ /**
109
+ * Enable accessibility features for the chart.
110
+ *
111
+ * @type {Boolean}
112
+ * @default true
113
+ * @since 5.0.0
114
+ * @product highcharts highstock highmaps
115
+ */
92
116
  enabled: true,
117
+
118
+ /**
119
+ * When a series contains more points than this, we no longer expose
120
+ * information about individual points to screen readers.
121
+ *
122
+ * Set to `false` to disable.
123
+ *
124
+ * @type {Number|Boolean}
125
+ * @default 30
126
+ * @since 5.0.0
127
+ * @product highcharts highstock highmaps
128
+ */
93
129
  pointDescriptionThreshold: 30, // set to false to disable
130
+
131
+ /**
132
+ * Options for keyboard navigation.
133
+ *
134
+ * @type {Object}
135
+ * @since 5.0.0
136
+ * @product highcharts highstock highmaps
137
+ */
94
138
  keyboardNavigation: {
95
- enabled: true
96
- // skipNullPoints: false
139
+
140
+ /**
141
+ * Enable keyboard navigation for the chart.
142
+ *
143
+ * @type {Boolean}
144
+ * @default true
145
+ * @since 5.0.0
146
+ */
147
+ enabled: true,
148
+
149
+ /**
150
+ * Enable tab navigation for points. Without this, only arrow keys
151
+ * can be used to navigate between points.
152
+ *
153
+ * @type {Boolean}
154
+ * @default {all} true
155
+ * @since next
156
+ */
157
+ tabThroughPoints: true
158
+
159
+ /**
160
+ * Skip null points when navigating through points with the
161
+ * keyboard.
162
+ *
163
+ * @type {Boolean}
164
+ * @default false
165
+ * @since 5.0.0
166
+ * @apioption accessibility.keyboardNavigation.skipNullPoints
167
+ */
97
168
  }
98
- // describeSingleSeries: false
169
+
170
+ /**
171
+ * Whether or not to add series descriptions to charts with a single
172
+ * series.
173
+ *
174
+ * @type {Boolean}
175
+ * @default false
176
+ * @since 5.0.0
177
+ * @product highcharts highstock highmaps
178
+ * @apioption accessibility.describeSingleSeries
179
+ */
180
+
181
+ /**
182
+ * Function to run upon clicking the "View as Data Table" link in the
183
+ * screen reader region.
184
+ *
185
+ * By default Highcharts will insert and set focus to a data table
186
+ * representation of the chart.
187
+ *
188
+ * @type {Function}
189
+ * @since 5.0.0
190
+ * @apioption accessibility.onTableAnchorClick
191
+ */
192
+
193
+ /**
194
+ * Date format to use for points on datetime axes when describing them
195
+ * to screen reader users.
196
+ *
197
+ * Defaults to the same format as in tooltip.
198
+ *
199
+ * For an overview of the replacement codes, see [dateFormat](
200
+ * #Highcharts.dateFormat).
201
+ *
202
+ * @type {String}
203
+ * @see [pointDateFormatter](#accessibility.pointDateFormatter)
204
+ * @since 5.0.0
205
+ * @apioption accessibility.pointDateFormat
206
+ */
207
+
208
+ /**
209
+ * Formatter function to determine the date/time format used with points
210
+ * on datetime axes when describing them to screen reader users. Receives
211
+ * one argument, `point`, referring to the point to describe. Should
212
+ * return a date format string compatible with [dateFormat](#Highcharts.
213
+ * dateFormat).
214
+ *
215
+ * @type {Function}
216
+ * @see [pointDateFormat](#accessibility.pointDateFormat)
217
+ * @since 5.0.0
218
+ * @apioption accessibility.pointDateFormatter
219
+ */
220
+
221
+ /**
222
+ * Formatter function to use instead of the default for point descriptions.
223
+ * Receives one argument, `point`, referring to the point to describe.
224
+ * Should return a String with the description of the point for a screen
225
+ * reader user.
226
+ *
227
+ * @type {Function}
228
+ * @see [point.description](#series<line>.data.description)
229
+ * @since 5.0.0
230
+ * @apioption accessibility.pointDescriptionFormatter
231
+ */
232
+
233
+ /**
234
+ * A formatter function to create the HTML contents of the hidden screen
235
+ * reader information region. Receives one argument, `chart`, referring
236
+ * to the chart object. Should return a String with the HTML content
237
+ * of the region.
238
+ *
239
+ * The link to view the chart as a data table will be added automatically
240
+ * after the custom HTML content.
241
+ *
242
+ * @type {Function}
243
+ * @default undefined
244
+ * @since 5.0.0
245
+ * @apioption accessibility.screenReaderSectionFormatter
246
+ */
247
+
248
+ /**
249
+ * Formatter function to use instead of the default for series descriptions.
250
+ * Receives one argument, `series`, referring to the series to describe.
251
+ * Should return a String with the description of the series for a
252
+ * screen reader user.
253
+ *
254
+ * @type {Function}
255
+ * @see [series.description](#plotOptions.series.description)
256
+ * @since 5.0.0
257
+ * @apioption accessibility.seriesDescriptionFormatter
258
+ */
99
259
  }
100
260
  });
101
261
 
262
+ /**
263
+ * A text description of the chart.
264
+ *
265
+ * If the Accessibility module is loaded, this is included by default
266
+ * as a long description of the chart and its contents in the hidden
267
+ * screen reader information region.
268
+ *
269
+ * @type {String}
270
+ * @see [typeDescription](#chart.typeDescription)
271
+ * @default undefined
272
+ * @since 5.0.0
273
+ * @apioption chart.description
274
+ */
275
+
276
+ /**
277
+ * A text description of the chart type.
278
+ *
279
+ * If the Accessibility module is loaded, this will be included in the
280
+ * description of the chart in the screen reader information region.
281
+ *
282
+ *
283
+ * Highcharts will by default attempt to guess the chart type, but for
284
+ * more complex charts it is recommended to specify this property for
285
+ * clarity.
286
+ *
287
+ * @type {String}
288
+ * @default undefined
289
+ * @since 5.0.0
290
+ * @apioption chart.typeDescription
291
+ */
292
+
102
293
  /**
103
294
  * HTML encode some characters vulnerable for XSS.
104
295
  * @param {string} html The input string
@@ -370,14 +561,25 @@
370
561
  };
371
562
 
372
563
  // Function to highlight next/previous point in chart
373
- // Returns highlighted point on success, false on failure (no adjacent point to highlight in chosen direction)
564
+ // Returns highlighted point on success, false on failure (no adjacent point to
565
+ // highlight in chosen direction)
374
566
  H.Chart.prototype.highlightAdjacentPoint = function(next) {
375
- var series = this.series,
376
- curPoint = this.highlightedPoint,
567
+ var chart = this,
568
+ series = chart.series,
569
+ curPoint = chart.highlightedPoint,
377
570
  curPointIndex = curPoint && curPoint.index || 0,
378
571
  curPoints = curPoint && curPoint.series.points,
572
+ lastSeries = chart.series && chart.series[chart.series.length - 1],
573
+ lastPoint = lastSeries && lastSeries.points &&
574
+ lastSeries.points[lastSeries.points.length - 1],
379
575
  newSeries,
380
576
  newPoint,
577
+ isSkipPoint = function(point) {
578
+ return point.isNull &&
579
+ chart.options.accessibility.keyboardNavigation.skipNullPoints ||
580
+ point.series.options.skipKeyboardNavigation ||
581
+ !point.series.visible;
582
+ },
381
583
  // Handle connecting ends - where the points array has an extra last
382
584
  // point that is a reference to the first one. We skip this.
383
585
  forwardSkipAmount = curPoint && curPoint.series.connectEnds &&
@@ -388,43 +590,42 @@
388
590
  return false;
389
591
  }
390
592
 
391
- // Use first point if none already highlighted
392
593
  if (!curPoint) {
393
- return series[0].points[0].highlight();
394
- }
395
-
396
- // Find index of current point in series.points array. Necessary for dataGrouping (and maybe zoom?)
397
- if (curPoints[curPointIndex] !== curPoint) {
398
- for (var i = 0; i < curPoints.length; ++i) {
399
- if (curPoints[i] === curPoint) {
400
- curPointIndex = i;
401
- break;
594
+ // No point is highlighted yet. Try first/last point depending on move
595
+ // direction
596
+ newPoint = next ? series[0].points[0] : lastPoint;
597
+ } else {
598
+ // We have a highlighted point.
599
+ // Find index of current point in series.points array. Necessary for
600
+ // dataGrouping (and maybe zoom?)
601
+ if (curPoints[curPointIndex] !== curPoint) {
602
+ for (var i = 0; i < curPoints.length; ++i) {
603
+ if (curPoints[i] === curPoint) {
604
+ curPointIndex = i;
605
+ break;
606
+ }
402
607
  }
403
608
  }
404
- }
405
609
 
406
- // Grab next/prev point & series
407
- newSeries = series[curPoint.series.index + (next ? 1 : -1)];
408
- newPoint = curPoints[curPointIndex + (next ? forwardSkipAmount : -1)] ||
409
- // Done with this series, try next one
410
- newSeries &&
411
- newSeries.points[next ? 0 : newSeries.points.length - (
412
- newSeries.connectEnds ? 2 : 1
413
- )];
414
-
415
- // If there is no adjacent point, we return false
416
- if (newPoint === undefined) {
417
- return false;
610
+ // Grab next/prev point & series
611
+ newSeries = series[curPoint.series.index + (next ? 1 : -1)];
612
+ newPoint = curPoints[curPointIndex + (next ? forwardSkipAmount : -1)] ||
613
+ // Done with this series, try next one
614
+ newSeries &&
615
+ newSeries.points[next ? 0 : newSeries.points.length - (
616
+ newSeries.connectEnds ? 2 : 1
617
+ )];
618
+
619
+ // If there is no adjacent point, we return false
620
+ if (newPoint === undefined) {
621
+ return false;
622
+ }
418
623
  }
419
624
 
420
625
  // Recursively skip null points or points in series that should be skipped
421
- if (
422
- newPoint.isNull &&
423
- this.options.accessibility.keyboardNavigation.skipNullPoints ||
424
- newPoint.series.options.skipKeyboardNavigation
425
- ) {
426
- this.highlightedPoint = newPoint;
427
- return this.highlightAdjacentPoint(next);
626
+ if (isSkipPoint(newPoint)) {
627
+ chart.highlightedPoint = newPoint;
628
+ return chart.highlightAdjacentPoint(next);
428
629
  }
429
630
 
430
631
  // There is an adjacent point, highlight it
@@ -519,12 +720,15 @@
519
720
  // The module's keyCode handlers determine when to move to another module.
520
721
  // Validate holds a function to determine if there are prerequisites for this module to run that are not met.
521
722
  // Init holds a function to run once before any keyCodes are interpreted.
723
+ // Terminate holds a function to run once before moving to next/prev module.
522
724
  // transformTabs determines whether to transform tabs to left/right events or not. Defaults to true.
523
725
  function KeyboardNavigationModule(options) {
726
+ this.id = options.id;
524
727
  this.keyCodeMap = options.keyCodeMap;
525
728
  this.move = options.move;
526
729
  this.validate = options.validate;
527
730
  this.init = options.init;
731
+ this.terminate = options.terminate;
528
732
  this.transformTabs = options.transformTabs !== false;
529
733
  }
530
734
  KeyboardNavigationModule.prototype = {
@@ -544,12 +748,15 @@
544
748
  };
545
749
  // Maintain abstraction between KeyboardNavigationModule and Highcharts
546
750
  // The chart object keeps track of a list of KeyboardNavigationModules that we move through
547
- function navModuleFactory(keyMap, options) {
751
+ function navModuleFactory(id, keyMap, options) {
548
752
  return new KeyboardNavigationModule(merge({
549
753
  keyCodeMap: keyMap,
550
754
  // Move to next/prev valid module, or undefined if none, and init it.
551
755
  // Returns true on success and false if there is no valid module to move to.
552
756
  move: function(direction) {
757
+ if (this.terminate) {
758
+ this.terminate(direction);
759
+ }
553
760
  chart.keyboardNavigationModuleIndex += direction;
554
761
  var newModule = chart.keyboardNavigationModules[chart.keyboardNavigationModuleIndex];
555
762
  if (newModule) {
@@ -566,6 +773,8 @@
566
773
  chart.slipNextTab = true; // Allow next tab to slip, as we will have focus on chart now
567
774
  return false;
568
775
  }
776
+ }, {
777
+ id: id
569
778
  }, options));
570
779
  }
571
780
 
@@ -599,7 +808,7 @@
599
808
  // Each mode determines when to move to the next/prev mode.
600
809
  chart.keyboardNavigationModules = [
601
810
  // Points
602
- navModuleFactory([
811
+ navModuleFactory('points', [
603
812
  // Left/Right
604
813
  [
605
814
  [37, 39],
@@ -634,26 +843,29 @@
634
843
  }
635
844
  ]
636
845
  ], {
637
- // If coming back to points from other module, highlight last point
638
- init: function(direction) {
639
- var lastSeries = chart.series && chart.series[chart.series.length - 1],
640
- lastPoint = lastSeries && lastSeries.points && lastSeries.points[lastSeries.points.length - 1];
641
- if (direction < 0 && lastPoint) {
642
- lastPoint.highlight();
846
+ // Always start highlighting from scratch when entering this module
847
+ init: function() {
848
+ delete chart.highlightedPoint;
849
+ },
850
+ // If leaving points, don't show tooltip anymore
851
+ terminate: function() {
852
+ if (chart.tooltip) {
853
+ chart.tooltip.hide(0);
643
854
  }
644
- }
855
+ delete chart.highlightedPoint;
856
+ },
857
+
858
+ transformTabs: chart.options.accessibility.keyboardNavigation.tabThroughPoints
645
859
  }),
646
860
 
647
861
  // Exporting
648
- navModuleFactory([
862
+ navModuleFactory('exporting', [
649
863
  // Left/Up
650
864
  [
651
865
  [37, 38],
652
866
  function() {
653
867
  var i = chart.highlightedExportItem || 0,
654
- reachedEnd = true,
655
- series = chart.series,
656
- newSeries;
868
+ reachedEnd = true;
657
869
  // Try to highlight prev item in list. Highlighting e.g. separators will fail.
658
870
  while (i--) {
659
871
  if (chart.highlightExportItem(i)) {
@@ -663,14 +875,6 @@
663
875
  }
664
876
  if (reachedEnd) {
665
877
  chart.hideExportMenu();
666
- // Wrap to last point
667
- if (series && series.length) {
668
- newSeries = series[series.length - 1];
669
- if (newSeries.points.length) {
670
- newSeries.points[newSeries.points.length - 1].highlight();
671
- }
672
- }
673
- // Try to move to prev module (should be points, since we wrapped to last point)
674
878
  return this.move(-1);
675
879
  }
676
880
  }
@@ -722,7 +926,7 @@
722
926
  }),
723
927
 
724
928
  // Map zoom
725
- navModuleFactory([
929
+ navModuleFactory('mapZoom', [
726
930
  // Up/down/left/right
727
931
  [
728
932
  [38, 40, 37, 39],
@@ -787,7 +991,7 @@
787
991
  }),
788
992
 
789
993
  // Highstock range selector (minus input boxes)
790
- navModuleFactory([
994
+ navModuleFactory('rangeSelector', [
791
995
  // Left/Right/Up/Down
792
996
  [
793
997
  [37, 39, 38, 40],
@@ -827,7 +1031,7 @@
827
1031
  }),
828
1032
 
829
1033
  // Highstock range selector, input boxes
830
- navModuleFactory([
1034
+ navModuleFactory('rangeSelectorInput', [
831
1035
  // Tab/Up/Down
832
1036
  [
833
1037
  [9, 38, 40],
@@ -859,7 +1063,7 @@
859
1063
  }),
860
1064
 
861
1065
  // Legend navigation
862
- navModuleFactory([
1066
+ navModuleFactory('legend', [
863
1067
  // Left/Right/Up/Down
864
1068
  [
865
1069
  [37, 39, 38, 40],
@@ -881,9 +1085,13 @@
881
1085
  ], {
882
1086
  // Only run this module if we have at least one legend - wait for it - item.
883
1087
  // Don't run if the legend is populated by a colorAxis.
1088
+ // Don't run if legend navigation is disabled.
884
1089
  validate: function() {
885
1090
  return chart.legend && chart.legend.allItems &&
886
- !(chart.colorAxis && chart.colorAxis.length);
1091
+ !(chart.colorAxis && chart.colorAxis.length) &&
1092
+ (chart.options.legend &&
1093
+ chart.options.legend.keyboardNavigation &&
1094
+ chart.options.legend.keyboardNavigation.enabled) !== false;
887
1095
  },
888
1096
 
889
1097
  // Make elements focusable and accessible