Graphing in Prawn, with Prawn::Graph

635 views
Skip to first unread message

HHRy

unread,
Feb 18, 2010, 12:01:37 PM2/18/10
to Prawn
Hi all,

I see from a while ago there have been some posts about including
graphs and charts within PDF files generated by Prawn.

I didn't like the idea of relying on Gruff / Scruffy to generate the
graphs for me and do the drawing work and then include these huge
assets within my documents when PDF already has a wealth of drawing
tools available to it.

So I created Prawn::Graph, it's fairly basic just now, you can get at
it on GitHub at http://github.com/HHRy/prawn-graph/. The library only
uses the built in vector drawing methods of Prawn and because of this
can display your charts / graphs natively without needing to add huge
blobs to your documents.

I'd be grateful if people would check it out and have a go, kick the
tires so to speak and report any issues you have or make any
suggestions for improvement.

A brief roadmap of where I plan to take the development is up on the
Wiki: http://wiki.github.com/HHRy/prawn-graph/ .

If you'd like to get involved, feel free to jump straight in. I think
that graphing in PDFs in a problem we've all had to solve at some
point or will have to solve in the future; being able to do it without
needing anything other than Prawn just seems neat!

If you want to just take it for a spin, gem install prawn prawn-graph
and have a poke, while development is in its very early stages just
now; line and bar charts are implemented and function fairly well.

Thanks for you time guys,

Ryan Stenhouse
http://ryanstenhouse.eu

Gregory Brown

unread,
Feb 18, 2010, 12:59:52 PM2/18/10
to Prawn

On Feb 18, 12:01 pm, HHRy <haggishun...@gmail.com> wrote:
> Hi all,
>
> I see from a while ago there have been some posts about including
> graphs and charts within PDF files generated by Prawn.
>
> I didn't like the idea of relying on Gruff / Scruffy to generate the
> graphs for me and do the drawing work and then include these huge
> assets within my documents when PDF already has a wealth of drawing
> tools available to it.

Agreed.

> So I created Prawn::Graph, it's fairly basic just now, you can get at

> it on GitHub athttp://github.com/HHRy/prawn-graph/. The library only


> uses the built in vector drawing methods of Prawn and because of this
> can display your charts / graphs natively without needing to add huge
> blobs to your documents.

Awesome!

> I'd be grateful if people would check it out and have a go, kick the
> tires so to speak and report any issues you have or make any
> suggestions for improvement.

I will check this out soon, but you should also add a link here:
http://wiki.github.com/sandal/prawn/prawn-extensions-and-tools

I'm also very interested in what other users have to say about this.
It's definitely something people have been wanting.

-greg

Daniel Nelson

unread,
Feb 18, 2010, 2:16:30 PM2/18/10
to prawn...@googlegroups.com
> A brief roadmap of where I plan to take the development is up on the
> Wiki: http://wiki.github.com/HHRy/prawn-graph/ .

I built some simple shape modules that include the ability to draw
arbitrary pie slices. Since it looks like you haven't finished pie
charts yet, they might be helpful.

Here you can see examples of the pie slice output:
http://mindlev.wordpress.com/files/2009/12/arc1.pdf

Here is the source:
http://github.com/Bluejade/prawn-shapes

Cheers,

Daniel

Ryan Stenhouse

unread,
Feb 19, 2010, 6:57:17 PM2/19/10
to prawn...@googlegroups.com
I built some simple shape modules that include the ability to draw
arbitrary pie slices. Since it looks like you haven't finished pie
charts yet, they might be helpful.

That's brilliant! Thank you! 

Cheers,

Ryan
Reply all
Reply to author
Forward
0 new messages