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
  *
4
4
  * (c) 2009-2017 Torstein Honsi
5
5
  *
@@ -347,19 +347,80 @@
347
347
  H.Series.prototype.gappedPath = function() {
348
348
  var gapSize = this.options.gapSize,
349
349
  points = this.points.slice(),
350
- i = points.length - 1;
350
+ i = points.length - 1,
351
+ yAxis = this.yAxis,
352
+ xRange,
353
+ stack;
354
+
355
+ /**
356
+ * Defines when to display a gap in the graph, together with the `gapUnit`
357
+ * option.
358
+ *
359
+ * When the `gapUnit` is `relative` (default), a gap size of 5 means
360
+ * that if the distance between two points is greater than five times
361
+ * that of the two closest points, the graph will be broken.
362
+ *
363
+ * When the `gapUnit` is `value`, the gap is based on absolute axis values,
364
+ * which on a datetime axis is milliseconds.
365
+ *
366
+ * In practice, this option is most often used to visualize gaps in
367
+ * time series. In a stock chart, intraday data is available for daytime
368
+ * hours, while gaps will appear in nights and weekends.
369
+ *
370
+ * @type {Number}
371
+ * @see [xAxis.breaks](#xAxis.breaks)
372
+ * @sample {highstock} stock/plotoptions/series-gapsize/
373
+ * Setting the gap size to 2 introduces gaps for weekends in daily
374
+ * datasets.
375
+ * @default 0
376
+ * @product highstock
377
+ * @apioption plotOptions.series.gapSize
378
+ */
379
+
380
+ /**
381
+ * Together with `gapSize`, this option defines where to draw gaps in the
382
+ * graph.
383
+ *
384
+ * @type {String}
385
+ * @see [gapSize](plotOptions.series.gapSize)
386
+ * @default relative
387
+ * @validvalues ["relative", "value"]
388
+ * @since 5.0.13
389
+ * @product highstock
390
+ * @apioption plotOptions.series.gapUnit
391
+ */
351
392
 
352
393
  if (gapSize && i > 0) { // #5008
353
394
 
395
+ // Gap unit is relative
396
+ if (this.options.gapUnit !== 'value') {
397
+ gapSize *= this.closestPointRange;
398
+ }
399
+
354
400
  // extension for ordinal breaks
355
401
  while (i--) {
356
- if (points[i + 1].x - points[i].x > this.closestPointRange * gapSize) {
402
+ if (points[i + 1].x - points[i].x > gapSize) {
403
+ xRange = (points[i].x + points[i + 1].x) / 2;
404
+
357
405
  points.splice( // insert after this one
358
406
  i + 1,
359
407
  0, {
360
- isNull: true
408
+ isNull: true,
409
+ x: xRange
361
410
  }
362
411
  );
412
+
413
+ // For stacked chart generate empty stack items, #6546
414
+ if (this.options.stacking) {
415
+ stack = yAxis.stacks[this.stackKey][xRange] = new H.StackItem(
416
+ yAxis,
417
+ yAxis.options.stackLabels,
418
+ false,
419
+ xRange,
420
+ this.stack
421
+ );
422
+ stack.total = 0;
423
+ }
363
424
  }
364
425
  }
365
426
  }
@@ -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
  * Data module
4
4
  *
5
5
  * (c) 2012-2017 Torstein Honsi
@@ -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
  * Highcharts Drilldown module
4
4
  *
5
5
  * Author: Torstein Honsi
@@ -46,28 +46,158 @@
46
46
  extend(defaultOptions.lang, {
47
47
  drillUpText: '◁ Back to {series.name}'
48
48
  });
49
+
50
+ /**
51
+ * Options for drill down, the concept of inspecting increasingly high
52
+ * resolution data through clicking on chart items like columns or pie slices.
53
+ *
54
+ * The drilldown feature requires the drilldown.js file to be loaded,
55
+ * found in the modules directory of the download package, or online at
56
+ * (code.highcharts.com/modules/drilldown.js)[code.highcharts.com/modules/drilldown.js].
57
+ *
58
+ * @type {Object}
59
+ * @optionparent drilldown
60
+ */
49
61
  defaultOptions.drilldown = {
50
62
 
63
+
64
+ /**
65
+ * Additional styles to apply to the X axis label for a point that
66
+ * has drilldown data. By default it is underlined and blue to invite
67
+ * to interaction.
68
+ *
69
+ * @type {CSSObject}
70
+ * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
71
+ * style/style-by-css), active label styles can be set with the `.highcharts-
72
+ * drilldown-axis-label` class.
73
+ * @sample {highcharts} highcharts/drilldown/labels/ Label styles
74
+ * @default { "cursor": "pointer", "color": "#003399", "fontWeight": "bold", "textDecoration": "underline" }
75
+ * @since 3.0.8
76
+ * @product highcharts highmaps
77
+ */
51
78
  activeAxisLabelStyle: {
79
+
80
+ /**
81
+ */
52
82
  cursor: 'pointer',
83
+
84
+ /**
85
+ */
53
86
  color: '#003399',
87
+
88
+ /**
89
+ */
54
90
  fontWeight: 'bold',
91
+
92
+ /**
93
+ */
55
94
  textDecoration: 'underline'
56
95
  },
96
+
97
+ /**
98
+ * Additional styles to apply to the data label of a point that has
99
+ * drilldown data. By default it is underlined and blue to invite to
100
+ * interaction.
101
+ *
102
+ * @type {CSSObject}
103
+ * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
104
+ * style/style-by-css), active data label styles can be applied with
105
+ * the `.highcharts-drilldown-data-label` class.
106
+ * @sample {highcharts} highcharts/drilldown/labels/ Label styles
107
+ * @default { "cursor": "pointer", "color": "#003399", "fontWeight": "bold", "textDecoration": "underline" }
108
+ * @since 3.0.8
109
+ * @product highcharts highmaps
110
+ */
57
111
  activeDataLabelStyle: {
112
+
113
+ /**
114
+ */
58
115
  cursor: 'pointer',
116
+
117
+ /**
118
+ */
59
119
  color: '#003399',
120
+
121
+ /**
122
+ */
60
123
  fontWeight: 'bold',
124
+
125
+ /**
126
+ */
61
127
  textDecoration: 'underline'
62
128
  },
63
129
 
130
+
131
+ /**
132
+ * Set the animation for all drilldown animations. Animation of a drilldown
133
+ * occurs when drilling between a column point and a column series,
134
+ * or a pie slice and a full pie series. Drilldown can still be used
135
+ * between series and points of different types, but animation will
136
+ * not occur.
137
+ *
138
+ * The animation can either be set as a boolean or a configuration
139
+ * object. If `true`, it will use the 'swing' jQuery easing and a duration
140
+ * of 500 ms. If used as a configuration object, the following properties
141
+ * are supported:
142
+ *
143
+ * <dl>
144
+ *
145
+ * <dt>duration</dt>
146
+ *
147
+ * <dd>The duration of the animation in milliseconds.</dd>
148
+ *
149
+ * <dt>easing</dt>
150
+ *
151
+ * <dd>A string reference to an easing function set on the `Math` object.
152
+ * See [the easing demo](http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-
153
+ * animation-easing/).</dd>
154
+ *
155
+ * </dl>
156
+ *
157
+ * @type {Boolean|Object}
158
+ * @since 3.0.8
159
+ * @product highcharts highmaps
160
+ */
64
161
  animation: {
162
+
163
+ /**
164
+ */
65
165
  duration: 500
66
166
  },
167
+
168
+ /**
169
+ * Options for the drill up button that appears when drilling down
170
+ * on a series. The text for the button is defined in [lang.drillUpText](#lang.
171
+ * drillUpText).
172
+ *
173
+ * @type {Object}
174
+ * @sample {highcharts} highcharts/drilldown/drillupbutton/ Drill up button
175
+ * @sample {highmaps} highcharts/drilldown/drillupbutton/ Drill up button
176
+ * @since 3.0.8
177
+ * @product highcharts highmaps
178
+ */
67
179
  drillUpButton: {
180
+
181
+ /**
182
+ * Positioning options for the button within the `relativeTo` box.
183
+ * Available properties are `x`, `y`, `align` and `verticalAlign`.
184
+ *
185
+ * @type {Object}
186
+ * @since 3.0.8
187
+ * @product highcharts highmaps
188
+ */
68
189
  position: {
190
+
191
+ /**
192
+ */
69
193
  align: 'right',
194
+
195
+ /**
196
+ */
70
197
  x: -10,
198
+
199
+ /**
200
+ */
71
201
  y: 10
72
202
  }
73
203
  // relativeTo: 'plotBox'
@@ -75,6 +205,72 @@
75
205
  }
76
206
  };
77
207
 
208
+
209
+
210
+ /**
211
+ * Fires when a drilldown point is clicked, before the new series is
212
+ * added. This event is also utilized for async drilldown, where the
213
+ * seriesOptions are not added by option, but rather loaded async. Note
214
+ * that when clicking a category label to trigger multiple series drilldown,
215
+ * one `drilldown` event is triggered per point in the category.
216
+ *
217
+ * Event arguments:
218
+ *
219
+ * <dl>
220
+ *
221
+ * <dt>`category`</dt>
222
+ *
223
+ * <dd>If a category label was clicked, which index.</dd>
224
+ *
225
+ * <dt>`point`</dt>
226
+ *
227
+ * <dd>The originating point.</dd>
228
+ *
229
+ * <dt>`originalEvent`</dt>
230
+ *
231
+ * <dd>The original browser event (usually click) that triggered the
232
+ * drilldown.</dd>
233
+ *
234
+ * <dt>`points`</dt>
235
+ *
236
+ * <dd>If a category label was clicked, this array holds all points
237
+ * corresponing to the category.</dd>
238
+ *
239
+ * <dt>`seriesOptions`</dt>
240
+ *
241
+ * <dd>Options for the new series</dd>
242
+ *
243
+ * </dl>
244
+ *
245
+ * @type {Function}
246
+ * @context Chart
247
+ * @sample {highcharts} highcharts/drilldown/async/ Async drilldown
248
+ * @since 3.0.8
249
+ * @product highcharts highmaps
250
+ * @apioption chart.events.drilldown
251
+ */
252
+
253
+ /**
254
+ * Fires when drilling up from a drilldown series.
255
+ *
256
+ * @type {Function}
257
+ * @context Chart
258
+ * @since 3.0.8
259
+ * @product highcharts highmaps
260
+ * @apioption chart.events.drillup
261
+ */
262
+
263
+ /**
264
+ * In a chart with multiple drilldown series, this event fires after
265
+ * all the series have been drilled up.
266
+ *
267
+ * @type {Function}
268
+ * @context Chart
269
+ * @since 4.2.4
270
+ * @product highcharts highmaps
271
+ * @apioption chart.events.drillupall
272
+ */
273
+
78
274
  /**
79
275
  * A general fadeIn method
80
276
  */
@@ -282,10 +478,10 @@
282
478
 
283
479
  /**
284
480
  * When the chart is drilled down to a child series, calling `chart.drillUp()`
285
- * will drill up to the parent series.
481
+ * will drill up to the parent series. Requires the drilldown module.
286
482
  *
483
+ * @function drillUp
287
484
  * @memberOf Highcharts.Chart
288
- * @name #drillUp
289
485
  */
290
486
  Chart.prototype.drillUp = function() {
291
487
  var chart = this,
@@ -380,8 +576,6 @@
380
576
  };
381
577
 
382
578
 
383
- ColumnSeries.prototype.supportsDrilldown = true;
384
-
385
579
  /**
386
580
  * When drilling up, keep the upper series invisible until the lower series has
387
581
  * moved into place
@@ -550,7 +744,6 @@
550
744
 
551
745
  if (PieSeries) {
552
746
  extend(PieSeries.prototype, {
553
- supportsDrilldown: true,
554
747
  animateDrillupTo: ColumnSeries.prototype.animateDrillupTo,
555
748
  animateDrillupFrom: ColumnSeries.prototype.animateDrillupFrom,
556
749
 
@@ -758,11 +951,19 @@
758
951
  proceed.call(this);
759
952
 
760
953
  each(this.points, function(point) {
761
- var pointCSS = {};
954
+ var dataLabelsOptions = point.options.dataLabels,
955
+ pointCSS = pick(
956
+ point.dlOptions,
957
+ dataLabelsOptions && dataLabelsOptions.style, {}
958
+ );
959
+
762
960
  if (point.drilldown && point.dataLabel) {
763
961
  if (css.color === 'contrast') {
764
962
  pointCSS.color = renderer.getContrast(point.color || this.color);
765
963
  }
964
+ if (dataLabelsOptions && dataLabelsOptions.color) {
965
+ pointCSS.color = dataLabelsOptions.color;
966
+ }
766
967
  point.dataLabel
767
968
  .addClass('highcharts-drilldown-data-label');
768
969
 
@@ -775,26 +976,42 @@
775
976
  }, this);
776
977
  });
777
978
 
979
+
980
+ var applyCursorCSS = function(element, cursor, addClass) {
981
+ element[addClass ? 'addClass' : 'removeClass']('highcharts-drilldown-point');
982
+
983
+
984
+ element.css({
985
+ cursor: cursor
986
+ });
987
+
988
+ };
989
+
778
990
  // Mark the trackers with a pointer
779
991
  var drawTrackerWrapper = function(proceed) {
780
992
  proceed.call(this);
781
993
  each(this.points, function(point) {
782
994
  if (point.drilldown && point.graphic) {
783
- point.graphic.addClass('highcharts-drilldown-point');
784
-
785
-
786
- point.graphic.css({
787
- cursor: 'pointer'
788
- });
789
-
995
+ applyCursorCSS(point.graphic, 'pointer', true);
790
996
  }
791
997
  });
792
998
  };
793
999
 
794
- objectEach(seriesTypes, function(seriesType) {
795
- if (seriesType.prototype.supportsDrilldown) {
796
- wrap(seriesType.prototype, 'drawTracker', drawTrackerWrapper);
1000
+ var setPointStateWrapper = function(proceed, state) {
1001
+ var ret = proceed.apply(this, Array.prototype.slice.call(arguments, 1));
1002
+
1003
+ if (this.drilldown && this.series.halo && state === 'hover') {
1004
+ applyCursorCSS(this.series.halo, 'pointer', true);
1005
+ } else if (this.series.halo) {
1006
+ applyCursorCSS(this.series.halo, 'auto', false);
797
1007
  }
1008
+ return ret;
1009
+ };
1010
+
1011
+
1012
+ objectEach(seriesTypes, function(seriesType) {
1013
+ wrap(seriesType.prototype, 'drawTracker', drawTrackerWrapper);
1014
+ wrap(seriesType.prototype.pointClass.prototype, 'setState', setPointStateWrapper);
798
1015
  });
799
1016
 
800
1017
  }(Highcharts));
@@ -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
  * Exporting module
4
4
  *
5
5
  * (c) 2010-2017 Torstein Honsi
@@ -49,6 +49,9 @@
49
49
  isFirefoxBrowser = /firefox/i.test(userAgent);
50
50
 
51
51
  // Add language
52
+ /**
53
+ * @apioption lang
54
+ */
52
55
  extend(defaultOptions.lang, {
53
56
  printChart: 'Print chart',
54
57
  downloadPNG: 'Download PNG image',
@@ -60,6 +63,10 @@
60
63
 
61
64
  // Buttons and menus are collected in a separate config option set called 'navigation'.
62
65
  // This can be extended later to add control buttons like zoom and pan right click menus.
66
+
67
+ /**
68
+ * @apioption navigation
69
+ */
63
70
  defaultOptions.navigation = {
64
71
  buttonOptions: {
65
72
  theme: {},
@@ -77,91 +84,503 @@
77
84
 
78
85
 
79
86
  // Presentational attributes
80
- merge(true, defaultOptions.navigation, {
81
- menuStyle: {
82
- border: '1px solid #999999',
83
- background: '#ffffff',
84
- padding: '5px 0'
85
- },
86
- menuItemStyle: {
87
- padding: '0.5em 1em',
88
- background: 'none',
89
- color: '#333333',
90
- fontSize: isTouchDevice ? '14px' : '11px',
91
- transition: 'background 250ms, color 250ms'
92
- },
93
- menuItemHoverStyle: {
94
- background: '#335cad',
95
- color: '#ffffff'
96
- },
97
- buttonOptions: {
98
- symbolFill: '#666666',
99
- symbolStroke: '#666666',
100
- symbolStrokeWidth: 3,
101
- theme: {
102
- fill: '#ffffff', // capture hover
103
- stroke: 'none',
104
- padding: 5
87
+
88
+ merge(true, defaultOptions.navigation,
89
+ /**
90
+ * A collection of options for buttons and menus appearing in the exporting module.
91
+ * @type {Object}
92
+ * @optionparent navigation
93
+ */
94
+ {
95
+
96
+ /**
97
+ * CSS styles for the popup menu appearing by default when the export
98
+ * icon is clicked. This menu is rendered in HTML.
99
+ *
100
+ * @type {CSSObject}
101
+ * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
102
+ * style/style-by-css), the menu is styled with the `.highcharts-menu`
103
+ * class.
104
+ * @sample {highcharts} highcharts/navigation/menustyle/ Light gray menu background
105
+ * @sample {highstock} highcharts/navigation/menustyle/ Light gray menu background
106
+ * @sample {highmaps} highcharts/navigation/menustyle/ Light gray menu background
107
+ * @default { "border": "1px solid #999999", "background": "#ffffff", "padding": "5px 0" }
108
+ * @since 2.0
109
+ * @product highcharts highstock highmaps
110
+ */
111
+ menuStyle: {
112
+
113
+ /**
114
+ */
115
+ border: '1px solid #999999',
116
+
117
+ /**
118
+ */
119
+ background: '#ffffff',
120
+
121
+ /**
122
+ */
123
+ padding: '5px 0'
124
+ },
125
+
126
+ /**
127
+ * CSS styles for the individual items within the popup menu appearing
128
+ * by default when the export icon is clicked. The menu items are rendered
129
+ * in HTML.
130
+ *
131
+ * @type {CSSObject}
132
+ * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
133
+ * style/style-by-css), the menu items are styled with the `.highcharts-
134
+ * menu-item` class.
135
+ * @sample {highcharts} highcharts/navigation/menuitemstyle/ Add a grey stripe to the left
136
+ * @sample {highstock} highcharts/navigation/menuitemstyle/ Add a grey stripe to the left
137
+ * @sample {highmaps} highcharts/navigation/menuitemstyle/ Add a grey stripe to the left
138
+ * @default { "padding": "0.5em 1em", "color": "#333333", "background": "none" }
139
+ * @since 2.0
140
+ * @product highcharts highstock highmaps
141
+ */
142
+ menuItemStyle: {
143
+
144
+ /**
145
+ */
146
+ padding: '0.5em 1em',
147
+
148
+ /**
149
+ */
150
+ background: 'none',
151
+
152
+ /**
153
+ */
154
+ color: '#333333',
155
+
156
+ /**
157
+ */
158
+ fontSize: isTouchDevice ? '14px' : '11px',
159
+
160
+ /**
161
+ */
162
+ transition: 'background 250ms, color 250ms'
163
+ },
164
+
165
+ /**
166
+ * CSS styles for the hover state of the individual items within the
167
+ * popup menu appearing by default when the export icon is clicked.
168
+ * The menu items are rendered in HTML.
169
+ *
170
+ * @type {CSSObject}
171
+ * @see In [styled mode](http://www.highcharts.com/docs/chart-design-and-
172
+ * style/style-by-css), the menu items are styled with the `.highcharts-
173
+ * menu-item` class.
174
+ * @sample {highcharts} highcharts/navigation/menuitemhoverstyle/ Bold text on hover
175
+ * @sample {highstock} highcharts/navigation/menuitemhoverstyle/ Bold text on hover
176
+ * @sample {highmaps} highcharts/navigation/menuitemhoverstyle/ Bold text on hover
177
+ * @default { "background": "#335cad", "color": "#ffffff" }
178
+ * @since 2.0
179
+ * @product highcharts highstock highmaps
180
+ */
181
+ menuItemHoverStyle: {
182
+
183
+ /**
184
+ */
185
+ background: '#335cad',
186
+
187
+ /**
188
+ */
189
+ color: '#ffffff'
190
+ },
191
+
192
+ /**
193
+ * A collection of options for buttons appearing in the exporting module.
194
+ *
195
+ *
196
+ * In [styled mode](http://www.highcharts.com/docs/chart-design-and-
197
+ * style/style-by-css), the buttons are styled with the `.highcharts-
198
+ * contextbutton` and `.highcharts-button-symbol` class.
199
+ *
200
+ * @product highcharts highstock highmaps
201
+ */
202
+ buttonOptions: {
203
+
204
+ /**
205
+ * Fill color for the symbol within the button.
206
+ *
207
+ * @type {Color}
208
+ * @sample {highcharts} highcharts/navigation/buttonoptions-symbolfill/ Blue symbol stroke for one of the buttons
209
+ * @sample {highstock} highcharts/navigation/buttonoptions-symbolfill/ Blue symbol stroke for one of the buttons
210
+ * @sample {highmaps} highcharts/navigation/buttonoptions-symbolfill/ Blue symbol stroke for one of the buttons
211
+ * @default #666666
212
+ * @since 2.0
213
+ * @product highcharts highstock highmaps
214
+ */
215
+ symbolFill: '#666666',
216
+
217
+ /**
218
+ * The color of the symbol's stroke or line.
219
+ *
220
+ * @type {Color}
221
+ * @sample {highcharts} highcharts/navigation/buttonoptions-symbolstroke/ Blue symbol stroke
222
+ * @sample {highstock} highcharts/navigation/buttonoptions-symbolstroke/ Blue symbol stroke
223
+ * @sample {highmaps} highcharts/navigation/buttonoptions-symbolstroke/ Blue symbol stroke
224
+ * @default #666666
225
+ * @since 2.0
226
+ * @product highcharts highstock highmaps
227
+ */
228
+ symbolStroke: '#666666',
229
+
230
+ /**
231
+ * The pixel stroke width of the symbol on the button.
232
+ *
233
+ * @type {Number}
234
+ * @sample {highcharts} highcharts/navigation/buttonoptions-height/ Bigger buttons
235
+ * @sample {highstock} highcharts/navigation/buttonoptions-height/ Bigger buttons
236
+ * @sample {highmaps} highcharts/navigation/buttonoptions-height/ Bigger buttons
237
+ * @default 1
238
+ * @since 2.0
239
+ * @product highcharts highstock highmaps
240
+ */
241
+ symbolStrokeWidth: 3,
242
+
243
+ /**
244
+ * A configuration object for the button theme. The object accepts
245
+ * SVG properties like `stroke-width`, `stroke` and `fill`. Tri-state
246
+ * button styles are supported by the `states.hover` and `states.select`
247
+ * objects.
248
+ *
249
+ * @type {Object}
250
+ * @sample {highcharts} highcharts/navigation/buttonoptions-theme/ Theming the buttons
251
+ * @sample {highstock} highcharts/navigation/buttonoptions-theme/ Theming the buttons
252
+ * @sample {highmaps} highcharts/navigation/buttonoptions-theme/ Theming the buttons
253
+ * @since 3.0
254
+ * @product highcharts highstock highmaps
255
+ */
256
+ theme: {
257
+
258
+ /**
259
+ */
260
+ fill: '#ffffff', // capture hover
261
+
262
+ /**
263
+ */
264
+ stroke: 'none',
265
+
266
+ /**
267
+ */
268
+ padding: 5
269
+ }
105
270
  }
106
- }
107
- });
271
+ });
108
272
 
109
273
 
110
274
 
111
275
  // Add the export related options
276
+
277
+ /**
278
+ * Options for the exporting module. For an overview on the matter, see [the docs](http://www.highcharts.com/docs/export-module/export-module-overview).
279
+ * @type {Object}
280
+ * @optionparent exporting
281
+ */
112
282
  defaultOptions.exporting = {
113
283
  //enabled: true,
114
284
  //filename: 'chart',
285
+
286
+ /**
287
+ * Default MIME type for exporting if `chart.exportChart()` is called
288
+ * without specifying a `type` option. Possible values are `image/png`,
289
+ * `image/jpeg`, `application/pdf` and `image/svg+xml`.
290
+ *
291
+ * @validvalue ["image/png", "image/jpeg", "application/pdf", "image/svg+xml"]
292
+ * @type {String}
293
+ * @default image/png
294
+ * @since 2.0
295
+ * @product highcharts highstock highmaps
296
+ */
115
297
  type: 'image/png',
298
+
299
+ /**
300
+ * The URL for the server module converting the SVG string to an image
301
+ * format. By default this points to Highchart's free web service.
302
+ *
303
+ * @type {String}
304
+ * @default https://export.highcharts.com
305
+ * @since 2.0
306
+ * @product highcharts highstock highmaps
307
+ */
116
308
  url: 'https://export.highcharts.com/',
117
309
  //width: undefined,
310
+
311
+ /**
312
+ * When printing the chart from the menu item in the burger menu, if
313
+ * the on-screen chart exceeds this width, it is resized. After printing
314
+ * or cancelled, it is restored. The default width makes the chart
315
+ * fit into typical paper format. Note that this does not affect the
316
+ * chart when printing the web page as a whole.
317
+ *
318
+ * @type {Number}
319
+ * @default 780
320
+ * @since 4.2.5
321
+ * @product highcharts highstock highmaps
322
+ */
118
323
  printMaxWidth: 780,
324
+
325
+ /**
326
+ * Defines the scale or zoom factor for the exported image compared
327
+ * to the on-screen display. While for instance a 600px wide chart
328
+ * may look good on a website, it will look bad in print. The default
329
+ * scale of 2 makes this chart export to a 1200px PNG or JPG.
330
+ *
331
+ * @type {Number}
332
+ * @see [chart.width](#chart.width), [exporting.sourceWidth](#exporting.
333
+ * sourceWidth)
334
+ * @sample {highcharts} highcharts/exporting/scale/ Scale demonstrated
335
+ * @sample {highstock} highcharts/exporting/scale/ Scale demonstrated
336
+ * @sample {highmaps} maps/exporting/scale/ Scale demonstrated
337
+ * @default 2
338
+ * @since 3.0
339
+ * @product highcharts highstock highmaps
340
+ */
119
341
  scale: 2,
342
+
343
+ /**
344
+ * Options for the export related buttons, print and export. In addition
345
+ * to the default buttons listed here, custom buttons can be added.
346
+ * See [navigation.buttonOptions](#navigation.buttonOptions) for general
347
+ * options.
348
+ *
349
+ * @product highcharts highstock highmaps
350
+ */
120
351
  buttons: {
352
+
353
+ /**
354
+ * Options for the export button.
355
+ *
356
+ * In [styled mode](http://www.highcharts.com/docs/chart-design-and-
357
+ * style/style-by-css), export button styles can be applied with the
358
+ * `.highcharts-contextbutton` class.
359
+ *
360
+ * @extends navigation.buttonOptions
361
+ * @product highcharts highstock highmaps
362
+ */
121
363
  contextButton: {
364
+
365
+ /**
366
+ */
122
367
  className: 'highcharts-contextbutton',
368
+
369
+ /**
370
+ */
123
371
  menuClassName: 'highcharts-contextmenu',
124
372
  //x: -10,
373
+
374
+ /**
375
+ * The symbol for the button. Points to a definition function in
376
+ * the `Highcharts.Renderer.symbols` collection. The default `exportIcon`
377
+ * function is part of the exporting module.
378
+ *
379
+ * @validvalue ["circle", "square", "diamond", "triangle", "triangle-down", "menu"]
380
+ * @type {String}
381
+ * @sample {highcharts} highcharts/exporting/buttons-contextbutton-symbol/ Use a circle for symbol
382
+ * @sample {highstock} highcharts/exporting/buttons-contextbutton-symbol/ Use a circle for symbol
383
+ * @sample {highmaps} highcharts/exporting/buttons-contextbutton-symbol/ Use a circle for symbol
384
+ * @default menu
385
+ * @since 2.0
386
+ * @product highcharts highstock highmaps
387
+ */
125
388
  symbol: 'menu',
389
+
390
+ /**
391
+ */
126
392
  _titleKey: 'contextButtonTitle',
127
- menuItems: [{
128
- textKey: 'printChart',
129
- onclick: function() {
130
- this.print();
131
- }
132
- }, {
133
- separator: true
134
- }, {
135
- textKey: 'downloadPNG',
136
- onclick: function() {
137
- this.exportChart();
138
- }
139
- }, {
140
- textKey: 'downloadJPEG',
141
- onclick: function() {
142
- this.exportChart({
143
- type: 'image/jpeg'
144
- });
145
- }
146
- }, {
147
- textKey: 'downloadPDF',
148
- onclick: function() {
149
- this.exportChart({
150
- type: 'application/pdf'
151
- });
152
- }
153
- }, {
154
- textKey: 'downloadSVG',
155
- onclick: function() {
156
- this.exportChart({
157
- type: 'image/svg+xml'
158
- });
159
- }
160
- }]
393
+
394
+ /**
395
+ * A collection of config options for the menu items. Each options
396
+ * object consists of a `text` option which is a string to show in
397
+ * the menu item, as well as an `onclick` parameter which is a callback
398
+ * function to run on click.
399
+ *
400
+ * By default, there is the "Print" menu item plus one menu item
401
+ * for each of the available export types. Menu items can be customized
402
+ * by defining a new array of items and assigning `null` to unwanted
403
+ * positions (see override example below).
404
+ *
405
+ * @type {Array<Object>}
406
+ * @sample {highcharts} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
407
+ * @sample {highcharts} highcharts/exporting/buttons-contextbutton-menuitems/ Override the menu items
408
+ * @sample {highstock} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
409
+ * @sample {highstock} highcharts/exporting/buttons-contextbutton-menuitems/ Override the menu items
410
+ * @sample {highmaps} highcharts/exporting/buttons-contextbutton-onclick/ Skip the menu and export the chart directly
411
+ * @sample {highmaps} highcharts/exporting/buttons-contextbutton-menuitems/ Override the menu items
412
+ * @since 2.0
413
+ * @product highcharts highstock highmaps
414
+ */
415
+ menuItems: [
416
+ 'printChart',
417
+ 'separator',
418
+ 'downloadPNG',
419
+ 'downloadJPEG',
420
+ 'downloadPDF',
421
+ 'downloadSVG'
422
+ ]
423
+ }
424
+ },
425
+ // docs. Created API item with since:next. Add information and link to sample
426
+ // from menuItems too.
427
+
428
+ /**
429
+ * An object consisting of definitions for the menu items in the context
430
+ * menu. Each key value pair has a `key` that is referenced in the
431
+ * [menuItems](#exporting.buttons.contextButton.menuItems) setting,
432
+ * and a `value`, which is an object with the following properties:
433
+ *
434
+ * <dl>
435
+ *
436
+ * <dt>onclick</dt>
437
+ *
438
+ * <dd>The click handler for the menu item</dd>
439
+ *
440
+ * <dt>text</dt>
441
+ *
442
+ * <dd>The text for the menu item</dd>
443
+ *
444
+ * <dt>textKey</dt>
445
+ *
446
+ * <dd>If internationalization is required, the key to a language string</dd>
447
+ *
448
+ * </dl>
449
+ *
450
+ * @type {Object}
451
+ * @sample {highcharts} highcharts/exporting/menuitemdefinitions/ Menu item definitions
452
+ * @sample {highstock} highcharts/exporting/menuitemdefinitions/ Menu item definitions
453
+ * @sample {highmaps} highcharts/exporting/menuitemdefinitions/ Menu item definitions
454
+ * @since next
455
+ * @product highcharts highstock highmaps
456
+ */
457
+ menuItemDefinitions: {
458
+
459
+ /**
460
+ */
461
+ printChart: {
462
+
463
+ /**
464
+ */
465
+ textKey: 'printChart',
466
+
467
+ /**
468
+ */
469
+ onclick: function() {
470
+ this.print();
471
+ }
472
+ },
473
+
474
+ /**
475
+ */
476
+ separator: {
477
+
478
+ /**
479
+ */
480
+ separator: true
481
+ },
482
+
483
+ /**
484
+ */
485
+ downloadPNG: {
486
+
487
+ /**
488
+ */
489
+ textKey: 'downloadPNG',
490
+
491
+ /**
492
+ */
493
+ onclick: function() {
494
+ this.exportChart();
495
+ }
496
+ },
497
+
498
+ /**
499
+ */
500
+ downloadJPEG: {
501
+
502
+ /**
503
+ */
504
+ textKey: 'downloadJPEG',
505
+
506
+ /**
507
+ */
508
+ onclick: function() {
509
+ this.exportChart({
510
+ type: 'image/jpeg'
511
+ });
512
+ }
513
+ },
514
+
515
+ /**
516
+ */
517
+ downloadPDF: {
518
+
519
+ /**
520
+ */
521
+ textKey: 'downloadPDF',
522
+
523
+ /**
524
+ */
525
+ onclick: function() {
526
+ this.exportChart({
527
+ type: 'application/pdf'
528
+ });
529
+ }
530
+ },
531
+
532
+ /**
533
+ */
534
+ downloadSVG: {
535
+
536
+ /**
537
+ */
538
+ textKey: 'downloadSVG',
539
+
540
+ /**
541
+ */
542
+ onclick: function() {
543
+ this.exportChart({
544
+ type: 'image/svg+xml'
545
+ });
546
+ }
161
547
  }
162
548
  }
163
549
  };
164
550
 
551
+ /**
552
+ * Fires after a chart is printed through the context menu item or the
553
+ * `Chart.print` method. Requires the exporting module.
554
+ *
555
+ * @type {Function}
556
+ * @context Chart
557
+ * @sample {highcharts} highcharts/chart/events-beforeprint-afterprint/
558
+ * Rescale the chart to print
559
+ * @sample {highstock} highcharts/chart/events-beforeprint-afterprint/
560
+ * Rescale the chart to print
561
+ * @sample {highmaps} highcharts/chart/events-beforeprint-afterprint/
562
+ * Rescale the chart to print
563
+ * @since 4.1.0
564
+ * @apioption chart.events.afterPrint
565
+ */
566
+
567
+ /**
568
+ * Fires before a chart is printed through the context menu item or
569
+ * the `Chart.print` method. Requires the exporting module.
570
+ *
571
+ * @type {Function}
572
+ * @context Chart
573
+ * @sample {highcharts} highcharts/chart/events-beforeprint-afterprint/
574
+ * Rescale the chart to print
575
+ * @sample {highstock} highcharts/chart/events-beforeprint-afterprint/
576
+ * Rescale the chart to print
577
+ * @sample {highmaps} highcharts/chart/events-beforeprint-afterprint/
578
+ * Rescale the chart to print
579
+ * @since 4.1.0
580
+ * @apioption chart.events.beforePrint
581
+ */
582
+
583
+
165
584
  // Add the H.post utility
166
585
  H.post = function(url, data, formAttributes) {
167
586
  // create the form
@@ -192,8 +611,11 @@
192
611
  extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
193
612
 
194
613
  /**
195
- * A collection of fixes on the produced SVG to account for expando properties,
196
- * browser bugs, VML problems and other. Returns a cleaned SVG.
614
+ * Exporting module only. A collection of fixes on the produced SVG to
615
+ * account for expando properties, browser bugs, VML problems and other.
616
+ * Returns a cleaned SVG.
617
+ *
618
+ * @private
197
619
  */
198
620
  sanitizeSVG: function(svg, options) {
199
621
  // Move HTML into a foreignObject
@@ -255,7 +677,13 @@
255
677
  },
256
678
 
257
679
  /**
258
- * Return innerHTML of chart. Used as hook for plugins.
680
+ * Return the unfiltered innerHTML of the chart container. Used as hook for
681
+ * plugins. In styled mode, it also takes care of inlining CSS style rules.
682
+ *
683
+ * @see Chart#getSVG
684
+ *
685
+ * @returns {String}
686
+ * The unfiltered SVG of the chart.
259
687
  */
260
688
  getChartHTML: function() {
261
689
 
@@ -538,7 +966,9 @@
538
966
  },
539
967
 
540
968
  /**
541
- * Display a popup menu for choosing the export type
969
+ * Display a popup menu for choosing the export type.
970
+ *
971
+ * @private
542
972
  *
543
973
  * @param {String} className An identifier for the menu
544
974
  * @param {Array} items A collection with text and onclicks for the items
@@ -615,7 +1045,12 @@
615
1045
 
616
1046
  // create the items
617
1047
  each(items, function(item) {
618
- if (item) {
1048
+
1049
+ if (typeof item === 'string') {
1050
+ item = chart.options.exporting.menuItemDefinitions[item];
1051
+ }
1052
+
1053
+ if (H.isObject(item, true)) {
619
1054
  var element;
620
1055
 
621
1056
  if (item.separator) {
@@ -683,7 +1118,9 @@
683
1118
  },
684
1119
 
685
1120
  /**
686
- * Add the export button to the chart
1121
+ * Add the export button to the chart, with options.
1122
+ *
1123
+ * @private
687
1124
  */
688
1125
  addButton: function(options) {
689
1126
  var chart = this,
@@ -796,7 +1233,9 @@
796
1233
  },
797
1234
 
798
1235
  /**
799
- * Destroy the buttons.
1236
+ * Destroy the export buttons.
1237
+ *
1238
+ * @private
800
1239
  */
801
1240
  destroyExport: function(e) {
802
1241
  var chart = e ? e.target : this,