Bug in handling multiple renderer / axes

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
christopher.loerken
Posts: 16
Joined: Wed Aug 31, 2005 4:25 pm

Bug in handling multiple renderer / axes

Post by christopher.loerken » Tue Sep 06, 2005 3:45 pm

I guess I've found a bug or at least a missing functionality in the support of multiple renderer or axes:

Assume the following situation:
If you want to plot different objects that are ordered in a way that is reflected by an index number of the object. If you want to decide which of the objects to plot it is helpful (and possible) to add different Datasets and different renderer / axes to the plot using the set methods that specify an index parameter. And, to use the index of the object to match the index of the dataset. Basically, this works very well and is no problem.

Furthermore, you might want to leave out some of the plotted objects resulting in for instance having datasets and the according renderer/axes number 0,1,2,4. This works fine a well.

Now, however, if you leave out the first Dataset (0) by setting it to be null (this showed up for me to be the most reliable way of "unshowing" a dataset), you get a NullPointerException from the draw methods.

To be a litte bit more precise, the drawing of the background grid fails as this uses the getDomainAxis() (<- no index) method to determine the spacing of the grid to be drawn.

My suggestion would be, that the graph should check for the first available (or visible) domainaxis at this point, avoiding the NullPointer.


Regards,
Christopher

Locked