Adding Combo Graph to BKit
Today one of the developers wanted to add lines to the VantagePoint bar graphs that I had wrapped with nice little helper classes and applets for BKit. The problem is that a bar graph can't have lines, but a combo graph can. So I added the combo graph as a type to the BKBaseGraph and the BKBaseGraphApplet. The idea is that it's very much like the bar graph - even being subclassed off it, but the way it handles the lines versus bars is to have essentially two types of variables: regular variables that are the bars, and line variables that are the lines.
Once I figured that out, and then fixed up a few methods like getColumnHeadersOnGraph(), it wasn't that hard to get everything working. The subclassing was interesting in that I had to have tests for the combo graph before the bar graph as the instanceof would have been true for the bar graph class when I really wanted it to hold out for the combo graph. Not bad, but interesting.
The final thing was a new applet PARAM tag to indicate what lines to put on the graph. I chose asline:<col> ("as line") so if I had columns one, two, and three as bars, and four as a line, the relevant PARAM tags would be:
<PARAM NAME="visible:one" VALUE="TRUE" /> <PARAM NAME="visible:two" VALUE="TRUE" /> <PARAM NAME="visible:three" VALUE="TRUE" /> <PARAM NAME="asline:four" VALUE="TRUE" />
This tests out great and the line width, color, etc. all work on the line in the combo graph - as you'd expect. It's a nice little addition to the toolkit.