app/assets/javascripts/highcharts/modules/exporting.js in highcharts-rails-4.1.2 vs app/assets/javascripts/highcharts/modules/exporting.js in highcharts-rails-4.1.3
- old
+ new
@@ -1,7 +1,7 @@
/**
- * @license Highcharts JS v4.1.2 (2015-02-27)
+ * @license Highcharts JS v4.1.3 (2015-02-27)
* Exporting module
*
* (c) 2010-2014 Torstein Honsi
*
* License: www.highcharts.com/license
@@ -318,14 +318,14 @@
if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set
options.series.push(seriesOptions);
}
});
- // Axis options must be merged in one by one, since it may be an array or an object (#2022)
+ // Axis options must be merged in one by one, since it may be an array or an object (#2022, #3900)
if (additionalOptions) {
- each(['xAxis', 'yAxis'], function (axisType, i) {
- each(splat(additionalOptions[axisType]), function (axisOptions) {
+ each(['xAxis', 'yAxis'], function (axisType) {
+ each(splat(additionalOptions[axisType]), function (axisOptions, i) {
options[axisType][i] = merge(options[axisType][i], axisOptions);
});
});
}
@@ -362,33 +362,36 @@
.replace(/"/g, "'");
return svg;
},
+ getSVGForExport: function (options, chartOptions) {
+ var chartExportingOptions = this.options.exporting;
+
+ return this.getSVG(merge(
+ { chart: { borderRadius: 0 } },
+ chartExportingOptions.chartOptions,
+ chartOptions,
+ {
+ exporting: {
+ sourceWidth: (options && options.sourceWidth) || chartExportingOptions.sourceWidth,
+ sourceHeight: (options && options.sourceHeight) || chartExportingOptions.sourceHeight
+ }
+ }
+ ));
+ },
+
/**
* Submit the SVG representation of the chart to the server
* @param {Object} options Exporting options. Possible members are url, type, width and formAttributes.
* @param {Object} chartOptions Additional chart options for the SVG representation of the chart
*/
exportChart: function (options, chartOptions) {
- options = options || {};
+
+ var svg = this.getSVGForExport(options, chartOptions);
- var chart = this,
- chartExportingOptions = chart.options.exporting,
- svg = chart.getSVG(merge(
- { chart: { borderRadius: 0 } },
- chartExportingOptions.chartOptions,
- chartOptions,
- {
- exporting: {
- sourceWidth: options.sourceWidth || chartExportingOptions.sourceWidth,
- sourceHeight: options.sourceHeight || chartExportingOptions.sourceHeight
- }
- }
- ));
-
// merge the options
- options = merge(chart.options.exporting, options);
+ options = merge(this.options.exporting, options);
// do the post
Highcharts.post(options.url, {
filename: options.filename || 'chart',
type: options.type,