List of usage examples for java.awt Graphics2D setPaint
public abstract void setPaint(Paint paint);
From source file:org.tsho.dmc2.core.chart.LyapunovRenderer.java
public boolean renderVsTime(Graphics2D g2, Rectangle2D dataArea) { final int imageWidth = (int) dataArea.getWidth(); g2.setPaint(Color.red); final int timeStep; if (Math.abs(upper - lower) >= imageWidth) { timeStep = ((int) upper - (int) lower) / imageWidth; } else {/*from ww w .ja v a2s.com*/ timeStep = 1; } int prevX[] = new int[model.getNVar()]; int prevY[] = new int[model.getNVar()]; //? 14.7.2004 //LyapunovExpCalc lyapunovExpCalc; LuaLyapExp integrator = new LuaLyapExp(model, parameters, initialPoint); String colNames[] = new String[model.getNVar() + 1]; colNames[0] = "time"; for (int j = 1; j < model.getNVar() + 1; j++) colNames[j] = "" + (new Integer(j)); Dataset dataset = new Dataset(colNames); lyapunovComponent.setDataobject(dataset); double tmpRow[]; if (model instanceof ODE) { double step = stepSize; // stepSize and timeStep probably mean the same thing, one for discrete another for ODE //checking trajectory for (int i = 0; i < (int) (upper / stepSize); i++) { double[] result = new double[model.getNVar()]; int transX, transY; double[] temp = integrator.evaluateODEStep(step); double tt = integrator.getTime(); for (int h = 0; h < temp.length; h++) { result[h] = temp[h] / tt; } tmpRow = new double[model.getNVar() + 1]; tmpRow[0] = i; for (int a1 = 1; a1 < tmpRow.length; a1++) tmpRow[a1] = result[a1 - 1]; try { dataset.addRow(tmpRow); } catch (DatasetException de) { System.out.println("" + de); } for (int j = 0; j < result.length; j++) { if (Double.isNaN(result[j])) break; transX = (int) plot.getDomainAxis().valueToJava2D(i * stepSize, dataArea, RectangleEdge.BOTTOM); transY = (int) plot.getRangeAxis().valueToJava2D(result[j], dataArea, RectangleEdge.LEFT); g2.setPaint(paintSequence[j]); if (bigDots) { g2.fillRect(transX - 1, transY - 1, 3, 3); } else { g2.fillRect(transX, transY, 1, 1); } if (connectWithLines) { if (i > (int) lower) { g2.drawLine(transX, transY, prevX[j], prevY[j]); } prevX[j] = transX; prevY[j] = transY; } } if (stopped == true) { return false; } } } else {//? 14.7.2004 section of code above for (int i = (int) lower; i < (int) upper; i += timeStep) { double[] result = new double[model.getNVar()]; int transX, transY; result = Lua.evaluateLyapunovExponents(model, parameters, initialPoint, i); tmpRow = new double[model.getNVar() + 1]; tmpRow[0] = i; for (int a1 = 1; a1 < tmpRow.length; a1++) tmpRow[a1] = result[a1 - 1]; try { dataset.addRow(tmpRow); } catch (DatasetException de) { System.out.println("" + de); } for (int j = 0; j < result.length; j++) { if (Double.isNaN(result[j])) break; transX = (int) plot.getDomainAxis().valueToJava2D(i, dataArea, RectangleEdge.BOTTOM); transY = (int) plot.getRangeAxis().valueToJava2D(result[j], dataArea, RectangleEdge.LEFT); g2.setPaint(paintSequence[j]); if (bigDots) { g2.fillRect(transX - 1, transY - 1, 3, 3); } else { g2.fillRect(transX, transY, 1, 1); } if (connectWithLines) { if (i > (int) lower) { g2.drawLine(transX, transY, prevX[j], prevY[j]); } prevX[j] = transX; prevY[j] = transY; } } if (stopped == true) { return false; } } } //? } belongs to else 14.7.2004 return true; }
From source file:org.tsho.dmc2.core.chart.LyapunovRenderer.java
public boolean renderVsParameter(Graphics2D g2, Rectangle2D dataArea) { final int imageWidth = (int) dataArea.getWidth(); g2.setPaint(Color.red); final double parStep; int prevX[] = new int[model.getNVar()]; int prevY[] = new int[model.getNVar()]; //? 28.7.2004 ValueAxis domainAxis = plot.getDomainAxis(); lower = domainAxis.getRange().getLowerBound(); upper = domainAxis.getRange().getUpperBound(); parStep = Math.abs(upper - lower) / imageWidth; String colNames[] = new String[model.getNVar() + 1]; colNames[0] = firstParLabel;//ww w . jav a 2s . com for (int j = 1; j < (model.getNVar() + 1); j++) colNames[j] = "" + (new Integer(j)); Dataset dataset = new Dataset(colNames); lyapunovComponent.setDataobject(dataset); double tmpRow[]; if (model instanceof ODE) { double step = stepSize; // stepSize and timeStep probably mean the same thing, one for discrete another for ODE for (double i = lower; i < upper; i += parStep) { double[] result = new double[model.getNVar()];//initializing not needed but compiler too cautious. int transX, transY; parameters.put(firstParLabel, i); result = Lua.evaluateLyapunovExponentsODE(model, parameters, initialPoint, timePeriod, stepSize); tmpRow = new double[model.getNVar() + 1]; tmpRow[0] = i; for (int a1 = 1; a1 < tmpRow.length; a1++) tmpRow[a1] = result[a1 - 1]; try { dataset.addRow(tmpRow); } catch (DatasetException de) { System.out.println("" + de); } for (int j = 0; j < result.length; j++) { if (Double.isNaN(result[j])) break; transX = (int) plot.getDomainAxis().valueToJava2D(i, dataArea, RectangleEdge.BOTTOM); transY = (int) plot.getRangeAxis().valueToJava2D(result[j], dataArea, RectangleEdge.LEFT); g2.setPaint(paintSequence[j]); if (bigDots) { g2.fillRect(transX - 1, transY - 1, 3, 3); } else { g2.fillRect(transX, transY, 1, 1); } if (connectWithLines) { if (i != lower) { g2.drawLine(transX, transY, prevX[j], prevY[j]); } prevX[j] = transX; prevY[j] = transY; } } if (stopped == true) { return false; } } } //? 28.7.2004 else { for (double i = lower; i < upper; i += parStep) { double[] result; int transX, transY; parameters.put(firstParLabel, i); result = Lua.evaluateLyapunovExponents(model, parameters, initialPoint, iterations); tmpRow = new double[model.getNVar() + 1]; tmpRow[0] = i; for (int a1 = 1; a1 < tmpRow.length; a1++) tmpRow[a1] = result[a1 - 1]; try { dataset.addRow(tmpRow); } catch (DatasetException de) { System.out.println("" + de); } for (int j = 0; j < result.length; j++) { if (Double.isNaN(result[j])) break; transX = (int) plot.getDomainAxis().valueToJava2D(i, dataArea, RectangleEdge.BOTTOM); transY = (int) plot.getRangeAxis().valueToJava2D(result[j], dataArea, RectangleEdge.LEFT); g2.setPaint(paintSequence[j]); if (bigDots) { g2.fillRect(transX - 1, transY - 1, 3, 3); } else { g2.fillRect(transX, transY, 1, 1); } if (connectWithLines) { if (i != lower) { g2.drawLine(transX, transY, prevX[j], prevY[j]); } prevX[j] = transX; prevY[j] = transY; } } if (stopped == true) { return false; } } } return true; }
From source file:hudson.util.NoOverlapCategoryAxis.java
@Override protected AxisState drawCategoryLabels(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, AxisState state, PlotRenderingInfo plotState) { if (state == null) { throw new IllegalArgumentException("Null 'state' argument."); }// ww w . ja va 2s . c o m if (isTickLabelsVisible()) { java.util.List ticks = refreshTicks(g2, state, plotArea, edge); state.setTicks(ticks); // remember the last drawn label so that we can avoid drawing overlapping labels. Rectangle2D r = null; int categoryIndex = 0; Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { CategoryTick tick = (CategoryTick) iterator.next(); g2.setFont(getTickLabelFont(tick.getCategory())); g2.setPaint(getTickLabelPaint(tick.getCategory())); CategoryLabelPosition position = this.getCategoryLabelPositions().getLabelPosition(edge); double x0 = 0.0; double x1 = 0.0; double y0 = 0.0; double y1 = 0.0; if (edge == RectangleEdge.TOP) { x0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge); x1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge); y1 = state.getCursor() - this.getCategoryLabelPositionOffset(); y0 = y1 - state.getMax(); } else if (edge == RectangleEdge.BOTTOM) { x0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge); x1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge); y0 = state.getCursor() + this.getCategoryLabelPositionOffset(); y1 = y0 + state.getMax(); } else if (edge == RectangleEdge.LEFT) { y0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge); y1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge); x1 = state.getCursor() - this.getCategoryLabelPositionOffset(); x0 = x1 - state.getMax(); } else if (edge == RectangleEdge.RIGHT) { y0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge); y1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge); x0 = state.getCursor() + this.getCategoryLabelPositionOffset(); x1 = x0 - state.getMax(); } Rectangle2D area = new Rectangle2D.Double(x0, y0, (x1 - x0), (y1 - y0)); if (r == null || !r.intersects(area)) { Point2D anchorPoint = RectangleAnchor.coordinates(area, position.getCategoryAnchor()); TextBlock block = tick.getLabel(); block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getAngle()); Shape bounds = block.calculateBounds(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getAngle()); if (plotState != null && plotState.getOwner() != null) { EntityCollection entities = plotState.getOwner().getEntityCollection(); if (entities != null) { String tooltip = getCategoryLabelToolTip(tick.getCategory()); entities.add(new CategoryLabelEntity(tick.getCategory(), bounds, tooltip, null)); } } r = bounds.getBounds2D(); } categoryIndex++; } if (edge.equals(RectangleEdge.TOP)) { double h = state.getMax(); state.cursorUp(h); } else if (edge.equals(RectangleEdge.BOTTOM)) { double h = state.getMax(); state.cursorDown(h); } else if (edge == RectangleEdge.LEFT) { double w = state.getMax(); state.cursorLeft(w); } else if (edge == RectangleEdge.RIGHT) { double w = state.getMax(); state.cursorRight(w); } } return state; }
From source file:be.ugent.maf.cellmissy.gui.view.renderer.jfreechart.AngularHistogramRenderer.java
@Override public void drawSeries(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex) { // compute the right color for the paint int length = GuiUtils.getAvailableColors().length; Color color = GuiUtils.getAvailableColors()[index % length]; // get all the data points int numPoints = dataset.getItemCount(seriesIndex); for (int i = 0; i < numPoints; i++) { double theta = dataset.getXValue(seriesIndex, i); // the angle at the center double radius = dataset.getYValue(seriesIndex, i); // the frequency Point p0 = plot.translateToJava2D(0, 0, plot.getAxis(), dataArea); Point p1 = plot.translateToJava2D(theta - binSize, radius, plot.getAxis(), dataArea); Point p2 = plot.translateToJava2D(theta + binSize, radius, plot.getAxis(), dataArea); Polygon poly = new Polygon(new int[] { p0.x, p1.x, p2.x }, new int[] { p0.y, p1.y, p2.y }, 3); g2.setPaint(new Color(color.getRed(), color.getGreen(), color.getBlue(), 175)); g2.fill(poly);/*from ww w .j a v a 2s. c om*/ } }
From source file:org.proteosuite.FastScatterPlot.java
/** * Draws a representation of the data within the dataArea region. The * <code>info</code> and <code>crosshairState</code> arguments may be * <code>null</code>.//from w w w. j ava 2 s .c o m * * @param g2 the graphics device. * @param dataArea the region in which the data is to be drawn. * @param info an optional object for collection dimension information. * @param crosshairState collects crosshair information (<code>null</code> * permitted). */ public void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState) { //long start = System.currentTimeMillis(); //System.out.println("Start: " + start); g2.setPaint(this.paint); // if the axes use a linear scale, you can uncomment the code below and // switch to the alternative transX/transY calculation inside the loop // that follows - it is a little bit faster then. // // int xx = (int) dataArea.getMinX(); // int ww = (int) dataArea.getWidth(); // int yy = (int) dataArea.getMaxY(); // int hh = (int) dataArea.getHeight(); // double domainMin = this.domainAxis.getLowerBound(); // double domainLength = this.domainAxis.getUpperBound() - domainMin; // double rangeMin = this.rangeAxis.getLowerBound(); // double rangeLength = this.rangeAxis.getUpperBound() - rangeMin; if (this.data != null) { for (int i = 0; i < this.data[0].length; i++) { float x = this.data[0][i]; float y = this.data[1][i]; //int transX = (int) (xx + ww * (x - domainMin) / domainLength); //int transY = (int) (yy - hh * (y - rangeMin) / rangeLength); int transX = (int) this.domainAxis.valueToJava2D(x, dataArea, RectangleEdge.BOTTOM); int transY = (int) this.rangeAxis.valueToJava2D(y, dataArea, RectangleEdge.LEFT); g2.fillRect(transX, transY, 1, 1); } } //long finish = System.currentTimeMillis(); //System.out.println("Finish: " + finish); //System.out.println("Time: " + (finish - start)); }
From source file:gda.plots.SimpleXYItemRenderer.java
/** * Draws the visual representation of a single data item. This mostly reproduces the code of StandardXYItemRenderer * but using the line by line information stored in the SimpleXYSeries instead of the series indexed information * stored in the Renderer itself.//w ww . j a v a2s. co m * * @param g2 * the graphics device. * @param state * the renderer state. * @param dataArea * the area within which the data is being drawn. * @param info * collects information about the drawing. * @param plot * the plot (can be used to obtain standard color information etc). * @param domainAxis * the domain axis. * @param rangeAxis * the range axis. * @param dataset * the dataset. * @param series * the series index (zero-based). * @param item * the item index (zero-based). * @param crosshairState * crosshair information for the plot ( <code>null</code> permitted). * @param pass * the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { SimpleXYSeries sxys = (SimpleXYSeries) ((SimpleXYSeriesCollection) dataset).getSeries(series); if (!sxys.isVisible()) { return; } // setup for collecting optional entity info... Shape entityArea = null; EntityCollection entities = null; if (info != null) { entities = info.getOwner().getEntityCollection(); } PlotOrientation orientation = plot.getOrientation(); g2.setPaint(sxys.getPaint()); g2.setStroke(sxys.getStroke()); // get the data point double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); // Test x1 = xValueTransformer.transformValue(x1); if (Double.isNaN(x1) || Double.isNaN(y1)) { return; } RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation); if (sxys.isDrawLines()) { if (item > 0) { // get the previous data point... double x0 = dataset.getXValue(series, item - 1); double y0 = dataset.getYValue(series, item - 1); // Test // System.out.print("tranformed " + x0); x0 = xValueTransformer.transformValue(x0); // Message.debug(" to " + x0); if (!Double.isNaN(x0) && !Double.isNaN(y0)) { boolean drawLine = true; if (getPlotDiscontinuous()) { // only draw a line if the gap between the current and // previous data // point is within the threshold int numX = dataset.getItemCount(series); double minX = dataset.getXValue(series, 0); double maxX = dataset.getXValue(series, numX - 1); drawLine = (x1 - x0) <= ((maxX - minX) / numX * getGapThreshold()); } if (drawLine) { double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation); double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation); // only draw if we have good values if (Double.isNaN(transX0) || Double.isNaN(transY0) || Double.isNaN(transX1) || Double.isNaN(transY1)) { return; } if (orientation == PlotOrientation.HORIZONTAL) { state.workingLine.setLine(transY0, transX0, transY1, transX1); } else if (orientation == PlotOrientation.VERTICAL) { state.workingLine.setLine(transX0, transY0, transX1, transY1); } if (state.workingLine.intersects(dataArea)) { g2.draw(state.workingLine); } } } } } if (sxys.isDrawMarkers()) { Shape shape = sxys.getSymbol(); if (orientation == PlotOrientation.HORIZONTAL) { shape = ShapeUtilities.createTranslatedShape(shape, transY1, transX1); } else if (orientation == PlotOrientation.VERTICAL) { shape = ShapeUtilities.createTranslatedShape(shape, transX1, transY1); } if (shape.intersects(dataArea)) { g2.setPaint(sxys.getSymbolPaint()); // Always use full stroke for drawing marker g2.setStroke(new BasicStroke()); if (sxys.getFilled()) { g2.fill(shape); } else { g2.draw(shape); } g2.setPaint(sxys.getPaint()); g2.setStroke(sxys.getStroke()); } entityArea = shape; } if (getPlotImages()) { // use shape scale with transform?? // double scale = getShapeScale(plot, series, item, transX1, // transY1); Image image = getImage(plot, series, item, transX1, transY1); if (image != null) { Point hotspot = getImageHotspot(plot, series, item, transX1, transY1, image); g2.drawImage(image, (int) (transX1 - hotspot.getX()), (int) (transY1 - hotspot.getY()), null); entityArea = new Rectangle2D.Double(transX1 - hotspot.getX(), transY1 - hotspot.getY(), image.getWidth(null), image.getHeight(null)); } } // draw the item label if there is one... if (isItemLabelVisible(series, item)) { drawItemLabel(g2, orientation, dataset, series, item, transX1, transY1, (y1 < 0.0)); } updateCrosshairValues(crosshairState, x1, y1, transX1, transY1, orientation); // add an entity for the item... if (entities != null) { addEntity(entities, entityArea, dataset, series, item, transX1, transY1); } }
From source file:figs.treeVisualization.gui.PhyloDateAxis.java
/** * Draws the axis line, tick marks and tick mark labels. * /*w ww . j av a 2 s. c o m*/ * @param g2 the graphics device. * @param cursor the cursor. * @param plotArea the plot area. * @param dataArea the data area. * @param edge the edge that the axis is aligned with. * * * Original method is in <code>org.jfree.chart.axis.ValueAxis</code> */ protected void drawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D dataArea) { //AxisState state = new AxisState(cursor); RectangleEdge edge = RectangleEdge.RIGHT; drawAxisLine(g2, cursor, dataArea); double ol = getTickMarkOutsideLength(); double il = getTickMarkInsideLength(); // Their's miss the first and last label //List ticks = refreshTicks(g2, state, dataArea, edge); List ticks = refreshTicksVertical(g2, dataArea); g2.setFont(getTickLabelFont()); Iterator iterator = ticks.iterator(); while (iterator.hasNext()) { ValueTick tick = (ValueTick) iterator.next(); if (isTickLabelsVisible()) { g2.setPaint(getTickLabelPaint()); float[] anchorPoint = calculateAnchorPoint(tick, cursor, dataArea, edge); TextUtilities.drawRotatedString(tick.getText(), g2, anchorPoint[0], anchorPoint[1], tick.getTextAnchor(), tick.getAngle(), tick.getRotationAnchor()); } if (isTickMarksVisible()) { float xx = (float) valueToJava2D(tick.getValue(), 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); } } // end tick list iterator }
From source file:net.sf.fspdfs.chartthemes.spring.ScaledDialValueIndicator.java
/** * Draws the background to the specified graphics device. If the dial * frame specifies a window, the clipping region will already have been * set to this window before this method is called. * * @param g2 the graphics device (<code>null</code> not permitted). * @param plot the plot (ignored here). * @param frame the dial frame (ignored here). * @param view the view rectangle (<code>null</code> not permitted). *//*ww w .j a v a 2 s . c o m*/ public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) { // work out the anchor point Rectangle2D f = DialPlot.rectangleByRadius(frame, getRadius(), this.getRadius()); Arc2D arc = new Arc2D.Double(f, this.getAngle(), 0.0, Arc2D.OPEN); Point2D pt = arc.getStartPoint(); // calculate the bounds of the template value FontMetrics fm = g2.getFontMetrics(this.getFont()); String s = this.getNumberFormat().format(this.getTemplateValue()); Rectangle2D tb = TextUtilities.getTextBounds(s, g2, fm); // align this rectangle to the frameAnchor Rectangle2D bounds = RectangleAnchor.createRectangle(new Size2D(tb.getWidth(), tb.getHeight()), pt.getX(), pt.getY(), this.getFrameAnchor()); // add the insets Rectangle2D fb = this.getInsets().createOutsetRectangle(bounds); // draw the background g2.setPaint(this.getBackgroundPaint()); g2.fill(fb); // draw the border g2.setStroke(this.getOutlineStroke()); g2.setPaint(this.getOutlinePaint()); g2.draw(fb); // now find the text anchor point String valueStr = this.getNumberFormat() .format(ChartThemesUtilities.getScaledValue(plot.getValue(this.getDatasetIndex()), scale)); Point2D pt2 = RectangleAnchor.coordinates(bounds, this.getValueAnchor()); g2.setPaint(this.getPaint()); g2.setFont(this.getFont()); TextUtilities.drawAlignedString(valueStr, g2, (float) pt2.getX(), (float) pt2.getY(), this.getTextAnchor()); }
From source file:org.gumtree.vis.awt.CompositePanel.java
@Override public BufferedImage getImage() { BufferedImage image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D gc2 = image.createGraphics(); gc2.setBackground(Color.white); gc2.setPaint(Color.white); gc2.fill(new Rectangle2D.Double(0, 0, getWidth(), getHeight())); for (IPlot plot : plotList) { if (plot instanceof JPanel) { JPanel panel = (JPanel) plot; Rectangle2D panelBounds = panel.getBounds(); Image panelImage = plot.getImage(); gc2.drawImage(panelImage, (int) panelBounds.getMinX(), (int) panelBounds.getMinY(), panel); }//w ww.j a v a 2s. com } gc2.dispose(); return image; }
From source file:org.jfree.experimental.chart.plot.dial.StandardDialRange.java
/** * Draws the range.// w w w . j av a2s. c o m * * @param g2 the graphics target. * @param plot the plot. * @param frame the dial's reference frame (in Java2D space). * @param view the dial's view rectangle (in Java2D space). */ public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) { Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame, this.innerRadius, this.innerRadius); Rectangle2D arcRectOuter = DialPlot.rectangleByRadius(frame, this.outerRadius, this.outerRadius); //double range = this.upperBound - this.lowerBound; DialScale scale = plot.getScaleForDataset(0); double angleMin = scale.valueToAngle(this.lowerBound); double angleMax = scale.valueToAngle(this.upperBound); Arc2D arcInner = new Arc2D.Double(arcRectInner, angleMin, angleMax - angleMin, Arc2D.OPEN); Arc2D arcOuter = new Arc2D.Double(arcRectOuter, angleMax, angleMin - angleMax, Arc2D.OPEN); g2.setPaint(this.paint); g2.setStroke(new BasicStroke(2.0f)); g2.draw(arcInner); g2.draw(arcOuter); }