I am trying to render some charts using D3 and wicked_pdf. The charts show up fine when I enable the show_as_html flag. But when I render the PDFs itself, only the axes show up. The chart area itself is blank. I know the JavaScript executes since the axes are rendered after the chart content.
I tried converting the SVG to a canvas object using canvg.
canvg($(this).find('#canvas')[0], $('<div>').append($(picture).clone()).html(), { ignoreMouse: true, ignoreAnimation: true })
No change. Then, I converted the SVG to a PNG image using:
$(this).find('#chart').append("<img id='as' src='" + $(this).find('#canvas')[0].toDataURL() + "'>").show()
Still no change. However, when I insert a similar png image into the document as a static image using wicked_pdf_image_tag
, the correct image is rendered.
How do I get wicked_pdf to render the images correctly? I don't care about the format as long as the chart is rendered properly.