Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts does not work with wicked_pdf

I'm trying to generate a PDF report using the Wicked_pdf gem and Highcharts. I've already tried to set animation, enableMouseTracking and shadow false. But when wkhtmltopdf tries to generated the PDF files I got an error.

I really don't not what to do, because when I do the same procedure for an HTML, Highcharts renders perfectly.

like image 335
user2002098 Avatar asked Jan 22 '13 23:01

user2002098


2 Answers

I fixed it by setting this options:

plotOptions:
  line:
    animation: false
    enableMouseTracking: false
    shadow: false

Also, don't forget to include JQuery and inline your styles and scripts

like image 191
metakungfu Avatar answered Sep 20 '22 01:09

metakungfu


Try setting this:

series: { 'enableMouseTracking: false, shadow: false, animation: false' : nil}

This solution worked for me. I have a pdf view and a html view and implemented solution has:

<more highchart options>
...
plotOptions: {
                  line: {
                    marker: {
                      enabled: false
                    },
                    dashStyle: 'ShortDash'
                  },
                  series: { #{request.format == 'pdf' ? 'enableMouseTracking: false, shadow: false, animation: false' : nil} }
                },
...
<more highchart options>
like image 39
Chris Barretto Avatar answered Sep 22 '22 01:09

Chris Barretto