Bug report: divide by zero..

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Miles Parker

Bug report: divide by zero..

Post by Miles Parker » Thu Feb 07, 2002 11:53 pm

..at Plot.getSeriesPaint().

Happens when there are no sereis points specified (i.e. their are no currently selected series) so the mod operator breaks.

btw, _very_ nice work; we are using JFreeChart to replace commercial software whihch will allow us to make a more public release. _Much_ cleaner api than Sitarka's. Hopefully we will be able to contribute something at some point.

David Gilbert

Re: Bug report: divide by zero..

Post by David Gilbert » Fri Feb 08, 2002 3:46 pm

Hi Miles,

In the Plot constructor, the seriesPaint array is initialised with 9 default colors. That never gets changed, so I'm guessing that somewhere you must have called setSeriesPaint(...) and supplied an empty array, which wouldn't be a good thing to do. I could put some code in setSeriesPaint(...) to ensure that the array is non-empty...or did I misunderstand the problem?

Regards,

DG.

Miles Parker

Re: Bug report: divide by zero..

Post by Miles Parker » Fri Feb 08, 2002 10:26 pm

Yea, I'm writing to setSeriesPaint with the colors that I would like to be dispalyed for each series. that's the only way I could figure out to set specific colors. (I tried overriding getSeriesPaint in my dataset, but that didn't seem to do anything.)

So anyway, in the case where _no_ series are currently selectex for display, this does get set to an empty array; i.e., there are no series being painted so you shouldn't need to get at the paint for any series. As a work around, I am now setting this to {Color.white} in the case where there are no series being displayed.

I build framewroks myself, so I know the frustration of someone doing an end-run around the preffered method! Probaably I'm just missing something about the right way to do this.

David Gilbert

Re: Bug report: divide by zero..

Post by David Gilbert » Sat Feb 09, 2002 12:05 am

I think you are right, if there are no series then there shouldn't be any code trying to get the seriesPaint...I'll see if I can find out what is happening.

Regards,

DG.

Locked