Bounds of subplot range axis in CombinedDomainXYPlot are invalid after dataset changes.
Step to reproduce:
1) run attached demo
-range and domain axis changes to default [0,1] range.
2)click to "add data" button
-domain axis has correct range, but range axis still has [0,1] range.
-neither "Auto range"->"Both axis" nor "Auto range"->"Range axis" context menu items not give any effect.
Workaround: invoke configureDomainAxes method on CombinedDomainXYPlot earlier than configureRangeAxes on subplot.
Example of invalid range bounds on subplot of CombinedDomainXYPlot
Patch attached.
This patch fixes "Auto range" context menu behaviour, but the bug is still actual. Domain axis has correct range[-10,10], but range axis still has [0,1] range after adding data.
This looks like it fixes it. It is not a very "clean" fix, since the XYPlot class shouldn't really need to know anything about the combined XYPlot classes, but I can't think of another way to do it yet:
Index: XYPlot.java
--- XYPlot.java Base (BASE)
+++ XYPlot.java Locally Modified (Based On LOCAL)
@@ -4536,12 +4537,15 @@
*/
@Override
public void datasetChanged(DatasetChangeEvent event) {
configureDomainAxes();
getParent().datasetChanged(event);
}
PlotChangeEvent e = new PlotChangeEvent(this);
e.setType(ChartChangeEventType.DATASET_UPDATED);
notifyListeners(e);
Yes, the above fix fixes bug. But what about changes in CombinedDomainXYPlot instead of XYPlot?-) Please look at the attached patch.
Thanks Vladimir, I like your fix better. I have committed it for inclusion in the next release (1.0.20).
Looks like this fix also fixes bug-1101