afreechart/src/main/java/org/afree/chart/axis/DateAxis.java
/**
     * Rescales the axis to ensure that all data is visible.
     */
Rescales the axis to ensure that all data is visible.
Rescales the axis to ensure that all data is visible .
protected void autoAdjustRange() {
        Plot plot = getPlot();
        if (plot == null) {
            return;  
        }
        if (plot instanceof ValueAxisPlot) {
            ValueAxisPlot vap = (ValueAxisPlot) plot;
            Range r = vap.getDataRange(this);
            if (r == null) {
                if (this.timeline instanceof SegmentedTimeline) {
                    r = new DateRange((
                            (SegmentedTimeline) this.timeline).getStartTime(),
                            ((SegmentedTimeline) this.timeline).getStartTime()
                            + 1);
                }
                else {
                    r = new DateRange();
                }
            }
            long upper = this.timeline.toTimelineValue(
                    (long) r.getUpperBound());
            long lower;
            long fixedAutoRange = (long) getFixedAutoRange();
            if (fixedAutoRange > 0.0) {
                lower = upper - fixedAutoRange;
            }
            else {
                lower = this.timeline.toTimelineValue((long) r.getLowerBound());
                double range = upper - lower;
                long minRange = (long) getAutoRangeMinimumSize();
                if (range < minRange) {
                    long expand = (long) (minRange - range) / 2;
                    upper = upper + expand;
                    lower = lower - expand;
                }
                upper = upper + (long) (range * getUpperMargin());
                lower = lower - (long) (range * getLowerMargin());
            }
            upper = this.timeline.toMillisecond(upper);
            lower = this.timeline.toMillisecond(lower);
            DateRange dr = new DateRange(new Date(lower), new Date(upper));
            setRange(dr, false, false);
        }
    }
protected void autoAdjustRange ( ) { Plot plot = getPlot ( ) ; if ( plot == null ) { return ; } if ( plot instanceof ValueAxisPlot ) { ValueAxisPlot vap = ( ValueAxisPlot ) plot ; Range r = vap . getDataRange ( this ) ; if ( r == null ) { if ( this . timeline instanceof SegmentedTimeline ) { r = new DateRange ( ( ( SegmentedTimeline ) this . timeline ) . getStartTime ( ) , ( ( SegmentedTimeline ) this . timeline ) . getStartTime ( ) + 1 ) ; } else { r = new DateRange ( ) ; } } long upper = this . timeline . toTimelineValue ( ( long ) r . getUpperBound ( ) ) ; long lower ; long fixedAutoRange = ( long ) getFixedAutoRange ( ) ; if ( fixedAutoRange > 0.0 ) { lower = upper - fixedAutoRange ; } else { lower = this . timeline . toTimelineValue ( ( long ) r . getLowerBound ( ) ) ; double range = upper - lower ; long minRange = ( long ) getAutoRangeMinimumSize ( ) ; if ( range < minRange ) { long expand = ( long ) ( minRange - range ) / 2 ; upper = upper + expand ; lower = lower - expand ; } upper = upper + ( long ) ( range * getUpperMargin ( ) ) ; lower = lower - ( long ) ( range * getLowerMargin ( ) ) ; } upper = this . timeline . toMillisecond ( upper ) ; lower = this . timeline . toMillisecond ( lower ) ; DateRange dr = new DateRange ( new Date ( lower ) , new Date ( upper ) ) ; setRange ( dr , false , false ) ; } }
Rescales the axis to ensure that all data is visible.
Rescales the axis to ensure that all data is visible .
// no plot, no data //Timeline hasn't method getStartTime()