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

chart.exportChart() leaves undefined item in Highcharts.charts array #6569

Closed
dankoliver opened this Issue Apr 5, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@dankoliver

dankoliver commented Apr 5, 2017

Expected behaviour

Highcharts.charts array contains same items as before the image export

Actual behaviour

After each image export there is one undefined item appended to Highcharts.charts

Live demo with steps to reproduce

http://jsfiddle.net/p6j9hxLy/
Check the messages in the debug console

@dankoliver

This comment has been minimized.

Show comment
Hide comment
@dankoliver

dankoliver Apr 7, 2017

Thanks for the quick fix!
However, I've found it necessary to also modify the reflow() function - for some reason it's still being called with this being undefined after a chart has been exported.
I haven't traced down the root cause, might well be that it's in my implementation, but I've fixed it like so:

        initReflow: function () {
            var chart = this,
                reflow = function (e) {
                    if(chart.options) {
                        chart.reflow(e);
                    }
                };
            addEvent(win, 'resize', reflow);
            addEvent(chart, 'destroy', function () {
                removeEvent(win, 'resize', reflow);
            });
        },

dankoliver commented Apr 7, 2017

Thanks for the quick fix!
However, I've found it necessary to also modify the reflow() function - for some reason it's still being called with this being undefined after a chart has been exported.
I haven't traced down the root cause, might well be that it's in my implementation, but I've fixed it like so:

        initReflow: function () {
            var chart = this,
                reflow = function (e) {
                    if(chart.options) {
                        chart.reflow(e);
                    }
                };
            addEvent(win, 'resize', reflow);
            addEvent(chart, 'destroy', function () {
                removeEvent(win, 'resize', reflow);
            });
        },
@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Apr 11, 2017

Contributor

@TorsteinHonsi - this commit breaks exporting 3D charts. In 3D, there is a reference to a chart by renderer.chartIndex, now an exported chart doesn't define this. It's an issue here and later an error here.

Contributor

pawelfus commented Apr 11, 2017

@TorsteinHonsi - this commit breaks exporting 3D charts. In 3D, there is a reference to a chart by renderer.chartIndex, now an exported chart doesn't define this. It's an issue here and later an error here.

@pawelfus pawelfus reopened this Apr 11, 2017

TorsteinHonsi added a commit that referenced this issue Apr 20, 2017

@pawelfus pawelfus closed this Apr 25, 2017

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