Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export utility not including changes made to the data after render time #48

Closed
TorsteinHonsi opened this issue Aug 4, 2010 · 12 comments

Comments

@TorsteinHonsi
Copy link
Collaborator

Demo: http://jsfiddle.net/qX6Kf/

Also test all other dynamic data operations.

@TorsteinHonsi
Copy link
Collaborator Author

For adding series, this issue can be worked around by adding the series options to the chart options object in an event handler. See http://jsfiddle.net/qX6Kf/2/

chart: {
    renderTo: 'container',

    // start workaround
    events: {
        addSeries: function(series) {
            this.options.series.push(series.options);
        }
    }
    // end workaround
},

@TorsteinHonsi
Copy link
Collaborator Author

...and with series.remove:

http://jsfiddle.net/qX6Kf/3/

@TorsteinHonsi
Copy link
Collaborator Author

Added feature where exported image reflects updated data in the chart. Closed by 9bd4aad.

@Nickesh
Copy link

Nickesh commented Aug 19, 2010

The same problem applies for setCategories() method. New categories don't appear on exported charts.

Reporter at: http://highslide.com/forum/viewtopic.php?f=9&t=7052#p34282

@chubbard
Copy link

chubbard commented Jan 9, 2011

Same problem with setTitle(). Click the Set Title link and see the title change on the chart. Then click export button and you see it renders the old title without the new title and subtitle.

http://jsfiddle.net/39C3U/

@jrlampley
Copy link

I needed the ability to export categories that were added after initial chart creation by setCategories(), so I added the some code into the loop that sets the extremes of the axis to also loop through and set the categories of the axis.

            // reflect axis extremes in the export
            each(['xAxis', 'yAxis'], function (axisType) {
                each(chart[axisType], function (axis, i) {
                    var axisCopy = chartCopy[axisType][i],
                    extremes = axis.getExtremes(),
                    userMin = extremes.userMin,
                    userMax = extremes.userMax;

                    if (userMin !== UNDEFINED || userMax !== UNDEFINED) {
                        axisCopy.setExtremes(userMin, userMax, true, false);
                    }

                    // addition to include categories that were set by setCategories
                    if (axis.categories) {
                        var categories = [];
                        each(axis.categories, function (category, i) {
                            categories.push(category);
                        });
                        axisCopy.setCategories(categories, true);
                    }
                });
            });

@TorsteinHonsi
Copy link
Collaborator Author

Demo for the setCategories case: http://jsfiddle.net/highcharts/WMtv6/

  1. Click the set categories button
  2. Click Export chart button
  3. Observe that the downloaded image doesn't reflect the changes.

@TorsteinHonsi
Copy link
Collaborator Author

Demo after fix: http://jsfiddle.net/highcharts/WMtv6/1/

@Netrumble
Copy link

Excuse me,
i have Highcharts 2.1.9 version. The problem that have posted "chubbard "

[Same problem with setTitle(). Click the Set Title link and see the title change on the chart. Then click export button and you see it renders the old title without the new title and subtitle.

http://jsfiddle.net/39C3U/]

You have not resolve this problem?

@TorsteinHonsi
Copy link
Collaborator Author

Here's a little workaround that you can use:
http://jsfiddle.net/highcharts/39C3U/22/

@meyerjj
Copy link

meyerjj commented Jan 30, 2013

I have found an issue with the workaround. If you click "Set Title" more than once, you lose the formatting on the chart title. I am also seeing this in my application when trying to use the workaround. Does anyone have any thoughts on avoiding this?

@TorsteinHonsi
Copy link
Collaborator Author

I've updated the workaround, and also fixed the issue in the core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants