
I'm developing an application using JFreeChart. So far, I've used an XYSeriesCollection which worked fine.
Now, I also have to display error bars, min/max values and a bunch of other stuff, not all of which is clear at this point, so I figured that moving to a CombinedDataset would be the best bet.
So, what I'm doing now is, I take my XYSeriesCollection and I put it inside a CombinedDataset. This, however, creates a problem. The plot is no longer automatically adjusted to display all the data. Rather, it stays with the default axis ranges (0.0-1.0 on both).
After tinkering a bit, I've found that I need to add the XYSeriesCollection to the CombinedDataset after I've added all the data points. When I used the XYSeriesCollection directly, I could add the data points last and the chart would automatically adjust.
I could redesign the code so that I add the XYSeriesCollection to the CombinedDataset only after adding the data points, but for several reasons this isn't as easy as it sounds. For example, I need to add points over time.
So: is there a way to get a CombinedDataset to automatically adjust the axis ranges when data points are added to a series of one of the datasets it contains?
Or, at least, to explicitly tell the dataset that it has to recalculate the axis ranges?
Any idea?