I want to implement a spider chart (High chart) in my rails application inside pdf for PDF I've used Prawn PDF gem. So anyone has any idea about implementing a spider chart in pdf. I also have a reference screenshot of the high chart spider chart the same chart I want to implement in my rails app pdf thanks in advance.

- 49
- 1
- 6
2 Answers
As you can find on the SO forum a lot of users suggest to use wkhtmltopdf to do it. Suggested solutions:
And here is an example of how to create a spider chart in the JavaScript which you should easily rebuild in your project:
Demo: https://jsfiddle.net/BlackLabel/n1e0pmtv/
Highcharts.chart('container', {
chart: {
polar: true,
type: 'line'
},
xAxis: {
categories: ['test1', 'test2', 'test3'],
tickmarkPlacement: 'on',
lineWidth: 0
},
yAxis: {
gridLineInterpolation: 'polygon',
lineWidth: 0,
min: 0
},
series: [{
name: 'test',
data: [43000, 19000, 60000],
pointPlacement: 'on'
}],
});
I am also attaching the link to the blog with instruction of implementing Highcharts with Ruby.
https://www.highcharts.com/blog/post/i-am-ruby-developer-how-can-i-use-highcharts/

- 11,417
- 1
- 6
- 16
There's prawn-svg that can render SVGs into prawn, and so you can make a svg graph and render it inside your pdf.
Highcharts can export SVGs, but to run you should have a javascript runtime, which is possible, but will take some effort to setup and run. So some ruby-level chart library may be more preferable (it you can find one, as most current charting libraries are for client side javacsript).
Easier solution is to use a html-to-pdf converter, like wkhtmltopdf
, that popupar wicked-pdf
gem is based on. It runs a headless browser, renders the page and exports to pdf. The process is much slower, because for each pdf a separate process with browser in it has to run, and resulting pdf is larger, but you can use familiar web techniques in markup and reuse html views.

- 18,013
- 10
- 47
- 53