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

Offline export bug due to nested getChartHTML wrap and boost module #8273

Closed
sebastien-p opened this Issue May 3, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@sebastien-p

sebastien-p commented May 3, 2018

Hi,

We have multiple charts on a same page and we need to export them all as N PNGs concurrently.

Problem is we always get the same image representing the last chart on our page, exported N times.

So we investigated and you won't believe what happened next :D

Take a look at this particular line, now everytime getSVGForLocalExport is called getChartHTML is wrapped (even if already wrapped) resulting to multiple nested calls to the wrapper and multiple assignations of chartCopyOptions and chartCopyContainer (here).

We resolved the issue using the following patch:

  • First we store the reference to the original getChartHTML function outside of getSVGForLocalExport.
    var getChartHTML = Highcharts.Chart.prototype.getChartHTML;
  • And then inside of getSVGForLocalExport, we restore the original implementation as soon as we don't need the wrapper anymore.
    // Trigger hook to get chart copy
    chart.getSVGForExport(options, chartOptions);
    Highcharts.Chart.prototype.getChartHTML = getChartHTML;

Note that without using the boost module, we don't see any issue but the wrap part of the code should still be fixed. However the boost module is needed in our case.

Should happen on all browsers, tested on latest Chrome (Version 66.0.3359.139 (Official Build) (64-bit)) and Firefox (Version 59.0.3 (64-bit)) on Windows 10.

JSFiddle with the boost module (failing): https://jsfiddle.net/gmn0k1wt/20/
JSFIddle without the boost module (kind of working): https://jsfiddle.net/gmn0k1wt/22/

Thanks

@sebastien-p sebastien-p changed the title from Offline export bug due to nested getChartHTML wrap to Offline export bug due to nested getChartHTML wrap and boost module May 3, 2018

@oysteinmoseng oysteinmoseng self-assigned this May 4, 2018

@oysteinmoseng oysteinmoseng added the Bug label May 4, 2018

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