Example usage for org.jfree.chart.axis AxisSpace ensureAtLeast

List of usage examples for org.jfree.chart.axis AxisSpace ensureAtLeast

Introduction

In this page you can find the example usage for org.jfree.chart.axis AxisSpace ensureAtLeast.

Prototype

public void ensureAtLeast(double space, RectangleEdge edge) 

Source Link

Document

Ensures there is a minimum amount of space at the edge corresponding to the specified axis location.

Usage

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Calculates the space required for the range axis/axes.
 *
 * @param g2  the graphics device.//from   w ww .  ja  v  a2  s  .c  o m
 * @param plotArea  the plot area.
 * @param space  a carrier for the result (<code>null</code> permitted).
 *
 * @return The required space.
 */
protected AxisSpace calculateRangeAxisSpace(Graphics2D g2, Rectangle2D plotArea, AxisSpace space) {

    if (space == null) {
        space = new AxisSpace();
    }

    // reserve some space for the range axis...
    if (this.fixedRangeAxisSpace != null) {
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(), RectangleEdge.TOP);
            space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(), RectangleEdge.BOTTOM);
        } else if (this.orientation == PlotOrientation.VERTICAL) {
            space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(), RectangleEdge.LEFT);
            space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(), RectangleEdge.RIGHT);
        }
    } else {
        // reserve space for the range axes...
        for (int i = 0; i < this.rangeAxes.size(); i++) {
            Axis axis = (Axis) this.rangeAxes.get(i);
            if (axis != null) {
                RectangleEdge edge = getRangeAxisEdge(i);
                space = axis.reserveSpace(g2, this, plotArea, edge, space);
            }
        }
    }
    return space;

}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Calculates the space required for the domain axis/axes.
 *
 * @param g2  the graphics device.//  w w w  .j  a v a2 s . c  om
 * @param plotArea  the plot area.
 * @param space  a carrier for the result (<code>null</code> permitted).
 *
 * @return The required space.
 */
protected AxisSpace calculateDomainAxisSpace(Graphics2D g2, Rectangle2D plotArea, AxisSpace space) {

    if (space == null) {
        space = new AxisSpace();
    }

    // reserve some space for the domain axis...
    if (this.fixedDomainAxisSpace != null) {
        if (this.orientation == PlotOrientation.HORIZONTAL) {
            space.ensureAtLeast(this.fixedDomainAxisSpace.getLeft(), RectangleEdge.LEFT);
            space.ensureAtLeast(this.fixedDomainAxisSpace.getRight(), RectangleEdge.RIGHT);
        } else if (this.orientation == PlotOrientation.VERTICAL) {
            space.ensureAtLeast(this.fixedDomainAxisSpace.getTop(), RectangleEdge.TOP);
            space.ensureAtLeast(this.fixedDomainAxisSpace.getBottom(), RectangleEdge.BOTTOM);
        }
    } else {
        // reserve space for the domain axes...
        for (int i = 0; i < this.domainAxes.size(); i++) {
            Axis axis = (Axis) this.domainAxes.get(i);
            if (axis != null) {
                RectangleEdge edge = getDomainAxisEdge(i);
                space = axis.reserveSpace(g2, this, plotArea, edge, space);
            }
        }
    }

    return space;

}