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

Exported image with multiple chart is trimmed #6045

morganfree opened this issue Nov 28, 2016 · 2 comments

Exported image with multiple chart is trimmed #6045

morganfree opened this issue Nov 28, 2016 · 2 comments


Copy link

@morganfree morganfree commented Nov 28, 2016

Actual behaviour

When exporting multiple charts and on the container div is set width < 600, the charts on the image get trimmed.

Live demo with steps to reproduce

  1. Enter
  2. Click 'export to PNG'

The problem is with the getSVG() method. E.g. for the container with 400px width, getSVG() returns

<svg height="400" width="400" version="1.1" xmlns=""><g transform="translate(0,0)" xmlns:xlink="" version="1.1" class="highcharts-root" style="font-family:&quot;lucida grande&quot;, &quot;lucida sans unicode&quot;, arial, helvetica, sans-serif;font-size:12px;" xmlns="" width="600" viewBox="0 0 600 200" height="200">

<svg> inherits width 400, but the following <g> gets width 600

The problem appears in the demo from the official website

@oysteinmoseng oysteinmoseng self-assigned this Nov 29, 2016
@oysteinmoseng oysteinmoseng added this to the 5.0.6 milestone Dec 3, 2016
Copy link

@oysteinmoseng oysteinmoseng commented Dec 3, 2016

The issue was with computing the width/height of the compiled SVG. It was using the width/height of the charts rather than the exported SVG of the charts. Chose to fix with a regex to make it independent of future coding changes, but it would also be possible to e.g. hook Chart.getChartHTML and read the dimensions of the exported chart from there.

@morganfree Working example in jsFiddle: All changes are in Highcharts.getSVG only.

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

Successfully merging a pull request may close this issue.

None yet
3 participants