Sooo.. programming has been going well lately. I've solved some very.. interesting problems with some things.
I have to map points out on a graph.. At first this seemed really simple. I went out and searched for a bunch of programs and definitely found a bunch. The one basic requirement was that they had to have some way to interface with Ruby so that I could use them with Rails easily. Here are some really good ones if you want to do general graphing:
Each has a good way to interface with Ruby. The first two are really complex programs and excellent to use if that's the kind of stuff you need. Gruff Graphs is fantastic and is really awesome for colorful pretty charts. All three are pretty easy to use.. Gruff was the easiest for me. Unfortunately Gruff is currently made to just do graphs and charts and stuff and not just plot points. I'm sure it could do it if I worked with it a little, but I didn't.
I also tried mrplot, but I couldn't get it to work and it kept fucking up my gems library I think.. whatever the case, Gruff and RMagick didn't want to run. Looks like what I really wanted at the time.. too bad I couldn't get it to work.
In the process of all of this I learned quite a bit more and I got RMagick installed.
RMagick is simple as hell to install on Windows. I'll definitely use it again so it's a good thing I got it working.
Anyway - down the road I realized that I would probably be generating a lot of these plotted point charts and that it would probably cause some significant server load if I did.. so the only solution was to come up with some really clever caching scheme OR do all the processing clientside. I decided that I wasn't a clever enough programmer to come up with a caching scheme of any kind and that clientside processing would be better and easier in the long run anyway. Now how would I do that?
There aren't many choices. Java, Flash, JavaScript, SVG or some other VML variant, some clever CSS thing I hadn't heard of yet. Java was out of the question. No way people are going to wait for ever page to load with Java shit on it. Flash was a no-go because I don't really like doing flash anymore and it just seemed like way too much work for a stupid little graph - although I might come back to this idea later since I could do some pretty cool effects with them if they were in Flash. Also Flash requires a plugin and while almost everyone in the world has it I don't care.. Generally I hate flash in pages. SVG/VML was no good because it also required a plugin.. not many people have the SVG plugin and even if they do it's slow to load. I couldn't really find anything clever to do with CSS that wasn't a complete bitch to deal with; none of the ideas were good for clientside rendering either because of load times. I did find something kinda cool though: CanvasGraph. But, again.. not what I wanted.. and definitely not compatible.
SO! Good ol' JS. Man I haven't played with this stuff for awhile. Well anyway. Definitely the choice I made. I just didn't really know how to do it. I looked for premade stuff, but could find very little of anything useful. Plenty of graphing stuff for bar graphs and pie graphs just like I found with everything else, but nobody had a simple interface for just plotting some points. I ended up using a JS drawing library. It's licensed under the LGPL so I feel safe using it too. Documentation on that page is ok, but the main examples didn't work for me the way I wanted.. particularly with the DIV stuff, so I just did it a different way.
What a runaround for some stupid little dots.




February 1st, 2006 at 16:41
Just an FYI: Firefox 1.5 and Opera 8.5+ have the ability to display SVG natively (no plug-in required) and the next major version of Safari will also have this ability. You can see some of my experiments with SVG on my blog.
Thanks,
Jeff
February 1st, 2006 at 16:45
Ah that's cool.. I didn't know FF had that ability yet. I definitely knew Opera had it for quite some time though =) I just left it out of the picture though because there aren't that many that use Opera.
Thanks for the info.
May 21st, 2007 at 09:42
A flash based chart: http://teethgrinder.co.uk/open-flash-chart/ and is GPL, so no worries about the license.
monk.e.boy