Initial Cut of a Multi-Scatter Graph for BKit

BKit.jpg

A few days ago (late last week) a couple of developers stopped by my cube to ask me if the BKit graphs had anything like a multi-select scatter graph where the data points were grouped into data sets and then they could be overlaid on top of one another to build up a more complex graph.

Well... the answer was clearly "No", and they didn't think so, but we got to thinking about how you could do it with the existing tools, and I got to thinking how to do it with the TwoDimCrossScatterViewer. So, I started work on the new graph as they started working on the different data structures to make it work with the existing scatter graph and the pseudo z-axis capabilities.

The first thing I knew I needed was to get the TwoDimCrossScatterViewer working without the lines. That was simple enough. But then it was on to the coloring of the data points and labels. This was a very tricky thing.

The breakthrough was finding the Status producer in the docs. The default way of associating a Status object with the data is row-dominant - meaning that a complete row has a single Status object for rendering. I needed to change that to column-based, and this little code did exactly what I needed:

    /**
     * We need to create (and use) a StatusProducer that looks at
     * the columns of the graph for a Status. If we didn't do this,
     * we'd be looking at a row at a time and that's not what
     * we're after.
     */
    AbstractStatusProducer statusProd = new DimensionalStatusProducer(DataSet.diCol);
    _graph.getData().setStatusProducer(statusProd);

with this, I could then set the Status flags for a column. Well, that's good, but all the code I have in place now assumed it's row-based. Well... time for a significant expansion of the code to allow for the testing of the kind of graph we're working with and then to switch to either "by row" or "by column" way of looking at things.

With all that, we have a pretty decent first-cut at the multi-scatter graph:

Applet Viewer: one.bkit.swing.BKMultiScatterGraphApplet.class

There are still things I need to do tomorrow - like a lot of testing to make sure that my changes haven't messed up another graph. But I think I'm pretty close to what the guys were looking for.