highcharts-rails 5.0.14 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +60 -0
  3. data/Rakefile +54 -5
  4. data/app/assets/images/highcharts/earth.svg +432 -0
  5. data/app/assets/javascripts/highcharts.js +5103 -3147
  6. data/app/assets/javascripts/highcharts/highcharts-3d.js +930 -277
  7. data/app/assets/javascripts/highcharts/highcharts-more.js +1374 -249
  8. data/app/assets/javascripts/highcharts/lib/canvg.js +3073 -0
  9. data/app/assets/javascripts/highcharts/lib/jspdf.js +16624 -0
  10. data/app/assets/javascripts/highcharts/lib/rgbcolor.js +299 -0
  11. data/app/assets/javascripts/highcharts/lib/svg2pdf.js +3488 -0
  12. data/app/assets/javascripts/highcharts/modules/accessibility.js +654 -212
  13. data/app/assets/javascripts/highcharts/modules/annotations.js +1552 -274
  14. data/app/assets/javascripts/highcharts/modules/boost-canvas.js +773 -0
  15. data/app/assets/javascripts/highcharts/modules/boost.js +636 -210
  16. data/app/assets/javascripts/highcharts/modules/broken-axis.js +2 -2
  17. data/app/assets/javascripts/highcharts/modules/bullet.js +364 -0
  18. data/app/assets/javascripts/highcharts/modules/data.js +766 -38
  19. data/app/assets/javascripts/highcharts/modules/drag-panes.js +588 -0
  20. data/app/assets/javascripts/highcharts/modules/drilldown.js +106 -36
  21. data/app/assets/javascripts/highcharts/modules/export-data.js +597 -0
  22. data/app/assets/javascripts/highcharts/modules/exporting.js +424 -162
  23. data/app/assets/javascripts/highcharts/modules/funnel.js +144 -22
  24. data/app/assets/javascripts/highcharts/modules/gantt.js +1154 -0
  25. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  26. data/app/assets/javascripts/highcharts/modules/heatmap.js +406 -80
  27. data/app/assets/javascripts/highcharts/modules/histogram-bellcurve.js +513 -0
  28. data/app/assets/javascripts/highcharts/modules/item-series.js +126 -0
  29. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +31 -13
  30. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +179 -57
  31. data/app/assets/javascripts/highcharts/modules/oldie.js +1378 -0
  32. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +8 -6
  33. data/app/assets/javascripts/highcharts/modules/parallel-coordinates.js +494 -0
  34. data/app/assets/javascripts/highcharts/modules/pareto.js +275 -0
  35. data/app/assets/javascripts/highcharts/modules/sankey.js +641 -0
  36. data/app/assets/javascripts/highcharts/modules/series-label.js +355 -145
  37. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +122 -1
  38. data/app/assets/javascripts/highcharts/modules/static-scale.js +64 -0
  39. data/app/assets/javascripts/highcharts/modules/stock.js +1944 -676
  40. data/app/assets/javascripts/highcharts/modules/streamgraph.js +139 -0
  41. data/app/assets/javascripts/highcharts/modules/sunburst.js +2403 -0
  42. data/app/assets/javascripts/highcharts/modules/tilemap.js +1199 -0
  43. data/app/assets/javascripts/highcharts/modules/treemap.js +538 -134
  44. data/app/assets/javascripts/highcharts/modules/variable-pie.js +490 -0
  45. data/app/assets/javascripts/highcharts/modules/variwide.js +283 -0
  46. data/app/assets/javascripts/highcharts/modules/vector.js +294 -0
  47. data/app/assets/javascripts/highcharts/modules/windbarb.js +490 -0
  48. data/app/assets/javascripts/highcharts/modules/wordcloud.js +681 -0
  49. data/app/assets/javascripts/highcharts/modules/xrange.js +615 -0
  50. data/app/assets/javascripts/highcharts/themes/avocado.js +54 -0
  51. data/app/assets/javascripts/highcharts/themes/dark-blue.js +6 -6
  52. data/app/assets/javascripts/highcharts/themes/dark-green.js +6 -6
  53. data/app/assets/javascripts/highcharts/themes/dark-unica.js +6 -6
  54. data/app/assets/javascripts/highcharts/themes/gray.js +14 -10
  55. data/app/assets/javascripts/highcharts/themes/grid-light.js +6 -6
  56. data/app/assets/javascripts/highcharts/themes/grid.js +7 -5
  57. data/app/assets/javascripts/highcharts/themes/sand-signika.js +8 -7
  58. data/app/assets/javascripts/highcharts/themes/skies.js +15 -9
  59. data/app/assets/javascripts/highcharts/themes/sunset.js +53 -0
  60. data/app/assets/stylesheets/highcharts/highcharts.css +802 -0
  61. data/app/assets/stylesheets/highcharts/highcharts.scss +665 -0
  62. data/lib/highcharts/version.rb +1 -1
  63. metadata +31 -1
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @license Highcharts JS v6.0.0 (2017-10-04)
3
+ *
4
+ * Item series type for Highcharts
5
+ *
6
+ * (c) 2010-2017 Torstein Honsi
7
+ *
8
+ * License: www.highcharts.com/license
9
+ */
10
+ 'use strict';
11
+ (function(factory) {
12
+ if (typeof module === 'object' && module.exports) {
13
+ module.exports = factory;
14
+ } else {
15
+ factory(Highcharts);
16
+ }
17
+ }(function(Highcharts) {
18
+ (function(H) {
19
+ /**
20
+ * (c) 2009-2017 Torstein Honsi
21
+ *
22
+ * Item series type for Highcharts
23
+ *
24
+ * License: www.highcharts.com/license
25
+ */
26
+
27
+ /**
28
+ * @todo
29
+ * - Check update, remove etc.
30
+ * - Custom icons like persons, carts etc. Either as images, font icons or
31
+ * Highcharts symbols.
32
+ */
33
+ var each = H.each,
34
+ extend = H.extend,
35
+ pick = H.pick,
36
+ seriesType = H.seriesType;
37
+
38
+ seriesType('item', 'column', {
39
+ itemPadding: 0.2,
40
+ marker: {
41
+ symbol: 'circle',
42
+ states: {
43
+ hover: {},
44
+ select: {}
45
+ }
46
+ }
47
+ }, {
48
+ drawPoints: function() {
49
+ var series = this,
50
+ renderer = series.chart.renderer,
51
+ seriesMarkerOptions = this.options.marker;
52
+
53
+ each(this.points, function(point) {
54
+ var yPos,
55
+ attr,
56
+ graphics,
57
+ itemY,
58
+ pointAttr,
59
+ pointMarkerOptions = point.marker || {},
60
+ symbol = (
61
+ pointMarkerOptions.symbol ||
62
+ seriesMarkerOptions.symbol
63
+ ),
64
+ size,
65
+ yTop;
66
+
67
+ point.graphics = graphics = point.graphics || {};
68
+ pointAttr = point.pointAttr ?
69
+ (
70
+ point.pointAttr[point.selected ? 'selected' : ''] ||
71
+ series.pointAttr['']
72
+ ) :
73
+ series.pointAttribs(point, point.selected && 'select');
74
+ delete pointAttr.r;
75
+
76
+ if (point.y !== null) {
77
+
78
+ if (!point.graphic) {
79
+ point.graphic = renderer.g('point').add(series.group);
80
+ }
81
+
82
+ itemY = point.y;
83
+ yTop = pick(point.stackY, point.y);
84
+ size = Math.min(
85
+ point.pointWidth,
86
+ (
87
+ series.yAxis.transA *
88
+ (1 - series.options.itemPadding)
89
+ )
90
+ );
91
+ for (yPos = yTop; yPos > yTop - point.y; yPos--) {
92
+
93
+ attr = {
94
+ x: point.barX + point.pointWidth / 2 - size / 2,
95
+ y: series.yAxis.toPixels(yPos, true) - size / 2,
96
+ width: size,
97
+ height: size
98
+ };
99
+
100
+ if (graphics[itemY]) {
101
+ graphics[itemY].animate(attr);
102
+ } else {
103
+ graphics[itemY] = renderer.symbol(symbol)
104
+ .attr(extend(attr, pointAttr))
105
+ .add(point.graphic);
106
+ }
107
+ graphics[itemY].isActive = true;
108
+ itemY--;
109
+ }
110
+ }
111
+ H.objectEach(graphics, function(graphic, key) {
112
+ if (!graphic.isActive) {
113
+ graphic.destroy();
114
+ delete graphic[key];
115
+ } else {
116
+ graphic.isActive = false;
117
+ }
118
+ });
119
+ });
120
+
121
+ }
122
+ });
123
+
124
+
125
+ }(Highcharts));
126
+ }));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.14 (2017-07-28)
2
+ * @license Highcharts JS v6.0.0 (2017-10-04)
3
3
  * Plugin for displaying a message when there is no data visible in chart.
4
4
  *
5
5
  * (c) 2010-2017 Highsoft AS
@@ -33,6 +33,16 @@
33
33
 
34
34
  // Add language option
35
35
  extend(defaultOptions.lang, {
36
+ /**
37
+ * The text to display when the chart contains no data. Requires the
38
+ * no-data module, see [noData](#noData).
39
+ *
40
+ * @type {String}
41
+ * @default No data to display
42
+ * @since 3.0.8
43
+ * @product highcharts
44
+ * @apioption lang.noData
45
+ */
36
46
  noData: 'No data to display'
37
47
  });
38
48
 
@@ -46,13 +56,21 @@
46
56
  */
47
57
  defaultOptions.noData = {
48
58
 
59
+ /**
60
+ * An object of additional SVG attributes for the no-data label.
61
+ *
62
+ * @type {Object}
63
+ * @since 3.0.8
64
+ * @product highcharts highstock
65
+ * @apioption noData.attr
66
+ */
67
+
49
68
  /**
50
69
  * The position of the no-data label, relative to the plot area.
51
70
  *
52
71
  * @type {Object}
53
72
  * @default { "x": 0, "y": 0, "align": "center", "verticalAlign": "middle" }
54
73
  * @since 3.0.8
55
- * @product highcharts highstock highmaps
56
74
  */
57
75
  position: {
58
76
 
@@ -80,7 +98,6 @@
80
98
  * @validvalue ["left", "center", "right"]
81
99
  * @type {String}
82
100
  * @default center
83
- * @product highcharts highstock highmaps
84
101
  */
85
102
  align: 'center',
86
103
 
@@ -94,7 +111,17 @@
94
111
  */
95
112
  verticalAlign: 'middle'
96
113
  }
97
- // useHTML: false
114
+
115
+ /**
116
+ * Whether to insert the label as HTML, or as pseudo-HTML rendered with
117
+ * SVG.
118
+ *
119
+ * @type {Boolean}
120
+ * @default false
121
+ * @since 4.1.10
122
+ * @product highcharts highstock
123
+ * @apioption noData.useHTML
124
+ */
98
125
  };
99
126
 
100
127
 
@@ -104,17 +131,8 @@
104
131
  * @optionparent noData.style
105
132
  */
106
133
  defaultOptions.noData.style = {
107
-
108
- /**
109
- */
110
134
  fontWeight: 'bold',
111
-
112
- /**
113
- */
114
135
  fontSize: '12px',
115
-
116
- /**
117
- */
118
136
  color: '#666666'
119
137
  };
120
138
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.14 (2017-07-28)
2
+ * @license Highcharts JS v6.0.0 (2017-10-04)
3
3
  * Client side exporting module
4
4
  *
5
5
  * (c) 2015 Torstein Honsi / Oystein Moseng
@@ -23,7 +23,7 @@
23
23
  * License: www.highcharts.com/license
24
24
  */
25
25
 
26
- /*global MSBlobBuilder */
26
+ /* global MSBlobBuilder */
27
27
 
28
28
  var merge = Highcharts.merge,
29
29
  win = Highcharts.win,
@@ -33,7 +33,8 @@
33
33
  domurl = win.URL || win.webkitURL || win,
34
34
  isMSBrowser = /Edge\/|Trident\/|MSIE /.test(nav.userAgent),
35
35
  isEdgeBrowser = /Edge\/\d+/.test(nav.userAgent),
36
- loadEventDeferDelay = isMSBrowser ? 150 : 0; // Milliseconds to defer image load event handlers to offset IE bug
36
+ // Milliseconds to defer image load event handlers to offset IE bug
37
+ loadEventDeferDelay = isMSBrowser ? 150 : 0;
37
38
 
38
39
  // Dummy object so we can reuse our canvas-tools.js without errors
39
40
  Highcharts.CanVGRenderer = {};
@@ -52,7 +53,7 @@
52
53
  script.src = scriptLocation;
53
54
  script.onload = callback;
54
55
  script.onerror = function() {
55
- console.error('Error loading script', scriptLocation); // eslint-disable-line no-console
56
+ Highcharts.error('Error loading script ' + scriptLocation);
56
57
  };
57
58
 
58
59
  head.appendChild(script);
@@ -133,10 +134,15 @@
133
134
 
134
135
  // Get blob URL from SVG code. Falls back to normal data URI.
135
136
  Highcharts.svgToDataUrl = function(svg) {
136
- var webKit = nav.userAgent.indexOf('WebKit') > -1 && nav.userAgent.indexOf('Chrome') < 0; // Webkit and not chrome
137
+ // Webkit and not chrome
138
+ var webKit = (
139
+ nav.userAgent.indexOf('WebKit') > -1 &&
140
+ nav.userAgent.indexOf('Chrome') < 0
141
+ );
137
142
  try {
138
- // Safari requires data URI since it doesn't allow navigation to blob URLs
139
- // Firefox has an issue with Blobs and internal references, leading to gradients not working using Blobs (#4550)
143
+ // Safari requires data URI since it doesn't allow navigation to blob
144
+ // URLs. Firefox has an issue with Blobs and internal references,
145
+ // leading to gradients not working using Blobs (#4550)
140
146
  if (!webKit && nav.userAgent.toLowerCase().indexOf('firefox') < 0) {
141
147
  return domurl.createObjectURL(new win.Blob([svg], {
142
148
  type: 'image/svg+xml;charset-utf-16'
@@ -149,9 +155,21 @@
149
155
  };
150
156
 
151
157
  // Get data:URL from image URL
152
- // Pass in callbacks to handle results. finallyCallback is always called at the end of the process. Supplying this callback is optional.
153
- // All callbacks receive four arguments: imageURL, imageType, callbackArgs and scale. callbackArgs is used only by callbacks and can contain whatever.
154
- Highcharts.imageToDataUrl = function(imageURL, imageType, callbackArgs, scale, successCallback, taintedCallback, noCanvasSupportCallback, failedLoadCallback, finallyCallback) {
158
+ // Pass in callbacks to handle results. finallyCallback is always called at the
159
+ // end of the process. Supplying this callback is optional. All callbacks
160
+ // receive four arguments: imageURL, imageType, callbackArgs and scale.
161
+ // callbackArgs is used only by callbacks and can contain whatever.
162
+ Highcharts.imageToDataUrl = function(
163
+ imageURL,
164
+ imageType,
165
+ callbackArgs,
166
+ scale,
167
+ successCallback,
168
+ taintedCallback,
169
+ noCanvasSupportCallback,
170
+ failedLoadCallback,
171
+ finallyCallback
172
+ ) {
155
173
  var img = new win.Image(),
156
174
  taintedHandler,
157
175
  loadHandler = function() {
@@ -161,7 +179,12 @@
161
179
  dataURL;
162
180
  try {
163
181
  if (!ctx) {
164
- noCanvasSupportCallback(imageURL, imageType, callbackArgs, scale);
182
+ noCanvasSupportCallback(
183
+ imageURL,
184
+ imageType,
185
+ callbackArgs,
186
+ scale
187
+ );
165
188
  } else {
166
189
  canvas.height = img.height * scale;
167
190
  canvas.width = img.width * scale;
@@ -170,17 +193,34 @@
170
193
  // Now we try to get the contents of the canvas.
171
194
  try {
172
195
  dataURL = canvas.toDataURL(imageType);
173
- successCallback(dataURL, imageType, callbackArgs, scale);
196
+ successCallback(
197
+ dataURL,
198
+ imageType,
199
+ callbackArgs,
200
+ scale
201
+ );
174
202
  } catch (e) {
175
- taintedHandler(imageURL, imageType, callbackArgs, scale);
203
+ taintedHandler(
204
+ imageURL,
205
+ imageType,
206
+ callbackArgs,
207
+ scale
208
+ );
176
209
  }
177
210
  }
178
211
  } finally {
179
212
  if (finallyCallback) {
180
- finallyCallback(imageURL, imageType, callbackArgs, scale);
213
+ finallyCallback(
214
+ imageURL,
215
+ imageType,
216
+ callbackArgs,
217
+ scale
218
+ );
181
219
  }
182
220
  }
183
- }, loadEventDeferDelay); // IE bug where image is not always ready despite calling load event.
221
+ // IE bug where image is not always ready despite calling load
222
+ // event.
223
+ }, loadEventDeferDelay);
184
224
  },
185
225
  // Image load failed (e.g. invalid URL)
186
226
  errorHandler = function() {
@@ -190,12 +230,13 @@
190
230
  }
191
231
  };
192
232
 
193
- // This is called on load if the image drawing to canvas failed with a security error.
194
- // We retry the drawing with crossOrigin set to Anonymous.
233
+ // This is called on load if the image drawing to canvas failed with a
234
+ // security error. We retry the drawing with crossOrigin set to Anonymous.
195
235
  taintedHandler = function() {
196
236
  img = new win.Image();
197
237
  taintedHandler = taintedCallback;
198
- img.crossOrigin = 'Anonymous'; // Must be set prior to loading image source
238
+ // Must be set prior to loading image source
239
+ img.crossOrigin = 'Anonymous';
199
240
  img.onload = loadHandler;
200
241
  img.onerror = errorHandler;
201
242
  img.src = imageURL;
@@ -210,12 +251,18 @@
210
251
  * Get data URL to an image of an SVG and call download on it
211
252
  *
212
253
  * options object:
213
- * filename: Name of resulting downloaded file without extension
214
- * type: File type of resulting download
215
- * scale: Scaling factor of downloaded image compared to source
216
- * libURL: URL pointing to location of dependency scripts to download on demand
254
+ * - filename: Name of resulting downloaded file without extension
255
+ * - type: File type of resulting download
256
+ * - scale: Scaling factor of downloaded image compared to source
257
+ * - libURL: URL pointing to location of dependency scripts to download on
258
+ * demand
217
259
  */
218
- Highcharts.downloadSVGLocal = function(svg, options, failCallback, successCallback) {
260
+ Highcharts.downloadSVGLocal = function(
261
+ svg,
262
+ options,
263
+ failCallback,
264
+ successCallback
265
+ ) {
219
266
  var svgurl,
220
267
  blob,
221
268
  objectURLRevoke = true,
@@ -223,15 +270,33 @@
223
270
  libURL = options.libURL || Highcharts.getOptions().exporting.libURL,
224
271
  dummySVGContainer = doc.createElement('div'),
225
272
  imageType = options.type || 'image/png',
226
- filename = (options.filename || 'chart') + '.' + (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1]),
273
+ filename = (
274
+ (options.filename || 'chart') +
275
+ '.' +
276
+ (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1])
277
+ ),
227
278
  scale = options.scale || 1;
228
279
 
229
- libURL = libURL.slice(-1) !== '/' ? libURL + '/' : libURL; // Allow libURL to end with or without fordward slash
280
+ // Allow libURL to end with or without fordward slash
281
+ libURL = libURL.slice(-1) !== '/' ? libURL + '/' : libURL;
230
282
 
231
283
  function svgToPdf(svgElement, margin) {
232
284
  var width = svgElement.width.baseVal.value + 2 * margin,
233
285
  height = svgElement.height.baseVal.value + 2 * margin,
234
- pdf = new win.jsPDF('l', 'pt', [width, height]); // eslint-disable-line new-cap
286
+ pdf = new win.jsPDF( // eslint-disable-line new-cap
287
+ 'l',
288
+ 'pt', [width, height]
289
+ );
290
+
291
+ // Workaround for #7090, hidden elements were drawn anyway. It comes
292
+ // down to https://github.com/yWorks/svg2pdf.js/issues/28. Check this
293
+ // later.
294
+ each(
295
+ svgElement.querySelectorAll('*[visibility="hidden"]'),
296
+ function(node) {
297
+ node.parentNode.removeChild(node);
298
+ }
299
+ );
235
300
 
236
301
  win.svg2pdf(svgElement, pdf, {
237
302
  removeInvalid: true
@@ -244,17 +309,26 @@
244
309
  var textElements = dummySVGContainer.getElementsByTagName('text'),
245
310
  titleElements,
246
311
  svgData,
247
- svgElementStyle = dummySVGContainer.getElementsByTagName('svg')[0].style;
248
- // Workaround for the text styling. Making sure it does pick up the root element
312
+ svgElementStyle = dummySVGContainer
313
+ .getElementsByTagName('svg')[0].style;
314
+
315
+ // Workaround for the text styling. Making sure it does pick up the root
316
+ // element
249
317
  each(textElements, function(el) {
250
- // Workaround for the text styling. making sure it does pick up the root element
318
+ // Workaround for the text styling. making sure it does pick up the
319
+ // root element
251
320
  each(['font-family', 'font-size'], function(property) {
252
321
  if (!el.style[property] && svgElementStyle[property]) {
253
322
  el.style[property] = svgElementStyle[property];
254
323
  }
255
324
  });
256
- el.style['font-family'] = el.style['font-family'] && el.style['font-family'].split(' ').splice(-1);
257
- // Workaround for plotband with width, removing title from text nodes
325
+ el.style['font-family'] = (
326
+ el.style['font-family'] &&
327
+ el.style['font-family'].split(' ').splice(-1)
328
+ );
329
+
330
+ // Workaround for plotband with width, removing title from text
331
+ // nodes
258
332
  titleElements = el.getElementsByTagName('title');
259
333
  each(titleElements, function(titleElement) {
260
334
  el.removeChild(titleElement);
@@ -273,7 +347,8 @@
273
347
 
274
348
  // Initiate download depending on file type
275
349
  if (imageType === 'image/svg+xml') {
276
- // SVG download. In this case, we want to use Microsoft specific Blob if available
350
+ // SVG download. In this case, we want to use Microsoft specific Blob if
351
+ // available
277
352
  try {
278
353
  if (nav.msSaveOrOpenBlob) {
279
354
  blob = new MSBlobBuilder();
@@ -293,8 +368,10 @@
293
368
  if (win.jsPDF && win.svg2pdf) {
294
369
  downloadPDF();
295
370
  } else {
296
- // Must load pdf libraries first
297
- objectURLRevoke = true; // Don't destroy the object URL yet since we are doing things asynchronously. A cleaner solution would be nice, but this will do for now.
371
+ // Must load pdf libraries first. // Don't destroy the object URL
372
+ // yet since we are doing things asynchronously. A cleaner solution
373
+ // would be nice, but this will do for now.
374
+ objectURLRevoke = true;
298
375
  getScript(libURL + 'jspdf.js', function() {
299
376
  getScript(libURL + 'svg2pdf.js', function() {
300
377
  downloadPDF();
@@ -313,7 +390,11 @@
313
390
  }
314
391
  };
315
392
  // First, try to get PNG by rendering on canvas
316
- Highcharts.imageToDataUrl(svgurl, imageType, { /* args */ }, scale, function(imageURL) {
393
+ Highcharts.imageToDataUrl(
394
+ svgurl,
395
+ imageType, { /* args */ },
396
+ scale,
397
+ function(imageURL) {
317
398
  // Success
318
399
  try {
319
400
  Highcharts.downloadURL(imageURL, filename);
@@ -323,17 +404,27 @@
323
404
  } catch (e) {
324
405
  failCallback();
325
406
  }
326
- }, function() {
407
+ },
408
+ function() {
327
409
  // Failed due to tainted canvas
328
410
  // Create new and untainted canvas
329
411
  var canvas = doc.createElement('canvas'),
330
412
  ctx = canvas.getContext('2d'),
331
- imageWidth = svg.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
332
- imageHeight = svg.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
413
+ imageWidth = svg.match(
414
+ /^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/
415
+ )[1] * scale,
416
+ imageHeight = svg.match(
417
+ /^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/
418
+ )[1] * scale,
333
419
  downloadWithCanVG = function() {
334
420
  ctx.drawSvg(svg, 0, 0, imageWidth, imageHeight);
335
421
  try {
336
- Highcharts.downloadURL(nav.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL(imageType), filename);
422
+ Highcharts.downloadURL(
423
+ nav.msSaveOrOpenBlob ?
424
+ canvas.msToBlob() :
425
+ canvas.toDataURL(imageType),
426
+ filename
427
+ );
337
428
  if (successCallback) {
338
429
  successCallback();
339
430
  }
@@ -350,9 +441,12 @@
350
441
  // Use preloaded canvg
351
442
  downloadWithCanVG();
352
443
  } else {
353
- // Must load canVG first
354
- objectURLRevoke = true; // Don't destroy the object URL yet since we are doing things asynchronously. A cleaner solution would be nice, but this will do for now.
355
- getScript(libURL + 'rgbcolor.js', function() { // Get RGBColor.js first
444
+ // Must load canVG first. // Don't destroy the object URL
445
+ // yet since we are doing things asynchronously. A cleaner
446
+ // solution would be nice, but this will do for now.
447
+ objectURLRevoke = true;
448
+ // Get RGBColor.js first, then canvg
449
+ getScript(libURL + 'rgbcolor.js', function() {
356
450
  getScript(libURL + 'canvg.js', function() {
357
451
  downloadWithCanVG();
358
452
  });
@@ -368,13 +462,20 @@
368
462
  if (objectURLRevoke) {
369
463
  finallyHandler();
370
464
  }
371
- });
465
+ }
466
+ );
372
467
  }
373
468
  };
374
469
 
375
- // Get SVG of chart prepared for client side export. This converts embedded images in the SVG to data URIs.
376
- // The options and chartOptions arguments are passed to the getSVGForExport function.
377
- Highcharts.Chart.prototype.getSVGForLocalExport = function(options, chartOptions, failCallback, successCallback) {
470
+ // Get SVG of chart prepared for client side export. This converts embedded
471
+ // images in the SVG to data URIs. The options and chartOptions arguments are
472
+ // passed to the getSVGForExport function.
473
+ Highcharts.Chart.prototype.getSVGForLocalExport = function(
474
+ options,
475
+ chartOptions,
476
+ failCallback,
477
+ successCallback
478
+ ) {
378
479
  var chart = this,
379
480
  images,
380
481
  imagesEmbedded = 0,
@@ -383,7 +484,8 @@
383
484
  el,
384
485
  i,
385
486
  l,
386
- // After grabbing the SVG of the chart's copy container we need to do sanitation on the SVG
487
+ // After grabbing the SVG of the chart's copy container we need to do
488
+ // sanitation on the SVG
387
489
  sanitize = function(svg) {
388
490
  return chart.sanitizeSVG(svg, chartCopyOptions);
389
491
  },
@@ -392,7 +494,11 @@
392
494
  ++imagesEmbedded;
393
495
 
394
496
  // Change image href in chart copy
395
- callbackArgs.imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageURL);
497
+ callbackArgs.imageElement.setAttributeNS(
498
+ 'http://www.w3.org/1999/xlink',
499
+ 'href',
500
+ imageURL
501
+ );
396
502
 
397
503
  // When done with last image we have our SVG
398
504
  if (imagesEmbedded === images.length) {
@@ -422,14 +528,18 @@
422
528
  try {
423
529
  // If there are no images to embed, the SVG is okay now.
424
530
  if (!images.length) {
425
- successCallback(sanitize(chartCopyContainer.innerHTML)); // Use SVG of chart copy
531
+ // Use SVG of chart copy
532
+ successCallback(sanitize(chartCopyContainer.innerHTML));
426
533
  return;
427
534
  }
428
535
 
429
536
  // Go through the images we want to embed
430
537
  for (i = 0, l = images.length; i < l; ++i) {
431
538
  el = images[i];
432
- Highcharts.imageToDataUrl(el.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), 'image/png', {
539
+ Highcharts.imageToDataUrl(el.getAttributeNS(
540
+ 'http://www.w3.org/1999/xlink',
541
+ 'href'
542
+ ), 'image/png', {
433
543
  imageElement: el
434
544
  }, options.scale,
435
545
  embeddedSuccess,
@@ -458,7 +568,10 @@
458
568
  * different background color can be added here, or `dataLabels`
459
569
  * for export only.
460
570
  */
461
- Highcharts.Chart.prototype.exportChartLocal = function(exportingOptions, chartOptions) {
571
+ Highcharts.Chart.prototype.exportChartLocal = function(
572
+ exportingOptions,
573
+ chartOptions
574
+ ) {
462
575
  var chart = this,
463
576
  options = Highcharts.merge(chart.options.exporting, exportingOptions),
464
577
  fallbackToExportServer = function() {
@@ -481,13 +594,17 @@
481
594
  ) {
482
595
  fallbackToExportServer();
483
596
  } else {
484
- Highcharts.downloadSVGLocal(svg, options, fallbackToExportServer);
597
+ Highcharts.downloadSVGLocal(
598
+ svg,
599
+ options,
600
+ fallbackToExportServer
601
+ );
485
602
  }
486
603
  };
487
604
 
488
- // If we are on IE and in styled mode, add a whitelist to the renderer
489
- // for inline styles that we want to pass through. There are so many
490
- // styles by default in IE that we don't want to blacklist them all.
605
+ // If we are on IE and in styled mode, add a whitelist to the renderer for
606
+ // inline styles that we want to pass through. There are so many styles by
607
+ // default in IE that we don't want to blacklist them all.
491
608
 
492
609
 
493
610
  // Always fall back on:
@@ -510,12 +627,17 @@
510
627
  return;
511
628
  }
512
629
 
513
- chart.getSVGForLocalExport(options, chartOptions, fallbackToExportServer, svgSuccess);
630
+ chart.getSVGForLocalExport(
631
+ options,
632
+ chartOptions,
633
+ fallbackToExportServer,
634
+ svgSuccess
635
+ );
514
636
  };
515
637
 
516
638
  // Extend the default options to use the local exporter logic
517
639
  merge(true, Highcharts.getOptions().exporting, {
518
- libURL: 'https://code.highcharts.com/5.0.14/lib/',
640
+ libURL: 'https://code.highcharts.com/6.0.0/lib/',
519
641
 
520
642
  // When offline-exporting is loaded, redefine the menu item definitions
521
643
  // related to download.