# Rendering charts via rails

**URL:** <https://www.ruby-forum.com/t/rendering-charts-via-rails/50081>\
**Category:** Ruby\
**Created:** [December 12, 2005, 9:28pm UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081 "2005-12-12T21:28:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![larry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@larry](https://www.ruby-forum.com/u/larry)\
**Post date:** [December 12, 2005, 9:28pm UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081/1 "2005-12-12T21:28:39Z")

</div>

Is there a recommended way to render charts from a ruby-based web  
application like rails? I need a solution that is thread-safe without  
serializing access to the chart generator.

thanks

---

<div class="post-metadata">

**Author:** ![larry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@larry](https://www.ruby-forum.com/u/larry)\
**Post date:** [December 13, 2005, 12:41am UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081/2 "2005-12-13T00:41:27Z")

</div>

On 12/12/05, larry [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a recommended way to render charts from a ruby-based web  
> application like rails? I need a solution that is thread-safe without  
> serializing access to the chart generator.

I haven’t yet had a need for it, but this one looks fun:  
[http://www.germane-software.com/software/SVG/SVG::Graph/](http://www.germane-software.com/software/SVG/SVG::Graph/)

---

<div class="post-metadata">

**Author:** ![larry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@larry](https://www.ruby-forum.com/u/larry)\
**Post date:** [December 13, 2005, 1:20am UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081/3 "2005-12-13T01:20:33Z")

</div>

I’m using SVG::Graph for a home project. It’s easy to get going and  
create charts. But it doesn’t have very many features, the output can  
be hard to control and I don’t think it’s been updated in awhile, so it  
might be a dead project. But if you’re looking for something simple,  
I’d say give it a shot. It shouldn’t take to long to see if it meets  
your needs.

---

<div class="post-metadata">

**Author:** ![larry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@larry](https://www.ruby-forum.com/u/larry)\
**Post date:** [December 13, 2005, 2:02am UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081/4 "2005-12-13T02:02:44Z")

</div>

larry wrote:

> Is there a recommended way to render charts from a ruby-based web  
> application like rails? I need a solution that is thread-safe without  
> serializing access to the chart generator.

Check out [Gruff](http://topfunky.com/clients/rails/gruffdoc/index.html). In the future, consider using the Rails specific  
mailing list. You’ll get quicker answers about this sort of thing over  
there.

–Steve

---

<div class="post-metadata">

**Author:** ![larry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@larry](https://www.ruby-forum.com/u/larry)\
**Post date:** [December 13, 2005, 1:35am UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081/5 "2005-12-13T01:35:38Z")

</div>

Any idea if this is better?  
[http://harderware.bleedingmind.com/index.php?l=en&p=/mrplot](http://harderware.bleedingmind.com/index.php?l=en&p=/mrplot)

In my case, the graphs I care about are those used for statistical  
interpretation of survey results. So laying a line over a scatterplot  
is the most important.

-Mike

---

<div class="post-metadata">

**Author:** ![larry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@larry](https://www.ruby-forum.com/u/larry)\
**Post date:** [December 13, 2005, 2:59am UTC](https://www.ruby-forum.com/t/rendering-charts-via-rails/50081/6 "2005-12-13T02:59:51Z")

</div>

Hey “larry”,

There’s several options, but currently many of them are very ugly in  
Rails. I’ve had mixed success with all of them, and most of them are  
fairly resource intensive (google for all of them):

- ploticus – This does an incredible number of plots, and is actually  
like it’s own little programming language than a plotting package.  
It’s graphs look like total ass though (classic GD is used I believe)  
and I wouldn’t consider any of them publication worthy.

- R – R _is_ a language in its own right, and I use it like crazy for  
my graphing. It does fantastic plots, somehow magically knows what to  
do with data you give it, and can plot publication ready plots to png,  
ps, pdf, jpg, and just about anything else you can think of for  
plotting. It can also read in CSV, Excel, SPSS, and other formats.  
It’s a little difficult to learn at first, but try “Statistics: An  
Introduction Using R” by Crawley. If you’re already statistics  
inclined (thank you!) then just go wade through the online docs and  
you’ll get it.

- statist – Just started playing with this. Uses GNU plot to do some  
very simple statistics and graphs. Quite nice actually even though  
it’s small and ANSI C. I’m kind of interested in make a Ruby binding  
to it.

- rcairo – If you need absolute control then cairo is great. The  
rcairo library is kind of lame since it’s missing a few functions last  
time I checked. But, if you need to put very nice dots and lines and  
transforms onto an image then this is the lib for you. Go this way if  
you’re looking for raw 2D primitives.

- rmagick – Similar in purpose to rcairo but with lots of other raw  
image processing capabilities. Only used it lightly but many people  
really like it.

- [http://apples-to-oranges.com/blog/article.aspx?id=55](http://apples-to-oranges.com/blog/article.aspx?id=55) – Saw this the  
other day which is pretty nice if you’re doing simple bar graphs in a  
browser. They look better than some graphics packages.

- gnuplot – Just like ploticus you could call this from the command  
line, but man the plots look like total barf.

- grace – Some people like it. Haven’t much success with getting it  
to work from the command line myself.

- gnu plotutils – This has a library for plotting stuff, but man do  
the GNU people have to use red for everything?

- RubyGSL – This is a full wrapper for the GNU Scientific Library but  
it also appears to include the plotutils as well. I’ve been meaning to  
play with this as it might just have all the stats and plotting stuff  
you need. But, as mentioned before the plots look like a dead puppy.

There’s a bunch of other ones, but if you’re looking for directly  
inside Ruby I’m not sure if you will have much success. Other people  
better in the know for Ruby science stuff might be able to help. If I  
do plotting I almost always do it with R or use ploticus and spawn it  
off (although I’m not as good at ploticus as at R).

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

On Tue, 13 Dec 2005 05:27:39 +0900
