Marker outside Axis range

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cortesino
Posts: 10
Joined: Mon Aug 11, 2008 7:31 pm

Marker outside Axis range

Post by cortesino » Thu Aug 21, 2008 11:09 am

Hello,

I have a chart with some plots with markers that sometimes fall outside data ranges, and don't drawn in axis setAutoRange(true).

Is there any way for draw automatically this markers?

Regards.

cortesino
Posts: 10
Joined: Mon Aug 11, 2008 7:31 pm

Post by cortesino » Wed Aug 27, 2008 7:32 pm

Anything idea?

RoyW
Posts: 93
Joined: Wed Apr 23, 2008 7:42 pm
Contact:

Post by RoyW » Wed Aug 27, 2008 9:43 pm

You could extend your dataset to implement the RangeInfo interface.

Code: Select all

    public class MyDefaultXYDataset extends DefaultXYDataset implements RangeInfo{

        public double getRangeLowerBound(boolean includeInterval) {
            return getRangeBounds(includeInterval).getLowerBound();
        }

        public double getRangeUpperBound(boolean includeInterval) {
            return getRangeBounds(includeInterval).getUpperBound();
        }

        public Range getRangeBounds(boolean includeInterval) {
            Range result = DatasetUtilities.iterateRangeBounds(this, includeInterval);

//Put you own checks here, perhaps checking the min/max value of your range markers
            if(result.getLowerBound() > -20){
                result = new Range(-20, result.getUpperBound());
            }
            if(result.getUpperBound() < 20){
                result = new Range(result.getLowerBound(), 20);
            }
            return result;
        }
    }

The answer does not come from thinking outside the box, rather the answer comes from realizing the truth; There is no Box. my js site

Locked