Java Code Examples for org.jfree.chart.util.RectangleEdge#LEFT

The following examples show how to use org.jfree.chart.util.RectangleEdge#LEFT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Arja_00113_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 2
Source File: Elixir_002_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 3
Source File: Cardumen_0080_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Returns a rectangle that encloses the axis label.  This is typically 
 * used for layout purposes (it gives the maximum dimensions of the label).
 *
 * @param g2  the graphics device.
 * @param edge  the edge of the plot area along which the axis is measuring.
 *
 * @return The enclosing rectangle.
 */
protected Rectangle2D getLabelEnclosure(Graphics2D g2, RectangleEdge edge) {

    Rectangle2D result = new Rectangle2D.Double();
    String axisLabel = getLabel();
    if (axisLabel != null && !axisLabel.equals("")) {
        FontMetrics fm = g2.getFontMetrics(getLabelFont());
        Rectangle2D bounds = TextUtilities.getTextBounds(axisLabel, g2, fm);
        RectangleInsets insets = getLabelInsets();
        bounds = insets.createOutsetRectangle(bounds);
        double angle = getLabelAngle();
        if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) {
            angle = angle - Math.PI / 2.0;
        }
        double x = bounds.getCenterX();
        double y = bounds.getCenterY();
        AffineTransform transformer 
            = AffineTransform.getRotateInstance(angle, x, y);
        Shape labelBounds = transformer.createTransformedShape(bounds);
        result = labelBounds.getBounds2D();
    }

    return result;

}
 
Example 4
Source File: Cardumen_00192_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 5
Source File: Elixir_002_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 6
Source File: JGenProg2017_0079_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 7
Source File: Cardumen_00144_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws an axis line at the current cursor position and edge.
 * 
 * @param g2  the graphics device.
 * @param cursor  the cursor position.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawAxisLine(Graphics2D g2, double cursor,
        Rectangle2D dataArea, RectangleEdge edge) {
    
    Line2D axisLine = null;
    if (edge == RectangleEdge.TOP) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.BOTTOM) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.LEFT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    else if (edge == RectangleEdge.RIGHT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    g2.setPaint(this.axisLinePaint);
    g2.setStroke(this.axisLineStroke);
    g2.draw(axisLine);
    
}
 
Example 8
Source File: JGenProg2017_0082_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws an axis line at the current cursor position and edge.
 * 
 * @param g2  the graphics device.
 * @param cursor  the cursor position.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawAxisLine(Graphics2D g2, double cursor,
        Rectangle2D dataArea, RectangleEdge edge) {
    
    Line2D axisLine = null;
    if (edge == RectangleEdge.TOP) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.BOTTOM) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.LEFT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    else if (edge == RectangleEdge.RIGHT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    g2.setPaint(this.axisLinePaint);
    g2.setStroke(this.axisLineStroke);
    g2.draw(axisLine);
    
}
 
Example 9
Source File: AxisCollection.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an axis to the collection.
 *
 * @param axis  the axis (<code>null</code> not permitted).
 * @param edge  the edge of the plot that the axis should be drawn on
 *              (<code>null</code> not permitted).
 */
public void add(Axis axis, RectangleEdge edge) {
    if (axis == null) {
        throw new IllegalArgumentException("Null 'axis' argument.");
    }
    if (edge == null) {
        throw new IllegalArgumentException("Null 'edge' argument.");
    }
    if (edge == RectangleEdge.TOP) {
        this.axesAtTop.add(axis);
    }
    else if (edge == RectangleEdge.BOTTOM) {
        this.axesAtBottom.add(axis);
    }
    else if (edge == RectangleEdge.LEFT) {
        this.axesAtLeft.add(axis);
    }
    else if (edge == RectangleEdge.RIGHT) {
        this.axesAtRight.add(axis);
    }
}
 
Example 10
Source File: Arja_00132_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 11
Source File: jKali_0032_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Returns a rectangle that encloses the axis label.  This is typically 
 * used for layout purposes (it gives the maximum dimensions of the label).
 *
 * @param g2  the graphics device.
 * @param edge  the edge of the plot area along which the axis is measuring.
 *
 * @return The enclosing rectangle.
 */
protected Rectangle2D getLabelEnclosure(Graphics2D g2, RectangleEdge edge) {

    Rectangle2D result = new Rectangle2D.Double();
    String axisLabel = getLabel();
    if (axisLabel != null && !axisLabel.equals("")) {
        FontMetrics fm = g2.getFontMetrics(getLabelFont());
        Rectangle2D bounds = TextUtilities.getTextBounds(axisLabel, g2, fm);
        RectangleInsets insets = getLabelInsets();
        bounds = insets.createOutsetRectangle(bounds);
        double angle = getLabelAngle();
        if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) {
            angle = angle - Math.PI / 2.0;
        }
        double x = bounds.getCenterX();
        double y = bounds.getCenterY();
        AffineTransform transformer 
            = AffineTransform.getRotateInstance(angle, x, y);
        Shape labelBounds = transformer.createTransformedShape(bounds);
        result = labelBounds.getBounds2D();
    }

    return result;

}
 
Example 12
Source File: JGenProg2017_0082_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Returns a rectangle that encloses the axis label.  This is typically 
 * used for layout purposes (it gives the maximum dimensions of the label).
 *
 * @param g2  the graphics device.
 * @param edge  the edge of the plot area along which the axis is measuring.
 *
 * @return The enclosing rectangle.
 */
protected Rectangle2D getLabelEnclosure(Graphics2D g2, RectangleEdge edge) {

    Rectangle2D result = new Rectangle2D.Double();
    String axisLabel = getLabel();
    if (axisLabel != null && !axisLabel.equals("")) {
        FontMetrics fm = g2.getFontMetrics(getLabelFont());
        Rectangle2D bounds = TextUtilities.getTextBounds(axisLabel, g2, fm);
        RectangleInsets insets = getLabelInsets();
        bounds = insets.createOutsetRectangle(bounds);
        double angle = getLabelAngle();
        if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) {
            angle = angle - Math.PI / 2.0;
        }
        double x = bounds.getCenterX();
        double y = bounds.getCenterY();
        AffineTransform transformer 
            = AffineTransform.getRotateInstance(angle, x, y);
        Shape labelBounds = transformer.createTransformedShape(bounds);
        result = labelBounds.getBounds2D();
    }

    return result;

}
 
Example 13
Source File: JGenProg2017_006_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws an axis line at the current cursor position and edge.
 * 
 * @param g2  the graphics device.
 * @param cursor  the cursor position.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawAxisLine(Graphics2D g2, double cursor,
        Rectangle2D dataArea, RectangleEdge edge) {
    
    Line2D axisLine = null;
    if (edge == RectangleEdge.TOP) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.BOTTOM) {
        axisLine = new Line2D.Double(dataArea.getX(), cursor, 
                dataArea.getMaxX(), cursor);  
    }
    else if (edge == RectangleEdge.LEFT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    else if (edge == RectangleEdge.RIGHT) {
        axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, 
                dataArea.getMaxY());  
    }
    g2.setPaint(this.axisLinePaint);
    g2.setStroke(this.axisLineStroke);
    g2.draw(axisLine);
    
}
 
Example 14
Source File: JGenProg2017_00125_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 15
Source File: Arja_00149_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 16
Source File: JGenProg2017_00103_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds a block to the arrangement manager at the specified edge.
 *
 * @param block  the block (<code>null</code> permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             <code>null</code> for the center block.
 */
public void add(Block block, Object key) {

    if (key == null) {
        this.centerBlock = block;
    }
    else {
        RectangleEdge edge = (RectangleEdge) key;
        if (edge == RectangleEdge.TOP) {
            this.topBlock = block;
        }
        else if (edge == RectangleEdge.BOTTOM) {
            this.bottomBlock = block;
        }
        else if (edge == RectangleEdge.LEFT) {
            this.leftBlock = block;
        }
        else if (edge == RectangleEdge.RIGHT) {
            this.rightBlock = block;
        }
    }
}
 
Example 17
Source File: TextTitle.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draws a the title vertically within the specified area.  This method
 * will be called from the {@link #draw(Graphics2D, Rectangle2D) draw}
 * method.
 *
 * @param g2  the graphics device.
 * @param area  the area for the title.
 */
protected void drawVertical(Graphics2D g2, Rectangle2D area) {
    Rectangle2D titleArea = (Rectangle2D) area.clone();
    g2.setFont(this.font);
    g2.setPaint(this.paint);
    TextBlockAnchor anchor = null;
    float y = 0.0f;
    VerticalAlignment verticalAlignment = getVerticalAlignment();
    if (verticalAlignment == VerticalAlignment.TOP) {
        y = (float) titleArea.getY();
        anchor = TextBlockAnchor.TOP_RIGHT;
    }
    else if (verticalAlignment == VerticalAlignment.BOTTOM) {
        y = (float) titleArea.getMaxY();
        anchor = TextBlockAnchor.TOP_LEFT;
    }
    else if (verticalAlignment == VerticalAlignment.CENTER) {
        y = (float) titleArea.getCenterY();
        anchor = TextBlockAnchor.TOP_CENTER;
    }
    float x = 0.0f;
    RectangleEdge position = getPosition();
    if (position == RectangleEdge.LEFT) {
        x = (float) titleArea.getX();
    }
    else if (position == RectangleEdge.RIGHT) {
        x = (float) titleArea.getMaxX();
        if (verticalAlignment == VerticalAlignment.TOP) {
            anchor = TextBlockAnchor.BOTTOM_RIGHT;
        }
        else if (verticalAlignment == VerticalAlignment.CENTER) {
            anchor = TextBlockAnchor.BOTTOM_CENTER;
        }
        else if (verticalAlignment == VerticalAlignment.BOTTOM) {
            anchor = TextBlockAnchor.BOTTOM_LEFT;
        }
    }
    this.content.draw(g2, x, y, anchor, x, y, -Math.PI / 2.0);
}
 
Example 18
Source File: AxisSpace.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Ensures there is a minimum amount of space at the edge corresponding to 
 * the specified axis location.
 * 
 * @param space  the space.
 * @param edge  the location.
 */
public void ensureAtLeast(double space, RectangleEdge edge) {
    if (edge == RectangleEdge.TOP) {
        if (this.top < space) {
            this.top = space;
        }
    }
    else if (edge == RectangleEdge.BOTTOM) {
        if (this.bottom < space) {
            this.bottom = space;
        }
    }
    else if (edge == RectangleEdge.LEFT) {
        if (this.left < space) {
            this.left = space;
        }
    }
    else if (edge == RectangleEdge.RIGHT) {
        if (this.right < space) {
            this.right = space;
        }
    }
    else {
        throw new IllegalStateException(
            "AxisSpace.ensureAtLeast(): unrecognised AxisLocation."
        );
    }
}
 
Example 19
Source File: CyclicNumberAxis.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the axis.
 * 
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param cursor  the cursor position.
 * @param plotArea  the plot area (<code>null</code> not permitted).
 * @param dataArea  the data area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 * @param plotState  collects information about the plot 
 *                   (<code>null</code> permitted).
 * 
 * @return The axis state (never <code>null</code>).
 */
public AxisState draw(Graphics2D g2, 
                      double cursor,
                      Rectangle2D plotArea, 
                      Rectangle2D dataArea, 
                      RectangleEdge edge,
                      PlotRenderingInfo plotState) {
    
    AxisState ret = super.draw(
        g2, cursor, plotArea, dataArea, edge, plotState
    );
    if (isAdvanceLineVisible()) {
        double xx = valueToJava2D(
            getRange().getUpperBound(), dataArea, edge
        );
        Line2D mark = null;
        g2.setStroke(getAdvanceLineStroke());
        g2.setPaint(getAdvanceLinePaint());
        if (edge == RectangleEdge.LEFT) {
            mark = new Line2D.Double(
                cursor, xx, cursor + dataArea.getWidth(), xx
            );
        }
        else if (edge == RectangleEdge.RIGHT) {
            mark = new Line2D.Double(
                cursor - dataArea.getWidth(), xx, cursor, xx
            );
        }
        else if (edge == RectangleEdge.TOP) {
            mark = new Line2D.Double(
                xx, cursor + dataArea.getHeight(), xx, cursor
            );
        }
        else if (edge == RectangleEdge.BOTTOM) {
            mark = new Line2D.Double(
                xx, cursor, xx, cursor - dataArea.getHeight()
            );
        }
        g2.draw(mark);
    }
    return ret;
}
 
Example 20
Source File: CategoryAxis3D.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the axis on a Java 2D graphics device (such as the screen or a 
 * printer).
 *
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param cursor  the cursor location.
 * @param plotArea  the area within which the axis should be drawn 
 *                  (<code>null</code> not permitted).
 * @param dataArea  the area within which the plot is being drawn 
 *                  (<code>null</code> not permitted).
 * @param edge  the location of the axis (<code>null</code> not permitted).
 * @param plotState  collects information about the plot (<code>null</code>
 *                   permitted).
 * 
 * @return The axis state (never <code>null</code>).
 */
public AxisState draw(Graphics2D g2, 
                      double cursor,
                      Rectangle2D plotArea, 
                      Rectangle2D dataArea, 
                      RectangleEdge edge,
                      PlotRenderingInfo plotState) {

    // if the axis is not visible, don't draw it...
    if (!isVisible()) {
        return new AxisState(cursor);
    }

    // calculate the adjusted data area taking into account the 3D effect...
    // this assumes that there is a 3D renderer, all this 3D effect is a 
    // bit of an ugly hack...
    CategoryPlot plot = (CategoryPlot) getPlot();

    Rectangle2D adjustedDataArea = new Rectangle2D.Double();
    if (plot.getRenderer() instanceof Effect3D) {
        Effect3D e3D = (Effect3D) plot.getRenderer();
        double adjustedX = dataArea.getMinX();
        double adjustedY = dataArea.getMinY();
        double adjustedW = dataArea.getWidth() - e3D.getXOffset();
        double adjustedH = dataArea.getHeight() - e3D.getYOffset();

        if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) {
            adjustedY += e3D.getYOffset();
        }
        else if (edge == RectangleEdge.RIGHT || edge == RectangleEdge.TOP) {
            adjustedX += e3D.getXOffset();
        }
        adjustedDataArea.setRect(adjustedX, adjustedY, adjustedW, 
                adjustedH);
    }
    else {
        adjustedDataArea.setRect(dataArea);   
    }

    // draw the category labels and axis label
    AxisState state = new AxisState(cursor);
    state = drawCategoryLabels(g2, plotArea, adjustedDataArea, edge, 
            state, plotState);
    state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state,
            plotState);

    return state;
    
}