user3625269
user3625269

Reputation:

Highcharts - PDF export format issues. Font sizes etc

We have a selection of user charts. When we use the standard highcharts export facility we have layout and font size issues: half the labels are missing and the font sizes and layout are way out of size. I have read about altering the font sizes in the export settings but when I do this we loose our custom labels, they get replaced with numbers.

The users want a WYSIWYG export.

Here is a link to a fiddle :

`https://jsfiddle.net/spencerplanton/nd8ko93y/17/`

This has been lifted from a rather complicated dynamic chart application, so apologies for any verbose/redundant code.

In the real application we populate data from AJAX calls and allow the user to swap between data sets as well as allowing the user to see the data as either Pie, Bar or Line chart using our custom buttons. Drilldowns are used as well. I have trimmed the ajax data code and replaced it with static data but left the dynamic chart type swapping code and buttons. Without that there will be no way of testing whether any hint/solution/suggestion works with different chart types and the dynamic content/labels. Producing an over simplified test set of one particular iteration could lead to a solution that only fits that one scenario.

Any help formatting the PDF export labels would be greatly appreciated.

Upvotes: 1

Views: 934

Answers (1)

Sebastian Wędzel
Sebastian Wędzel

Reputation: 11633

It is because Highcharts does not detect the width of the container.

What I can suggest is to set sourceHeight and sourceWidth to bigger values.

  exporting: {
    enabled: true,
    sourceWidth: 1200,
    sourceHeight: 600
 },

See the demo, now chart looks much better in the PDF.

API: https://api.highcharts.com/highcharts/exporting.sourceWidth

Upvotes: 2

Related Questions