Skip to content

Commit

Permalink
Added feature where exported image reflects updated data in the chart.
Browse files Browse the repository at this point in the history
…Closes #48.
  • Loading branch information
highslide-software committed Aug 12, 2010
1 parent 8d7c353 commit 9bd4aad
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/highcharts.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -6219,6 +6219,7 @@ Point.prototype = {
var point = this,
series = point.series;

point.options = options;

// onedimensional array input
if (typeof options == 'number' || options === null) {
Expand All @@ -6230,7 +6231,6 @@ Point.prototype = {

// copy options directly to point
extend(point, options);
point.options = options;
}

// categorized data with name in first position
Expand Down
34 changes: 27 additions & 7 deletions js/modules/exporting.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ extend (Chart.prototype, {
chartCopy,
sandbox,
svg,
seriesOptions,
pointOptions,
pointMarker,
options = merge(chart.options, additionalOptions); // copy the options and add extra options

// IE compatibility hack for generating SVG content that it doesn't really understand
Expand Down Expand Up @@ -206,16 +209,33 @@ extend (Chart.prototype, {
});
options.exporting.enabled = false; // hide buttons in print
options.chart.plotBackgroundImage = null; // the converter doesn't handle images
each (options.series, function(serie) {
serie.animation = false;// turn off animation

// prepare for replicating the chart
options.series = [];
each (chart.series, function(serie) {
seriesOptions = serie.options;

seriesOptions.animation = false; // turn off animation
seriesOptions.showCheckbox = false;

each (serie.data, function(point) { // turn off symbols
if (point && point.marker && /^url\(/.test(point.marker.symbol)) {
delete point.marker.symbol;
seriesOptions.data = [];
each(serie.data, function(point) {
pointOptions = typeof point.options == 'number' ?
{ y: point.y } :
point.options;
pointOptions.x = point.x;
seriesOptions.data.push(pointOptions); // copy fresh updated data

// remove image markers
pointMarker = point.options.marker;
if (pointMarker && /^url\(/.test(pointMarker.symbol)) {
delete pointMarker.symbol;
}
});
});

options.series.push(seriesOptions);
});


// generate the chart copy
chartCopy = new Highcharts.Chart(options);
Expand Down

0 comments on commit 9bd4aad

Please sign in to comment.