rendering charts via rails

L

larry

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
 
M

Matthew Parrish

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.
 
Z

Zed A. Shaw

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 -- 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
http://www.zedshaw.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,200
Messages
2,571,046
Members
47,646
Latest member
xayaci5906

Latest Threads

Top