The libtiff
steps might not be necessary, but to get everything working, I did:
brew install libtiff
brew install ghostscript
brew install imagemagick --with-libtiff
source 'https://rubygems.org' | |
gem 'prawn' | |
gem 'gruff' |
Bundler.require(:default) | |
g = Gruff::Line.new | |
g.title = 'My Graph' | |
g.data('Apples', [1, 2, 3, 4, 4, 3]) | |
g.data('Oranges', [4, 8, 7, 9, 8, 9]) | |
g.data('Watermelon', [2, 3, 1, 5, 6, 8]) | |
g.data('Peaches', [9, 9, 10, 8, 7, 9]) | |
g.labels = {0 => '2003', 2 => '2004', 4 => '2005'} | |
Prawn::Document.generate('example.pdf') do |pdf| | |
pdf.text 'Graph Example' | |
pdf.image StringIO.new(g.to_blob), :fit => [pdf.bounds.width, pdf.bounds.height] | |
end |