Range class, great concept, need two more methods

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

Range class, great concept, need two more methods

Post by Mudit Wahal » Mon Feb 03, 2003 5:55 am

David,

Range class, great concept. I'd like to you also add setLowerBound and setUpperBound methods so the Range object can be reused without allocation. I've been using RangeInfo class in the dynamic data objects (the data refreshes every sec or so). So, it'll be a waste of resources to reallocate the Range object again and again.

Thanks
Mudit

David Gilbert

Re: Range class, great concept, need two more methods

Post by David Gilbert » Mon Feb 03, 2003 2:14 pm

Hi Mudit,

Adding those methods would cause a problem elsewhere, it would be possible to modify the axis range without the chart being notified, like this:

plot.getDomainAxis().getRange().setUpperBound(42.0);

So I need the object returned by getRange() to be immutable. Maybe there is a way around that, I'll look into it after I've released 0.9.5.

Regards,

Dave Gilbert

Mudit Wahal

Re: Range class, great concept, need two more methods

Post by Mudit Wahal » Mon Feb 03, 2003 4:48 pm

Dave,

I always implement RangeInfo class for all my datasets. The reason is simple as my dataset class already knows the lower and upper bounds and the RangeInfo methods are helpful in returning those values. It definitely cuts down the plotting time as the plot doesn't have to loop thru the entire dataset.

Now the getValueRange() method returns the Range object. But since there is no setting up lower and upper values in this Range class, I can't reuse the Range object in my dataset.

My datasets are being used to plot intraday tick by tick stock charts. So, each tick triggers request for new plot. I've tried to optimize as much as possible so no new objects are created for each plot.

Thanks

Mudit

Locked