GWT Viz Api and Chart Tools API

So, I’ve ben working on my thesis, and I determined that using Cairo Graphics + GWT was really ineffecient, and way too much work. This is largely in part due to my discovery of the Google Chart Tools and, more specifically, the Google Visualization API. Both do pretty much the same thing, they create neat-looking graphs with very little demands on the user. The difference between the two is that Chart Tools create 2D images that you can stick on your website, rendered in less than a second. The Visualization API creates interactive graphs, which is, for me, 50 times better.

Programming-wise, getting an interactive bar chart is as easy as pie. Barring a little bit of html, all you have to do is say BarChart chart = new BarChart(,). Then you stuff it into the gwt’s root panel, or the panel for your gadget if you’re gadgetizing it, add any handlers you might need, and BAM, instant interactive bar chart with tooltips.

These are so easy to embed and gadgetize apparently, that they made a big javascript thing containing examples of EVERY current google-made chart type. Here’s a link. You select the chart type from the list and BAM (yet again), you see the chart in all its interactive glory, and the java code that makes it. The bulk of which, if you look, is concerned with making that data table and populating it with fake values. The actual chart code is something like 3 lines or less.

Here’s the link to the big javascript thing.

My only deal with it is that while it makes less demands on the user, there’s no wiggle room for the user to make demands either. If you know about my project, I’m trying to make a bar chart that is a cross between the current BLAST output graph (a piece of crap) and Artemis’s graphical display, so you can see you proteins(or whatever you BLASTed for) across the length of the gene/protein you’re BLASTing.

BarChart looked absolutely perfect for the job, you know? Have a bunch of bars hanging in space along the X axis, and the BarChart code even auto-stacks them for me. It seemed like my thesis project just got a whole lot easier. Enter disaster: The BarChart visualization’s bars MUST start at 0 and go to some place. I cannot specify a start point and and end point. The sound I made was horrific and probably was heard in your nightmares.

My only hope lies in stacking. For a data column, if you specify two values, what you will get is two bars, kinda next to each other. I don’t really know how to describe it. But instead of having them be side by side, you can tell the BarChart to stack them. Then you get two bars, stacked horizontally. So if I want a bar to appear from 20-30, I can make the first bar go from 0-20, and then stack a second bar of size 10 on top of it. If I can make the first bar transparent or colorless somehow, then I’m in business! If not I’ll have to abandon the BarChart for something else.