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


Java RectangleEdge.BOTTOM属性代码示例

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


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

示例1: testValueToJava2D

/**
 * Test of valueToJava2D method.
 */
@Test
public void testValueToJava2D() {
    Rectangle2D plotArea = new Rectangle2D.Double(22, 33, 500, 500);
    RectangleEdge edge = RectangleEdge.BOTTOM;

    // set axis bounds to be both greater than 1
    this.axis.setRange(10, 20);
    checkPointsToJava2D(edge, plotArea);

    // check for bounds interval that includes 1
    this.axis.setRange(0.5, 10);
    checkPointsToJava2D(edge, plotArea);

    // check for bounds interval that includes 1
    this.axis.setRange(0.2, 20);
    checkPointsToJava2D(edge, plotArea);

    // check for both bounds smaller than 1
    this.axis.setRange(0.2, 0.7);
    checkPointsToJava2D(edge, plotArea);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:24,代码来源:LogarithmicAxisTest.java

示例2: 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

示例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: 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

示例7: 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

示例8: 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

示例9: 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

示例10: getRectY

/**
 * Adjusts the supplied y-value.
 *
 * @param y  the x-value.
 * @param h1  height 1.
 * @param h2  height 2.
 * @param edge  the edge (top or bottom).
 *
 * @return The adjusted y-value.
 */
protected double getRectY(double y, double h1, double h2,
                          RectangleEdge edge) {

    double result = y;
    if (edge == RectangleEdge.TOP) {
        result = result + h1;
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result = result + h2;
    }
    return result;

}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:23,代码来源:Plot.java

示例11: 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

示例12: reserved

/**
 * Calculates the reserved area.
 *
 * @param area  the area.
 * @param edge  the edge.
 *
 * @return The reserved area.
 */
public Rectangle2D reserved(Rectangle2D area, RectangleEdge edge) {
    Rectangle2D result = null;
    if (edge == RectangleEdge.TOP) {
        result = new Rectangle2D.Double(
            area.getX(), area.getY(), area.getWidth(), this.top
        );
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result = new Rectangle2D.Double(
            area.getX(), area.getMaxY() - this.top,
            area.getWidth(), this.bottom
        );
    }
    else if (edge == RectangleEdge.LEFT) {
        result = new Rectangle2D.Double(
            area.getX(), area.getY(), this.left, area.getHeight()
        );
    }
    else if (edge == RectangleEdge.RIGHT) {
        result = new Rectangle2D.Double(
            area.getMaxX() - this.right, area.getY(),
            this.right, area.getHeight()
        );
    }
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:34,代码来源:AxisSpace.java

示例13: createShadow

/**
 * Creates a shadow for the bar.
 *
 * @param bar  the bar shape.
 * @param xOffset  the x-offset for the shadow.
 * @param yOffset  the y-offset for the shadow.
 * @param base  the edge that is the base of the bar.
 * @param pegShadow  peg the shadow to the base?
 *
 * @return A rectangle for the shadow.
 */
private Rectangle2D createShadow(RectangularShape bar, double xOffset,
        double yOffset, RectangleEdge base, boolean pegShadow) {
    double x0 = bar.getMinX();
    double x1 = bar.getMaxX();
    double y0 = bar.getMinY();
    double y1 = bar.getMaxY();
    if (base == RectangleEdge.TOP) {
        x0 += xOffset;
        x1 += xOffset;
        if (!pegShadow) {
            y0 += yOffset;
        }
        y1 += yOffset;
    }
    else if (base == RectangleEdge.BOTTOM) {
        x0 += xOffset;
        x1 += xOffset;
        y0 += yOffset;
        if (!pegShadow) {
            y1 += yOffset;
        }
    }
    else if (base == RectangleEdge.LEFT) {
        if (!pegShadow) {
            x0 += xOffset;
        }
        x1 += xOffset;
        y0 += yOffset;
        y1 += yOffset;
    }
    else if (base == RectangleEdge.RIGHT) {
        x0 += xOffset;
        if (!pegShadow) {
            x1 += xOffset;
        }
        y0 += yOffset;
        y1 += yOffset;
    }
    return new Rectangle2D.Double(x0, y0, (x1 - x0), (y1 - y0));
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:51,代码来源:StandardXYBarPainter.java

示例14: resolveDomainAxisLocation

/**
 * Resolves a domain axis location for a given plot orientation.
 *
 * @param location  the location ({@code null} not permitted).
 * @param orientation  the orientation ({@code null} not permitted).
 *
 * @return The edge (never {@code null}).
 */
public static RectangleEdge resolveDomainAxisLocation(
        AxisLocation location, PlotOrientation orientation) {

    Args.nullNotPermitted(location, "location");
    Args.nullNotPermitted(orientation, "orientation");

    RectangleEdge result = null;
    if (location == AxisLocation.TOP_OR_RIGHT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.RIGHT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.TOP;
        }
    }
    else if (location == AxisLocation.TOP_OR_LEFT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.LEFT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.TOP;
        }
    }
    else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.RIGHT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.BOTTOM;
        }
    }
    else if (location == AxisLocation.BOTTOM_OR_LEFT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.LEFT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.BOTTOM;
        }
    }
    // the above should cover all the options...
    if (result == null) {
        throw new IllegalStateException("resolveDomainAxisLocation()");
    }
    return result;

}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:54,代码来源:Plot.java

示例15: resolveRangeAxisLocation

/**
 * Resolves a range axis location for a given plot orientation.
 *
 * @param location  the location ({@code null} not permitted).
 * @param orientation  the orientation ({@code null} not permitted).
 *
 * @return The edge (never {@code null}).
 */
public static RectangleEdge resolveRangeAxisLocation(
        AxisLocation location, PlotOrientation orientation) {

    Args.nullNotPermitted(location, "location");
    Args.nullNotPermitted(orientation, "orientation");

    RectangleEdge result = null;
    if (location == AxisLocation.TOP_OR_RIGHT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.TOP;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.RIGHT;
        }
    }
    else if (location == AxisLocation.TOP_OR_LEFT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.TOP;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.LEFT;
        }
    }
    else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.BOTTOM;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.RIGHT;
        }
    }
    else if (location == AxisLocation.BOTTOM_OR_LEFT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.BOTTOM;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.LEFT;
        }
    }

    // the above should cover all the options...
    if (result == null) {
        throw new IllegalStateException("resolveRangeAxisLocation()");
    }
    return result;

}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:55,代码来源:Plot.java


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