highcharts / highcharts

Highcharts JS, the JavaScript charting framework
https://www.highcharts.com
Other
11.87k stars 3.54k forks source link

Export is not respecting requested chart size #21187

Closed tseever closed 3 weeks ago

tseever commented 1 month ago

Expected behaviour

Export size should change according to width and height in exporting options. Currently it is not working correctly.

Actual behaviour

Chart exports with a default size and ignores the width override.

Live demo with steps to reproduce

The jsfiddle example for setting the width as linked in the API is exhibiting the problem. The exported chart is 1200x800, while it is supposed to be sized to 200px wide. For my own maps example it is similarly 1200px wide and appears to be portrait instead of my landscape map.

https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/exporting/width/

Product version

Highcharts/maps v11.4.1

Affected browser(s)

Chrome v124

karolkolodziej commented 4 weeks ago

Hi @tseever!

As a workaround you can set the sourceWidth and scale to get a similar result to what the width does- demo.

tseever commented 3 weeks ago

Thanks! I had also tried that initially without success, but at your suggestion I tried again and realized my calculated sourceWidth was being set to NaN due to a timing issue.

karolkolodziej commented 3 weeks ago

@tseever Please look at the issue linked by @jszuminski. I'm going to close this one here as it is going to be resolved in the export server repository.