Rendering charts via rails


#1

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


#2

On 12/12/05, larry 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/


#3

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.


#4

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. In the future, consider using the Rails specific
mailing list. You’ll get quicker answers about this sort of thing over
there.

–Steve


#5

Any idea if this is better?
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


#6

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

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