Java Code Examples for org.jfree.chart.util.RectangleEdge#RIGHT
The following examples show how to use
org.jfree.chart.util.RectangleEdge#RIGHT .
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: Nopol2017_001_t.java From coming with MIT License | 6 votes |
/** * 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: Cardumen_0080_s.java From coming with MIT License | 6 votes |
/** * 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 3
Source File: Cardumen_007_s.java From coming with MIT License | 6 votes |
/** * 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 4
Source File: Cardumen_00140_t.java From coming with MIT License | 6 votes |
/** * 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: JGenProg2017_00125_s.java From coming with MIT License | 6 votes |
/** * 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_002_t.java From coming with MIT License | 6 votes |
/** * 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: patch1-Chart-13-Nopol2017_patch1-Chart-13-Nopol2017_t.java From coming with MIT License | 6 votes |
/** * 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 8
Source File: Elixir_002_s.java From coming with MIT License | 6 votes |
/** * 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 9
Source File: CategoryAxis.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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 = 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 * (1 - getLowerMargin() - getUpperMargin() - getCategoryMargin()); result = result / categoryCount; } else { result = available * (1 - getLowerMargin() - getUpperMargin()); } return result; }
Example 10
Source File: Cardumen_007_s.java From coming with MIT License | 6 votes |
/** * 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 11
Source File: Cardumen_007_t.java From coming with MIT License | 6 votes |
/** * 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 12
Source File: JGenProg2017_00103_t.java From coming with MIT License | 6 votes |
/** * 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 13
Source File: AxisCollection.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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 14
Source File: Arja_00149_s.java From coming with MIT License | 6 votes |
/** * 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: jMutRepair_0046_t.java From coming with MIT License | 6 votes |
/** * 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 16
Source File: 1_BorderArrangement.java From SimFix with GNU General Public License v2.0 | 6 votes |
/** * 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: Plot.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Resolves a domain axis location for a given plot orientation. * * @param location the location (<code>null</code> not permitted). * @param orientation the orientation (<code>null</code> not permitted). * * @return The edge (never <code>null</code>). */ public static RectangleEdge resolveDomainAxisLocation( AxisLocation location, PlotOrientation orientation) { if (location == null) { throw new IllegalArgumentException("Null 'location' argument."); } if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } 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; }
Example 18
Source File: CategoryAxis3D.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Returns the Java 2D coordinate for a category. * * @param anchor the anchor point. * @param category the category index. * @param categoryCount the category count. * @param area the data area. * @param edge the location of the axis. * * @return The coordinate. */ public double getCategoryJava2DCoordinate(CategoryAnchor anchor, int category, int categoryCount, Rectangle2D area, RectangleEdge edge) { double result = 0.0; Rectangle2D adjustedArea = area; CategoryPlot plot = (CategoryPlot) getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); if (renderer instanceof Effect3D) { Effect3D e3D = (Effect3D) renderer; double adjustedX = area.getMinX(); double adjustedY = area.getMinY(); double adjustedW = area.getWidth() - e3D.getXOffset(); double adjustedH = area.getHeight() - e3D.getYOffset(); if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) { adjustedY += e3D.getYOffset(); } else if (edge == RectangleEdge.RIGHT || edge == RectangleEdge.TOP) { adjustedX += e3D.getXOffset(); } adjustedArea = new Rectangle2D.Double(adjustedX, adjustedY, adjustedW, adjustedH); } if (anchor == CategoryAnchor.START) { result = getCategoryStart(category, categoryCount, adjustedArea, edge); } else if (anchor == CategoryAnchor.MIDDLE) { result = getCategoryMiddle(category, categoryCount, adjustedArea, edge); } else if (anchor == CategoryAnchor.END) { result = getCategoryEnd(category, categoryCount, adjustedArea, edge); } return result; }
Example 19
Source File: CategoryAxis3D.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 20
Source File: CyclicNumberAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Draws the tick marks and labels. * * @param g2 the graphics device. * @param cursor the cursor. * @param plotArea the plot area. * @param dataArea the area inside the axes. * @param edge the side on which the axis is displayed. * @param info the plot rendering info. * * @return The axis state. */ protected AxisState drawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo info) { this.internalMarkerWhenTicksOverlap = false; AxisState ret = super.drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge, info); // continue and separate the labels only if necessary if (!this.internalMarkerWhenTicksOverlap) { return ret; } double ol = getTickMarkOutsideLength(); FontMetrics fm = g2.getFontMetrics(getTickLabelFont()); if (isVerticalTickLabels()) { ol = fm.getMaxAdvance(); } else { ol = fm.getHeight(); } double il = 0; if (isTickMarksVisible()) { float xx = (float) valueToJava2D(getRange().getUpperBound(), dataArea, edge); Line2D mark = null; g2.setStroke(getTickMarkStroke()); g2.setPaint(getTickMarkPaint()); if (edge == RectangleEdge.LEFT) { mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx); } else if (edge == RectangleEdge.RIGHT) { mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx); } else if (edge == RectangleEdge.TOP) { mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il); } else if (edge == RectangleEdge.BOTTOM) { mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il); } g2.draw(mark); } return ret; }