export icon indicating copy to clipboard operation
export copied to clipboard

chart export blurs on zoom

Open wildan2711 opened this issue 6 years ago • 8 comments

I'm trying to export a chart that is zoomed. This is from a screenshot:

image

When I export to PNG using this function:

this.chart.export.capture({}, function() {
    this.toPNG({
        quality: 1,
        multiplier: 2
    }, function(data) {
        this.download(data, 'image/png', 'chart.png')
    })
})

The PNG blurs like this:

chart 35

I'm using guides so I had to set the minimum and maximum of the axis explicitly.

Thank you.

wildan2711 avatar Jan 11 '19 06:01 wildan2711

That looks a little too blurry, I agree! Do you have your chart online somewhere, so we can have a closer look? Also, can you provide some details, like browser and OS where this is happening?

RobbiesCode avatar Jan 16 '19 12:01 RobbiesCode

I managed to create a codepen that reproduces the issue, here it is:

https://codepen.io/wildan2711/pen/REOOjB?editors=1111

Thanks.

wildan2711 avatar Jan 17 '19 03:01 wildan2711

We're trying to get to the bottom of it.

Meanwhile, it looks like it is caused by trend lines. If you remove that section, exports become fine.

martynasma avatar Jan 17 '19 06:01 martynasma

Yes, although some of our charts does not blur when using trend lines.

wildan2711 avatar Jan 18 '19 06:01 wildan2711

any news on this?

wildan2711 avatar Jan 25 '19 11:01 wildan2711

Sorry for the wait.

Export plugin was just updated. It should fix the issue.

martynasma avatar Mar 13 '19 08:03 martynasma

Ah sorry, the plugin was not updated. We do have a solution, though.

Please refer to this demo: https://codepen.io/anon/pen/GeOWzg?editors=0010

This section should fix the issue:

  "export": {
    "backgroundColor": "#ffffff",
    "enabled": true,
    "reviver": function(obj) {
      if ( obj.width > this.setup.chart.realWidth ) {
        obj.width = this.setup.chart.realWidth;
      }
    }
  },

martynasma avatar Mar 13 '19 08:03 martynasma

Nice, it works! Thanks for the workaround.

wildan2711 avatar Mar 13 '19 09:03 wildan2711