The main ruby/rails graphing library that gets bandied about mostly is Gruff graphs. Admittedly once it started working, its been reasonably good (ignoring a few irritating things with bad documentation and lack of features). Its the getting it to work part that was truly horrible.
There is a LOT of stuff on the web about this, so I'll make it less painful by starting from scratch (as far as I remember anyway).
There are 3 critical ingredients to get gruff to work. These are
- ImageMagick
- RMagick
- Gruff
- uninitialized constant Gruff
- uninitialized constant Enum
- No decode delegate for image format JPEG
- Can't measure text. Are the fonts installed?
- Can't find libMagick or one of the dependent libraries.
- Unknown format: PNG
ImageMagick's main saving grace is ./configure gives a nice summary of what it thinks it has and doesn't have. In my case, it picked up bad paths for the fonts, and the debian install didn't have libjpeg or libpng installed, both of which caused issues with installing. So I installed libpng (apt-get install libpng12-dev), and it got picked up no sweat. libjpeg was a little more annoying however. I had to download libjpeg from the website, untar, make, make install and of all things, copy into /usr/local/jpeg-6b.
After that I had to run configure in a bizarre manner
CPPFLAGS=-I/usr/local/jpeg-6b LDFLAGS='-L/usr/local/jpeg-6b' ./configure --with-gs-font-dir=/usr/share/fonts/type1/gsfonts/
The gs-font-dir is to kill my 'can't measure text' problem by making sure it used the correct fonts path for the machine, rather than the default. A make;make install later, I had a installed ImageMagick with correct support for fonts/png/jpeg.
The next thing I did was to install Rmagick (again from source).
Previously when I tried to install RMagick from the gem, it installed successfully (until you tried to use it, at which point it went poof), so source I go...
Once the RMagick installed (with no errors from the make), I installed gruff from the gem, which went smoothly. And voila, everything worked! Thank goodness. Undoubtably the most unnecessarily painful thing. That said, its not that bad once you know what you're doing.
No comments:
Post a Comment