本文整理汇总了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;
}
}
}
示例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;
}
示例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.");
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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.");
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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."
);
}
}
示例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;
}