当前位置: 首页>>代码示例>>Java>>正文


Java RectangleEdge.RIGHT属性代码示例

本文整理汇总了Java中org.jfree.chart.ui.RectangleEdge.RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java RectangleEdge.RIGHT属性的具体用法?Java RectangleEdge.RIGHT怎么用?Java RectangleEdge.RIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.jfree.chart.ui.RectangleEdge的用法示例。


在下文中一共展示了RectangleEdge.RIGHT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: add

/**
 * Adds a block to the arrangement manager at the specified edge.
 * If the key is not an instance of {@link RectangleEdge} the block will
 * be added in the center.
 *
 * @param block  the block ({@code null} permitted).
 * @param key  the edge (an instance of {@link RectangleEdge}) or
 *             {@code null} for the center block.
 */
@Override
public void add(Block block, Object key) {

    if (!(key instanceof RectangleEdge)) { // catches null also
        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;
        }
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:31,代码来源:BorderArrangement.java

示例2: getLabelPosition

/**
 * Returns the category label position specification for an axis at the
 * given location.
 *
 * @param edge  the axis location.
 *
 * @return The category label position specification.
 */
public CategoryLabelPosition getLabelPosition(RectangleEdge edge) {
    CategoryLabelPosition result = null;
    if (edge == RectangleEdge.TOP) {
        result = this.positionForAxisAtTop;
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result = this.positionForAxisAtBottom;
    }
    else if (edge == RectangleEdge.LEFT) {
        result = this.positionForAxisAtLeft;
    }
    else if (edge == RectangleEdge.RIGHT) {
        result = this.positionForAxisAtRight;
    }
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:24,代码来源:CategoryLabelPositions.java

示例3: add

/**
 * Adds space to the top, bottom, left or right edge of the plot area.
 *
 * @param space  the space (in Java2D units).
 * @param edge  the edge ({@code null} not permitted).
 */
public void add(double space, RectangleEdge edge) {
    Args.nullNotPermitted(edge, "edge");
    if (edge == RectangleEdge.TOP) {
        this.top += space;
    }
    else if (edge == RectangleEdge.BOTTOM) {
        this.bottom += space;
    }
    else if (edge == RectangleEdge.LEFT) {
        this.left += space;
    }
    else if (edge == RectangleEdge.RIGHT) {
        this.right += space;
    }
    else {
        throw new IllegalStateException("Unrecognised 'edge' argument.");
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:24,代码来源:AxisSpace.java

示例4: drawAxisLine

/**
 * 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;
    double x = dataArea.getX();
    double y = dataArea.getY();
    if (edge == RectangleEdge.TOP) {
        axisLine = new Line2D.Double(x, cursor, dataArea.getMaxX(), cursor);
    } else if (edge == RectangleEdge.BOTTOM) {
        axisLine = new Line2D.Double(x, cursor, dataArea.getMaxX(), cursor);
    } else if (edge == RectangleEdge.LEFT) {
        axisLine = new Line2D.Double(cursor, y, cursor, dataArea.getMaxY());
    } else if (edge == RectangleEdge.RIGHT) {
        axisLine = new Line2D.Double(cursor, y, cursor, dataArea.getMaxY());
    }
    g2.setPaint(this.axisLinePaint);
    g2.setStroke(this.axisLineStroke);
    Object saved = g2.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, 
            RenderingHints.VALUE_STROKE_NORMALIZE);
    g2.draw(axisLine);
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, saved);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:30,代码来源:Axis.java

示例5: getCategoryStart

/**
 * Returns the starting coordinate for the specified category.
 *
 * @param category  the category.
 * @param categoryCount  the number of categories.
 * @param area  the data area.
 * @param edge  the axis location.
 *
 * @return The coordinate.
 *
 * @see #getCategoryMiddle(int, int, Rectangle2D, RectangleEdge)
 * @see #getCategoryEnd(int, int, Rectangle2D, RectangleEdge)
 */
public double getCategoryStart(int category, int categoryCount, 
        Rectangle2D area, RectangleEdge edge) {

    double result = 0.0;
    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
        result = area.getX() + area.getWidth() * getLowerMargin();
    }
    else if ((edge == RectangleEdge.LEFT)
            || (edge == RectangleEdge.RIGHT)) {
        result = area.getMinY() + area.getHeight() * getLowerMargin();
    }

    double categorySize = calculateCategorySize(categoryCount, area, edge);
    double categoryGapWidth = calculateCategoryGapSize(categoryCount, area,
            edge);

    result = result + category * (categorySize + categoryGapWidth);
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:32,代码来源:CategoryAxis.java

示例6: calculateCategorySize

/**
 * Calculates the size (width or height, depending on the location of the
 * axis) of a category.
 *
 * @param categoryCount  the number of categories.
 * @param area  the area within which the categories will be drawn.
 * @param edge  the axis location.
 *
 * @return The category size.
 */
protected double calculateCategorySize(int categoryCount, Rectangle2D area,
        RectangleEdge edge) {
    double result;
    double available = 0.0;

    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
        available = area.getWidth();
    }
    else if ((edge == RectangleEdge.LEFT)
            || (edge == RectangleEdge.RIGHT)) {
        available = area.getHeight();
    }
    if (categoryCount > 1) {
        result = available * (1 - getLowerMargin() - getUpperMargin()
                 - getCategoryMargin());
        result = result / categoryCount;
    }
    else {
        result = available * (1 - getLowerMargin() - getUpperMargin());
    }
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:32,代码来源:CategoryAxis.java

示例7: calculateCategoryGapSize

/**
 * Calculates the size (width or height, depending on the location of the
 * axis) of a category gap.
 *
 * @param categoryCount  the number of categories.
 * @param area  the area within which the categories will be drawn.
 * @param edge  the axis location.
 *
 * @return The category gap width.
 */
protected double calculateCategoryGapSize(int categoryCount, 
        Rectangle2D area, RectangleEdge edge) {

    double result = 0.0;
    double available = 0.0;

    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
        available = area.getWidth();
    }
    else if ((edge == RectangleEdge.LEFT)
            || (edge == RectangleEdge.RIGHT)) {
        available = area.getHeight();
    }

    if (categoryCount > 1) {
        result = available * getCategoryMargin() / (categoryCount - 1);
    }
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:29,代码来源:CategoryAxis.java

示例8: add

/**
 * Adds an axis to the collection.
 *
 * @param axis  the axis ({@code null} not permitted).
 * @param edge  the edge of the plot that the axis should be drawn on
 *              ({@code null} not permitted).
 */
public void add(Axis axis, RectangleEdge edge) {
    Args.nullNotPermitted(axis, "axis");
    Args.nullNotPermitted(edge, "edge");
    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);
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:23,代码来源:AxisCollection.java

示例9: calculateAnchorPoint

/**
 * Calculates the anchor point for a tick label.
 *
 * @param tick  the tick.
 * @param cursor  the cursor.
 * @param dataArea  the data area.
 * @param edge  the edge on which the axis is drawn.
 *
 * @return The x and y coordinates of the anchor point.
 */
protected float[] calculateAnchorPoint(ValueTick tick, double cursor,
        Rectangle2D dataArea, RectangleEdge edge) {

    RectangleInsets insets = getTickLabelInsets();
    float[] result = new float[2];
    if (edge == RectangleEdge.TOP) {
        result[0] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
        result[1] = (float) (cursor - insets.getBottom() - 2.0);
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result[0] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
        result[1] = (float) (cursor + insets.getTop() + 2.0);
    }
    else if (edge == RectangleEdge.LEFT) {
        result[0] = (float) (cursor - insets.getLeft() - 2.0);
        result[1] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
    }
    else if (edge == RectangleEdge.RIGHT) {
        result[0] = (float) (cursor + insets.getRight() + 2.0);
        result[1] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
    }
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:33,代码来源:ValueAxis.java

示例10: draw

/**
 * Draws the title on a Java 2D graphics device (such as the screen or a
 * printer).
 *
 * @param g2  the graphics device.
 * @param area  the area allocated for the title.
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area) {
    RectangleEdge position = getPosition();
    if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {
        drawHorizontal(g2, area);
    }
    else if (position == RectangleEdge.LEFT
                 || position == RectangleEdge.RIGHT) {
        drawVertical(g2, area);
    }
    else {
        throw new RuntimeException("Invalid title position.");
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:21,代码来源:ImageTitle.java

示例11: drawVertical

/**
 * 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);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:46,代码来源:TextTitle.java

示例12: moveCursor

/**
 * Moves the cursor outwards by the specified number of units.
 *
 * @param units  the units.
 * @param edge  the edge.
 */
public void moveCursor(double units, RectangleEdge edge) {
    if (edge == RectangleEdge.TOP) {
        cursorUp(units);
    }
    else if (edge == RectangleEdge.BOTTOM) {
        cursorDown(units);
    }
    else if (edge == RectangleEdge.LEFT) {
        cursorLeft(units);
    }
    else if (edge == RectangleEdge.RIGHT) {
        cursorRight(units);
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:20,代码来源:AxisState.java

示例13: draw

/**
 * Draws the axis.
 *
 * @param g2  the graphics device ({@code null} not permitted).
 * @param cursor  the cursor position.
 * @param plotArea  the plot area ({@code null} not permitted).
 * @param dataArea  the data area ({@code null} not permitted).
 * @param edge  the edge ({@code null} not permitted).
 * @param plotState  collects information about the plot
 *                   ({@code null} permitted).
 *
 * @return The axis state (never {@code null}).
 */
@Override
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;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:45,代码来源:CyclicNumberAxis.java

示例14: ensureAtLeast

/**
 * 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."
        );
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:34,代码来源:AxisSpace.java

示例15: getLabelEnclosure

/**
 * 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();
    Rectangle2D bounds = null;
    if (this.attributedLabel != null) {
        TextLayout layout = new TextLayout(
                this.attributedLabel.getIterator(), 
                g2.getFontRenderContext());
        bounds = layout.getBounds();
    } else {
        String axisLabel = getLabel();
        if (axisLabel != null && !axisLabel.equals("")) {
            FontMetrics fm = g2.getFontMetrics(getLabelFont());
            bounds = TextUtils.getTextBounds(axisLabel, g2, fm);
        }
    }
    if (bounds != null) {
        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;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:40,代码来源:Axis.java


注:本文中的org.jfree.chart.ui.RectangleEdge.RIGHT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。