First, I've checked the forum as well as evaluated the VectorRenderer's methods.
Issue: Multiple datasets of the same type of VectorSeries (split by an attribute of the data) and want to display
all on the same plot (over-lay). Each dataset will have the same types of series but with varying amounts of data related
to the attribute. I would want the legend to show Dataset name(s) and color. Would build in the functionality
that a user could select a dataset to view from which the other dataset(s) would be made invisible. The related series to that
Dataset (made visible) would then show the series data along with the Legend now reflecting the series names and colors.
I have this working now but only for a single dataset. I have determined that there is no current means within the JFreeChart libraries
unless I've missed something. Sample of the code below.
Code: Select all
XYPlot plot = new XYPlot();
VectorXYDataset datasetAlpha = createDataset("Alpha");
VectorXYDataset datasetBeta = createDataset("Beta");
...
VectorRenderer vr = new VectorRenderer();
...
plot.setDataset(0, datasetAlpha);
plot.setRenderer(0,vr);
plot.setDataset(1, datasetBeta);
plot.setRenderer(1,vr);
..
But here's the challenge: I want the various datasets when initially rendered showing 1 color for each dataset with all series
of that dataset the same color. So if there were 3 datasets, each with 5 series, initially the renderer would show only 3
colors of data and the Legend to represent that. With functionality, one could then select a dataset to say make visible
from which the other 2 datasets are made invisible and the 1 dataset made visible would now show the series (by color) to
include the Legend. Hope that makes sense.
The only way I see making this work with whats presently available is to create an additional series in a single dataset where
that additional series (setVisible) defaults to being on with others off to start with. The Legend would reflect that. Functionality
could then be defined similar to what I mentioned above to turn that "dataset" series off and turn on the desired series which would
show a change to the legend and those different color/representations.
If there is a new release being planned perhaps this might have some traction in going forward.
Please advise if this is doable by other means or not based upon what I've laid out above.
Regards,
Fred