Example usage for org.jfree.chart.axis Axis reserveSpace

List of usage examples for org.jfree.chart.axis Axis reserveSpace

Introduction

In this page you can find the example usage for org.jfree.chart.axis Axis reserveSpace.

Prototype

public abstract AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge,
        AxisSpace space);

Source Link

Document

Estimates the space (height or width) required to draw the axis.

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.// ww w . j  av a 2s.  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.// www . java2 s  . co  m
 * @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;

}