org.jfree.chart.renderer.xy.XYItemRendererState Java Examples
The following examples show how to use
org.jfree.chart.renderer.xy.XYItemRendererState.
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: ExcitationRenderer.java From opensim-gui with Apache License 2.0 | 6 votes |
public void drawFunctions(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, CrosshairState crosshairState) { if (fillMode == ExcitationFillMode.MIN_MAX) { fillMinMax(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset); } else if (fillMode == ExcitationFillMode.MIN_MAX_EXC) { fillMinMaxExc(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset); } super.drawFunctions(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, crosshairState); }
Example #2
Source File: ExcitationRenderer.java From opensim-gui with Apache License 2.0 | 6 votes |
public void fillMinMaxExc(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset) { if (dataset.getSeriesCount() < 3) return; if (maxFillPaint != null) { fillSeries(2, maxFillPaint, g2, state, dataArea, plot, domainAxis, rangeAxis, dataset); } if (excFillPaint != null) { fillSeries(0, excFillPaint, g2, state, dataArea, plot, domainAxis, rangeAxis, dataset); } if (minFillPaint != null) { fillSeries(1, minFillPaint, g2, state, dataArea, plot, domainAxis, rangeAxis, dataset); } }
Example #3
Source File: CustomXYAreaRenderer.java From openbd-core with GNU General Public License v3.0 | 5 votes |
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) { super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); // The complete area chart is drawn when drawItem() is called for the last // item // so we need to draw all of the item labels after the last item so they'll // be // visible if they overlap the area chart. int itemCount = dataset.getItemCount(series); if (getPlotArea() && item > 0 && item == (itemCount - 1)) { // this is the last item so draw the item labels PlotOrientation orientation = plot.getOrientation(); for (int i = 0; i < itemCount; i++) { if (isItemLabelVisible(series, i)) { double xValue = dataset.getXValue(series, i); double yValue = dataset.getYValue(series, i); if (Double.isNaN(yValue)) { yValue = 0.0; } double transXValue = domainAxis.valueToJava2D(xValue, dataArea, plot.getDomainAxisEdge()); double transYValue = rangeAxis.valueToJava2D(yValue, dataArea, plot.getRangeAxisEdge()); double xx = transXValue; double yy = transYValue; if (orientation == PlotOrientation.HORIZONTAL) { xx = transYValue; yy = transXValue; } drawItemLabel(g2, orientation, dataset, series, i, xx, yy, (yValue < 0.0)); } } } }
Example #4
Source File: ScatterPlotRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
public void drawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { if (series == 0) g2.setComposite(pointAlpha); else g2.setComposite(selectionAlpha); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #5
Source File: DiagonalLineRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info) { // Set transparency g2.setComposite(alpha); return super.initialise(g2, dataArea, plot, dataset, info); }
Example #6
Source File: NeutralLossDataPointRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
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) { if (series > 0) { g2.setComposite(alphaComp); } else if (series == 0) { g2.setComposite(alphaCompOriginal); } super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #7
Source File: ProductIonFilterDataPointRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
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) { if (series > 0) { g2.setComposite(alphaComp); } else if (series == 0) { g2.setComposite(alphaCompOriginal); } super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #8
Source File: PeakTICPlotRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
@Override public void drawItem(final Graphics2D g2, final XYItemRendererState state, final Rectangle2D dataArea, final PlotRenderingInfo info, final XYPlot plot, final ValueAxis domainAxis, final ValueAxis rangeAxis, final XYDataset dataSet, final int series, final int item, final CrosshairState crosshairState, final int pass) { g2.setComposite(makeComposite(OPACITY)); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataSet, series, item, crosshairState, pass); }
Example #9
Source File: CustomXYStepRenderer.java From openbd-core with GNU General Public License v3.0 | 5 votes |
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) { super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); // draw the item label if there is one... if (isItemLabelVisible(series, item)) { // get the data point... double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); if (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); double xx = transX1; double yy = transY1; PlotOrientation orientation = plot.getOrientation(); if (orientation == PlotOrientation.HORIZONTAL) { xx = transY1; yy = transX1; } drawItemLabel(g2, orientation, dataset, series, item, xx, yy, (y1 < 0.0)); } }
Example #10
Source File: PeakRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
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) { if (isTransparent) g2.setComposite(alphaComp); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #11
Source File: ContinuousRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
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) { if (isTransparent) g2.setComposite(alphaComp); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #12
Source File: PseudoSpectraRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
@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) { if (isTransparent) g2.setComposite(alphaComp); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #13
Source File: ScatterPlotRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
public void drawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { if (series == 0) g2.setComposite(pointAlpha); else g2.setComposite(selectionAlpha); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #14
Source File: DiagonalLineRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info) { // Set transparency g2.setComposite(alpha); return super.initialise(g2, dataArea, plot, dataset, info); }
Example #15
Source File: PeakTICPlotRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public void drawItem(final Graphics2D g2, final XYItemRendererState state, final Rectangle2D dataArea, final PlotRenderingInfo info, final XYPlot plot, final ValueAxis domainAxis, final ValueAxis rangeAxis, final XYDataset dataSet, final int series, final int item, final CrosshairState crosshairState, final int pass) { g2.setComposite(makeComposite(OPACITY)); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataSet, series, item, crosshairState, pass); }
Example #16
Source File: FunctionPlot.java From opensim-gui with Apache License 2.0 | 5 votes |
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index, PlotRenderingInfo info, CrosshairState crosshairState) { FunctionRenderer renderer = (FunctionRenderer)getRenderer(index); XYDataset dataset = getDataset(index); ValueAxis xAxis = getDomainAxisForDataset(index); ValueAxis yAxis = getRangeAxisForDataset(index); XYItemRendererState state = renderer.initialise(g2, dataArea, this, dataset, info); renderer.drawFunctions(g2, state, dataArea, this, xAxis, yAxis, dataset, crosshairState); return true; }
Example #17
Source File: PseudoSpectraRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@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) { if (isTransparent) g2.setComposite(alphaComp); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #18
Source File: NeutralLossDataPointRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
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) { if (series > 0) { g2.setComposite(alphaComp); } else if (series == 0) { g2.setComposite(alphaCompOriginal); } super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #19
Source File: ProductIonFilterDataPointRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
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) { if (series > 0) { g2.setComposite(alphaComp); } else if (series == 0) { g2.setComposite(alphaCompOriginal); } super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #20
Source File: CombinedModuleDataPointRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
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) { if (series > 0) { g2.setComposite(alphaComp); } else if (series == 0) { g2.setComposite(alphaCompOriginal); } double x=dataset.getXValue(series, item); Paint p=this.paintScale.getPaint(x); g2.setPaint(p); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #21
Source File: PeakRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
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) { if (isTransparent) g2.setComposite(alphaComp); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #22
Source File: ContinuousRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
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) { if (isTransparent) g2.setComposite(alphaComp); super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass); }
Example #23
Source File: ExcitationRenderer.java From opensim-gui with Apache License 2.0 | 4 votes |
public void fillSeries(int series, Paint paint, Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset) { int itemCount = dataset.getItemCount(series); if (itemCount > 1) { double screenX=0.0, screenY=0.0; float minX1=0.0f, minX2=0.0f, minY1=0.0f, minY2=0.0f; float maxX1=-1.0f, maxX2=0.0f, maxY1=0.0f, maxY2=0.0f; RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); State s = (State) state; s.seriesPath.reset(); s.setLastPointGood(false); double dataX = dataset.getX(series, itemCount-1).doubleValue() * XUnits.convertTo(XDisplayUnits); double dataY = 0.0; screenX = domainAxis.valueToJava2D(dataX, dataArea, xAxisLocation); screenY = rangeAxis.valueToJava2D(dataY, dataArea, yAxisLocation); // store the first border point for later call to 'draw' minX2 = (float)screenX; minY2 = (float)screenY; s.seriesPath.moveTo((float)screenX, (float)screenY); s.setLastPointGood(true); dataX = dataset.getX(series, 0).doubleValue() * XUnits.convertTo(XDisplayUnits); screenX = domainAxis.valueToJava2D(dataX, dataArea, xAxisLocation); // store the second border point for later call to 'draw' minX1 = (float)screenX; minY1 = (float)screenY; s.seriesPath.lineTo((float)screenX, (float)screenY); for (int item = 0; item < itemCount-1; item++) { ArrayXYPoint xyPts = functionList.get(series).renderAsLineSegments(item); if (xyPts != null) { for (int i = 0; i < xyPts.getSize(); i++) { dataX = xyPts.get(i).get_x() * XUnits.convertTo(XDisplayUnits); dataY = xyPts.get(i).get_y() * YUnits.convertTo(YDisplayUnits); screenX = domainAxis.valueToJava2D(dataX, dataArea, xAxisLocation); screenY = rangeAxis.valueToJava2D(dataY, dataArea, yAxisLocation); if (!Double.isNaN(screenX) && !Double.isNaN(screenY)) { if (maxX1 < 0.0) { // store the third border point for later call to 'draw' maxX1 = (float)screenX; maxY1 = (float)screenY; } s.seriesPath.lineTo((float)screenX, (float)screenY); } } functionList.get(series).deleteXYPointArray(xyPts); } } // store the fourth border point for later call to 'draw' maxX2 = (float)screenX; maxY2 = (float)screenY; g2.setPaint(paint); g2.fill(s.seriesPath); // Draw a line connecting the first point of the min curve to the // first point of the max curve, so that the region looks more "filled-in". // Also draw a line connecting the last points. g2.setStroke(getItemStroke(series, 0)); s.seriesPath.reset(); s.setLastPointGood(false); s.seriesPath.moveTo(minX1, minY1); s.seriesPath.lineTo(maxX1, maxY1); g2.draw(s.seriesPath); s.seriesPath.reset(); s.setLastPointGood(false); s.seriesPath.moveTo(minX2, minY2); s.seriesPath.lineTo(maxX2, maxY2); g2.draw(s.seriesPath); } }
Example #24
Source File: XYDotRenderer.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Draws the visual representation of a single data item. * * @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 (horizontal) axis. * @param rangeAxis the range (vertical) 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. */ public void drawItem( final Graphics2D g2, final XYItemRendererState state, final Rectangle2D dataArea, final PlotRenderingInfo info, final XYPlot plot, final ValueAxis domainAxis, final ValueAxis rangeAxis, final XYDataset dataset, final int series, final int item, final CrosshairState crosshairState, final int pass ) { // get the data point... final double x = dataset.getXValue( series, item ); final double y = dataset.getYValue( series, item ); final double adjx = ( this.dotWidth - 1 ) / 2.0; final double adjy = ( this.dotHeight - 1 ) / 2.0; if ( !Double.isNaN( y ) ) { final RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); final RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); final double transX = domainAxis.valueToJava2D( x, dataArea, xAxisLocation ) - adjx; final double transY = rangeAxis.valueToJava2D( y, dataArea, yAxisLocation ) - adjy; g2.setPaint( getItemPaint( series, item ) ); final PlotOrientation orientation = plot.getOrientation(); final Shape s; if ( orientation == PlotOrientation.HORIZONTAL ) { //noinspection SuspiciousNameCombination s = new Rectangle2D.Double( transY, transX, this.dotHeight, this.dotWidth ); } else if ( orientation == PlotOrientation.VERTICAL ) { s = new Rectangle2D.Double( transX, transY, this.dotWidth, this.dotHeight ); } else { throw new IllegalStateException( "PlotOrientation is neither Horizontal nor Vertical" ); } g2.fill( s ); final int domainAxisIndex = plot.getDomainAxisIndex( domainAxis ); final int rangeAxisIndex = plot.getRangeAxisIndex( rangeAxis ); updateCrosshairValues( crosshairState, x, y, domainAxisIndex, rangeAxisIndex, transX, transY, orientation ); // collect entity and tool tip information... if ( state.getInfo() != null ) { final EntityCollection entities = state.getEntityCollection(); if ( entities != null ) { String tip = null; final XYToolTipGenerator generator = getToolTipGenerator( series, item ); if ( generator != null ) { tip = generator.generateToolTip( dataset, series, item ); } String url = null; if ( getURLGenerator() != null ) { url = getURLGenerator().generateURL( dataset, series, item ); } final XYItemEntity entity = new XYItemEntity( s, dataset, series, item, tip, url ); entities.add( entity ); } } } }
Example #25
Source File: XYSmoothLineAndShapeRenderer.java From astor with GNU General Public License v2.0 | 4 votes |
protected void drawPrimaryLine(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset, int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) { if (item == 0) { return; } // get the data point... double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); if (Double.isNaN(y1) || Double.isNaN(x1)) { return; } double x0 = dataset.getXValue(series, item - 1); double y0 = dataset.getYValue(series, item - 1); if (Double.isNaN(y0) || Double.isNaN(x0)) { return; } RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation); double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation); double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation); // only draw if we have good values if (Double.isNaN(transX0) || Double.isNaN(transY0) || Double.isNaN(transX1) || Double.isNaN(transY1)) { return; } Point2D.Double point0 = new Point2D.Double(); Point2D.Double point1 = new Point2D.Double(); Point2D.Double point2 = new Point2D.Double(); Point2D.Double point3 = new Point2D.Double(); if (item == 1) { point0 = null; } else { point0.x = domainAxis.valueToJava2D(dataset.getXValue(series, item - 2), dataArea, xAxisLocation); point0.y = rangeAxis.valueToJava2D(dataset.getYValue(series, item - 2), dataArea, yAxisLocation); } point1.x = transX0; point1.y = transY0; point2.x = transX1; point2.y = transY1; if ((item + 1) == dataset.getItemCount(series)) { point3 = null; } else { point3.x = domainAxis.valueToJava2D(dataset.getXValue(series, item + 1), dataArea, xAxisLocation); point3.y = rangeAxis.valueToJava2D(dataset.getYValue(series, item + 1), dataArea, yAxisLocation); } int steps = ((int) ((point2.x - point1.x) / 0.2) < 30) ? (int) ((point2.x - point1.x) / 0.2) : 30; Point2D.Double[] points = getBezierCurve(point0, point1, point2, point3, 1, steps); for (int i = 1; i < points.length; i++) { transX0 = points[i - 1].x; transY0 = points[i - 1].y; transX1 = points[i].x; transY1 = points[i].y; PlotOrientation orientation = plot.getOrientation(); 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)) { drawFirstPassShape(g2, pass, series, item, state.workingLine); } } }
Example #26
Source File: BubbleRenderer.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Draws the visual representation of a single data item. * * @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 (horizontal) axis. * @param rangeAxis the range (vertical) axis. * @param dataset the dataset (an {@link XYZDataset} is expected). * @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. */ public void drawItem( final Graphics2D g2, final XYItemRendererState state, final Rectangle2D dataArea, final PlotRenderingInfo info, final XYPlot plot, final ValueAxis domainAxis, final ValueAxis rangeAxis, final XYDataset dataset, final int series, final int item, final CrosshairState crosshairState, final int pass ) { final PlotOrientation orientation = plot.getOrientation(); // get the data point... final double x = dataset.getXValue( series, item ); final double y = dataset.getYValue( series, item ); double z = Double.NaN; if ( dataset instanceof XYZDataset ) { final XYZDataset xyzData = (XYZDataset) dataset; z = xyzData.getZValue( series, item ); } if ( !Double.isNaN( z ) ) { final RectangleEdge domainAxisLocation = plot.getDomainAxisEdge(); final RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge(); final double transX = domainAxis.valueToJava2D( x, dataArea, domainAxisLocation ); final double transY = rangeAxis.valueToJava2D( y, dataArea, rangeAxisLocation ); double circleSize; circleSize = maxSize * ( z / maxZ ); circleSize = Math.abs( circleSize ); Ellipse2D circle = null; if ( orientation == PlotOrientation.VERTICAL ) { circle = new Ellipse2D.Double( transX - circleSize / 2.0, transY - circleSize / 2.0, circleSize, circleSize ); } else if ( orientation == PlotOrientation.HORIZONTAL ) { circle = new Ellipse2D.Double( transY - circleSize / 2.0, transX - circleSize / 2.0, circleSize, circleSize ); } g2.setPaint( getItemPaint( series, item ) ); g2.fill( circle ); g2.setStroke( getItemOutlineStroke( series, item ) ); g2.setPaint( getItemOutlinePaint( series, item ) ); g2.draw( circle ); if ( isItemLabelVisible( series, item ) ) { if ( orientation == PlotOrientation.VERTICAL ) { drawItemLabel( g2, orientation, dataset, series, item, transX, transY, false ); } else if ( orientation == PlotOrientation.HORIZONTAL ) { drawItemLabel( g2, orientation, dataset, series, item, transY, transX, false ); } } // setup for collecting optional entity info... EntityCollection entities = null; if ( info != null ) { entities = info.getOwner().getEntityCollection(); } // add an entity for the item... if ( entities != null ) { String tip = null; final XYToolTipGenerator generator = getToolTipGenerator( series, item ); if ( generator != null ) { tip = generator.generateToolTip( dataset, series, item ); } String url = null; if ( getURLGenerator() != null ) { url = getURLGenerator().generateURL( dataset, series, item ); } final XYItemEntity entity = new XYItemEntity( circle, dataset, series, item, tip, url ); entities.add( entity ); } final int domainAxisIndex = plot.getDomainAxisIndex( domainAxis ); final int rangeAxisIndex = plot.getRangeAxisIndex( rangeAxis ); updateCrosshairValues( crosshairState, x, y, domainAxisIndex, rangeAxisIndex, transX, transY, orientation ); } }
Example #27
Source File: XYBlockPixelSizeRenderer.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
/** * Draws the block representing the specified item. * * @param g2 the graphics device. * @param state the state. * @param dataArea the data area. * @param info the plot rendering info. * @param plot the plot. * @param domainAxis the x-axis. * @param rangeAxis the y-axis. * @param dataset the dataset. * @param series the series index. * @param item the item index. * @param crosshairState the crosshair state. * @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) { double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); double z = 0.0; if (dataset instanceof XYZDataset) { z = ((XYZDataset) dataset).getZValue(series, item); } Paint p = this.paintScale.getPaint(z); double xx0 = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double yy0 = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); double xx1 = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double yy1 = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); Rectangle2D block; PlotOrientation orientation = plot.getOrientation(); if (orientation.equals(PlotOrientation.HORIZONTAL)) { block = new Rectangle2D.Double(Math.min(yy0, yy1), Math.min(xx0, xx1), blockWidthPixel, blockHeightPixel); } else { block = new Rectangle2D.Double(Math.min(xx0, xx1), Math.min(yy0, yy1), blockWidthPixel, blockHeightPixel); } g2.setPaint(p); g2.fill(block); g2.setStroke(new BasicStroke(1.0f)); g2.draw(block); if (isItemLabelVisible(series, item)) { drawItemLabel(g2, orientation, dataset, series, item, block.getCenterX(), block.getCenterY(), y < 0.0); } int datasetIndex = plot.indexOf(dataset); double transX = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double transY = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); updateCrosshairValues(crosshairState, x, y, datasetIndex, transX, transY, orientation); EntityCollection entities = state.getEntityCollection(); if (entities != null) { addEntity(entities, block, dataset, series, item, block.getCenterX(), block.getCenterY()); } }
Example #28
Source File: ColorizedShapeItemRenderer.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Draws the block representing the specified item. * * @param g2 * the graphics device. * @param state * the state. * @param dataArea * the data area. * @param info * the plot rendering info. * @param plot * the plot. * @param domainAxis * the x-axis. * @param rangeAxis * the y-axis. * @param dataset * the dataset. * @param series * the series index. * @param item * the item index. * @param crosshairState * the crosshair state. * @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) { Shape hotspot = null; EntityCollection entities = null; if (info != null) { entities = info.getOwner().getEntityCollection(); } double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); double colorValue = ((XYZDataset) dataset).getZValue(series, item); double normalized = (colorValue - minColor) / (maxColor - minColor); if (Double.isNaN(x) || Double.isNaN(y)) { // can't draw anything return; } double transX = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double transY = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); PlotOrientation orientation = plot.getOrientation(); Shape shape = getItemShape(series, item); if (orientation == PlotOrientation.HORIZONTAL) { shape = ShapeUtilities.createTranslatedShape(shape, transY, transX); } else if (orientation == PlotOrientation.VERTICAL) { shape = ShapeUtilities.createTranslatedShape(shape, transX, transY); } hotspot = shape; if (shape.intersects(dataArea)) { g2.setPaint(colorProvider.getPointColor(normalized)); g2.fill(shape); if (getDrawOutlines()) { if (getUseOutlinePaint()) { g2.setPaint(getItemOutlinePaint(series, item)); } else { g2.setPaint(getItemPaint(series, item)); } g2.setStroke(getItemOutlineStroke(series, item)); g2.draw(shape); } } // add an entity for the item... if (entities != null) { addEntity(entities, hotspot, dataset, series, item, transX, transY); } }
Example #29
Source File: XYBlockPixelSizeRenderer.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
/** * Draws the block representing the specified item. * * @param g2 the graphics device. * @param state the state. * @param dataArea the data area. * @param info the plot rendering info. * @param plot the plot. * @param domainAxis the x-axis. * @param rangeAxis the y-axis. * @param dataset the dataset. * @param series the series index. * @param item the item index. * @param crosshairState the crosshair state. * @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) { double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); double z = 0.0; if (dataset instanceof XYZDataset) { z = ((XYZDataset) dataset).getZValue(series, item); } Paint p = this.paintScale.getPaint(z); double xx0 = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double yy0 = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); double xx1 = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double yy1 = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); Rectangle2D block; PlotOrientation orientation = plot.getOrientation(); if (orientation.equals(PlotOrientation.HORIZONTAL)) { block = new Rectangle2D.Double(Math.min(yy0, yy1), Math.min(xx0, xx1), blockWidthPixel, blockHeightPixel); } else { block = new Rectangle2D.Double(Math.min(xx0, xx1), Math.min(yy0, yy1), blockWidthPixel, blockHeightPixel); } g2.setPaint(p); g2.fill(block); g2.setStroke(new BasicStroke(1.0f)); g2.draw(block); if (isItemLabelVisible(series, item)) { drawItemLabel(g2, orientation, dataset, series, item, block.getCenterX(), block.getCenterY(), y < 0.0); } int datasetIndex = plot.indexOf(dataset); double transX = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double transY = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); updateCrosshairValues(crosshairState, x, y, datasetIndex, transX, transY, orientation); EntityCollection entities = state.getEntityCollection(); if (entities != null) { addEntity(entities, block, dataset, series, item, block.getCenterX(), block.getCenterY()); } }
Example #30
Source File: TICPlotRenderer.java From mzmine2 with GNU General Public License v2.0 | 3 votes |
protected void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset, int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) { g2.setComposite(makeComposite(transparency)); super.drawPrimaryLineAsPath(state, g2, plot, dataset, pass, series, item, domainAxis, rangeAxis, dataArea); }