Hi,
I found two problems with this method:
1) it returns 1 when there are no datasets in the plot
2) if I add datasets to a plot and then remove them with plot.setDataset(i, null) they still count!
Will this be fixed anytime soon or is there a workaround? I'm using jfreechart-1.0.10.
Thanx
/Lukas
XYPlot.getDatasetCount() returns wrong number
Re: XYPlot.getDatasetCount() returns wrong number
If you go into source for XYPlot, the 0 arg constructor calls the 4-arg constructor with null for the dataset. In that constructor, on about line 567, you see this:
If you move the set call under the test, that fixes the problem of getDatasetCount() returning 1 when it should be 0.
Code: Select all
this.datasets.set(0, dataset);
if (dataset != null) {
dataset.addChangeListener(this);
}
Code: Select all
if (dataset != null) {
this.datasets.set(0, dataset);
dataset.addChangeListener(this);
}