List of usage examples for org.jfree.chart.plot XYPlot getDomainAxisEdge
public RectangleEdge getDomainAxisEdge()
From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java
private int getHandleCoordinate() { Rectangle2D plotArea = getChartPanel().getScreenDataArea(); XYPlot plot = (XYPlot) getAdvancedGraph().getPlot(); int handleCoordinate = new Float( plot.getDomainAxis().valueToJava2D(getCrosshair(), plotArea, plot.getDomainAxisEdge())).intValue(); return handleCoordinate; // handleCoordinate+100; }
From source file:net.sf.maltcms.chromaui.charts.renderer.XYNoBlockRenderer.java
/** * Draws the block representing the specified item. * * @param g2 the graphics device.//from www . j a v a 2s.c om * @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) { // return; 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); if (entityThreshold != Double.NaN && z < entityThreshold) { return; } } //} Paint p = getPaintScale().getPaint(z); // if(p.equals(getPaintScale().getPaint(getPaintScale().getLowerBound()))) { // return; // } // double xx0 = domainAxis.valueToJava2D(x + xOffset, dataArea, // plot.getDomainAxisEdge()); // double yy0 = rangeAxis.valueToJava2D(y + yOffset, dataArea, // plot.getRangeAxisEdge()); // double xx1 = domainAxis.valueToJava2D(x + blockWidth // + xOffset, dataArea, plot.getDomainAxisEdge()); // double yy1 = rangeAxis.valueToJava2D(y + blockHeight // + yOffset, dataArea, plot.getRangeAxisEdge()); double xx0 = domainAxis.valueToJava2D(x - getBlockWidth() / 2, dataArea, plot.getDomainAxisEdge()); double yy0 = rangeAxis.valueToJava2D(y - getBlockHeight() / 2, dataArea, plot.getRangeAxisEdge()); double xx1 = domainAxis.valueToJava2D(x + getBlockWidth() / 2, dataArea, plot.getDomainAxisEdge()); double yy1 = rangeAxis.valueToJava2D(y + getBlockHeight() / 2, dataArea, plot.getRangeAxisEdge()); Rectangle2D block; PlotOrientation orientation = plot.getOrientation(); if (orientation.equals(PlotOrientation.HORIZONTAL)) { if (dataArea.contains(Math.min(yy0, yy1), Math.min(xx0, xx1), Math.abs(yy1 - yy0), Math.abs(xx0 - xx1))) { block = new Rectangle2D.Double(Math.min(yy0, yy1), Math.min(xx0, xx1), Math.abs(yy1 - yy0), Math.abs(xx0 - xx1)); } else { return; } } else { if (dataArea.contains(Math.min(xx0, xx1), Math.min(yy0, yy1), Math.abs(xx1 - xx0), Math.abs(yy0 - yy1))) { block = new Rectangle2D.Double(Math.min(xx0, xx1), Math.min(yy0, yy1), Math.abs(xx1 - xx0), Math.abs(yy0 - yy1)); } else { return; } } g2.setPaint(p); g2.fill(block); g2.setStroke(new BasicStroke(1.0f)); g2.draw(block); EntityCollection entities = state.getEntityCollection(); // System.out.println("Entity collection is of type: "+entities.getClass()); if (entities != null) { //System.out.println("Adding entity"); addEntity(entities, block, dataset, series, item, block.getCenterX(), block.getCenterY()); } }
From source file:org.schreibubi.JCombinations.jfreechart.XYLineAndShapeRendererExtended.java
/** * Draws a horizontal line across the chart to represent a 'range marker'. * // w w w .ja v a2s. com * @param g2 * the graphics device. * @param plot * the plot. * @param rangeAxis * the range axis. * @param marker * the marker line. * @param dataArea * the axis data area. */ @Override public void drawRangeMarker(Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea) { if (marker instanceof ValueMarker) super.drawRangeMarker(g2, plot, rangeAxis, marker, dataArea); else if (marker instanceof IntervalMarker) super.drawRangeMarker(g2, plot, rangeAxis, marker, dataArea); else if (marker instanceof ArbitraryMarker) { ArbitraryMarker im = (ArbitraryMarker) marker; ArrayList<Double> xvals = im.getDomainVal(); ArrayList<Double> lows = im.getRangeLowValues(); ArrayList<Double> highs = im.getRangeHighValues(); sort(xvals, lows, highs); Range range = rangeAxis.getRange(); ValueAxis domainAxis = plot.getDomainAxis(); Range domain = domainAxis.getRange(); int length = xvals.size(); int[] xpoly = new int[length * 2]; int[] ypoly = new int[length * 2]; for (int i = 0; i < xvals.size(); i++) { double x = domain.constrain(xvals.get(i)); double low = range.constrain(lows.get(i)); double high = range.constrain(highs.get(i)); int low2d = (int) Math.round(rangeAxis.valueToJava2D(low, dataArea, plot.getRangeAxisEdge())); int high2d = (int) Math.round(rangeAxis.valueToJava2D(high, dataArea, plot.getRangeAxisEdge())); int x2d = (int) Math.round(domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge())); xpoly[i] = x2d; xpoly[2 * length - 1 - i] = x2d; ypoly[i] = low2d; ypoly[2 * length - 1 - i] = high2d; } PlotOrientation orientation = plot.getOrientation(); Polygon poly = null; if (orientation == PlotOrientation.HORIZONTAL) poly = new Polygon(ypoly, xpoly, length * 2); else if (orientation == PlotOrientation.VERTICAL) poly = new Polygon(xpoly, ypoly, length * 2); Paint p = im.getPaint(); if (p instanceof GradientPaint) { GradientPaint gp = (GradientPaint) p; GradientPaintTransformer t = im.getGradientPaintTransformer(); if (t != null) gp = t.transform(gp, poly); g2.setPaint(gp); } else g2.setPaint(p); g2.fill(poly); /* * String label = marker.getLabel(); RectangleAnchor anchor = marker.getLabelAnchor(); if ( label != null ) { * Font labelFont = marker.getLabelFont(); g2.setFont( labelFont ); g2.setPaint( marker.getLabelPaint() ); * Point2D coordinates = calculateRangeMarkerTextAnchorPoint( g2, orientation, dataArea, poly, * marker.getLabelOffset(), marker.getLabelOffsetType(), anchor ); TextUtilities.drawAlignedString( label, * g2, ( float ) coordinates.getX(), ( float ) coordinates.getY(), marker.getLabelTextAnchor() ); } */ } }
From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java
@Override public void chartMouseClicked(ChartMouseEvent chartmouseevent) { Point2D point = chartmouseevent.getTrigger().getPoint(); Rectangle2D plotArea = getChartPanel().getScreenDataArea(); XYPlot plot = (XYPlot) getAdvancedGraph().getPlot(); final double lastChartX = new Double( plot.getDomainAxis().java2DToValue(point.getX(), plotArea, plot.getDomainAxisEdge())); // setCrossHair(lastChartX); // SwingUtilities.invokeLater(new Runnable() { // @Override/*from www . j a v a 2s.c o m*/ // public void run() { // setCrossHair(lastChartX); // } // }); for (GraphPanelListener gpl : listeners) { gpl.graphPanelClicked(lastChartX); /* New added @Tinbit */ ChartEntity entity = chartmouseevent.getEntity(); if (entity instanceof XYItemEntity) { XYItemEntity xyItem = (XYItemEntity) entity; XYDataset xyDataset = xyItem.getDataset(); int seriesIndex = xyItem.getSeriesIndex(); int itemIndex = xyItem.getItem(); double xDataValue = xyDataset.getXValue(seriesIndex, itemIndex); double yDataValue = xyDataset.getYValue(seriesIndex, itemIndex); Map<Integer, VideoEvent> veSegment = vcPlot.getChunk(xDataValue); int indexKey = 0; if (vcPlot.isDataItemPoint(xDataValue, yDataValue)) { if (veSegment != null) { for (int key : veSegment.keySet()) { // String value="Chunk "+(key+1)+" at // "+String.format("%.2f", // veSegment.get(key).getDLTimeStamp())+"S"; chunkInfo.put(key, veSegment.get(key)); // chunkInfo.add(value); } indexKey = (int) veSegment.keySet().toArray()[0]; } launchSliderDialog(indexKey); } else if (vcPlot.getBufferTimePlot().isDataItemStallPoint(xDataValue, yDataValue) != null) { VideoEvent segmentToPlay = vcPlot.getBufferTimePlot().isDataItemStallPoint(xDataValue, yDataValue); veSegment = vcPlot.getSegmentToPlayLocation(segmentToPlay); if (veSegment != null) { for (int key : veSegment.keySet()) { chunkInfo.put(key, veSegment.get(key)); } indexKey = (int) veSegment.keySet().toArray()[0]; } launchSliderDialog(indexKey); } } } }
From source file:org.yccheok.jstock.gui.charting.ChartLayerUI.java
private boolean _updateMainTraceInfoForCandlestick(Point2D point) { if (point == null) { return false; }/* w w w. ja va 2 s . co m*/ final ChartPanel chartPanel = this.chartJDialog.getChartPanel(); // Top most plot. final XYPlot plot = this.chartJDialog.getPlot(); final org.jfree.data.xy.DefaultHighLowDataset defaultHighLowDataset = (org.jfree.data.xy.DefaultHighLowDataset) plot .getDataset(); // I also not sure why. This is what are being done in Mouse Listener Demo 4. // // Don't use it. It will cause us to lose precision. //final Point2D p2 = chartPanel.translateScreenToJava2D((Point)point); /* Try to get correct main chart area. */ final Rectangle2D _plotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(0) .getDataArea(); final ValueAxis domainAxis = plot.getDomainAxis(); final RectangleEdge domainAxisEdge = plot.getDomainAxisEdge(); final ValueAxis rangeAxis = plot.getRangeAxis(); final RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge(); // Don't use it. It will cause us to lose precision. //final double coordinateX = domainAxis.java2DToValue(p2.getX(), _plotArea, // domainAxisEdge); final double coordinateX = domainAxis.java2DToValue(point.getX(), _plotArea, domainAxisEdge); //double coordinateY = rangeAxis.java2DToValue(mousePoint2.getY(), plotArea, // rangeAxisEdge); int low = 0; int high = defaultHighLowDataset.getItemCount(0) - 1; Date date = new Date((long) coordinateX); final long time = date.getTime(); long bestDistance = Long.MAX_VALUE; int bestMid = 0; while (low <= high) { int mid = (low + high) >>> 1; final Date d = defaultHighLowDataset.getXDate(0, mid); final long search = d.getTime(); final long cmp = search - time; if (cmp < 0) { low = mid + 1; } else if (cmp > 0) { high = mid - 1; } else { bestDistance = 0; bestMid = mid; break; } final long abs_cmp = Math.abs(cmp); if (abs_cmp < bestDistance) { bestDistance = abs_cmp; bestMid = mid; } } final double xValue = defaultHighLowDataset.getXDate(0, bestMid).getTime(); final double yValue = defaultHighLowDataset.getCloseValue(0, bestMid); final double xJava2D = domainAxis.valueToJava2D(xValue, _plotArea, domainAxisEdge); final double yJava2D = rangeAxis.valueToJava2D(yValue, _plotArea, rangeAxisEdge); final int tmpIndex = bestMid; // translateJava2DToScreen will internally convert Point2D.Double to Point. final Point2D tmpPoint = chartPanel.translateJava2DToScreen(new Point2D.Double(xJava2D, yJava2D)); this.mainDrawArea.setRect(_plotArea); if (this.mainDrawArea.contains(tmpPoint)) { // 0 indicates main plot. this.mainTraceInfo = TraceInfo.newInstance(tmpPoint, 0, 0, tmpIndex); return true; } return false; }
From source file:org.trade.ui.chart.renderer.CandleRenderer.java
/** * Method drawItem./*from w w w. j a v a 2 s. c o m*/ * * @param g2 * Graphics2D * @param state * XYItemRendererState * @param dataArea * Rectangle2D * @param info * PlotRenderingInfo * @param plot * XYPlot * @param domainAxis * ValueAxis * @param rangeAxis * ValueAxis * @param dataset * XYDataset * @param series * int * @param item * int * @param crosshairState * CrosshairState * @param pass * int * @see org.jfree.chart.renderer.xy.XYItemRenderer#drawItem(Graphics2D, * XYItemRendererState, Rectangle2D, PlotRenderingInfo, XYPlot, * ValueAxis, ValueAxis, XYDataset, int, int, CrosshairState, int) */ 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 (dataset instanceof OHLCVwapDataset) { // setup for collecting optional entity info... EntityCollection entities = null; if (info != null) { entities = info.getOwner().getEntityCollection(); } CandleDataset candleDataset = (CandleDataset) dataset; CandleItem candle = (CandleItem) candleDataset.getSeries(series).getDataItem(item); double startX = candle.getPeriod().getFirstMillisecond(); if (Double.isNaN(startX)) { return; } double endX = candle.getPeriod().getLastMillisecond(); if (Double.isNaN(endX)) { return; } if (startX <= endX) { if (!domainAxis.getRange().intersects(startX, endX)) { return; } } else { if (!domainAxis.getRange().intersects(endX, startX)) { return; } } RectangleEdge location = plot.getDomainAxisEdge(); double translatedStartX = domainAxis.valueToJava2D(startX, dataArea, location); double translatedEndX = domainAxis.valueToJava2D(endX, dataArea, location); double translatedWidth = Math.max(1, Math.abs(translatedEndX - translatedStartX)); if (getMargin() > 0.0) { double cut = translatedWidth * getMargin(); translatedWidth = translatedWidth - cut; } double x = candleDataset.getXValue(series, item); double yHigh = candleDataset.getHighValue(series, item); double yLow = candleDataset.getLowValue(series, item); double yOpen = candleDataset.getOpenValue(series, item); double yClose = candleDataset.getCloseValue(series, item); RectangleEdge domainEdge = plot.getDomainAxisEdge(); double xx = domainAxis.valueToJava2D(x, dataArea, domainEdge); RectangleEdge edge = plot.getRangeAxisEdge(); double yyHigh = rangeAxis.valueToJava2D(yHigh, dataArea, edge); double yyLow = rangeAxis.valueToJava2D(yLow, dataArea, edge); double yyOpen = rangeAxis.valueToJava2D(yOpen, dataArea, edge); double yyClose = rangeAxis.valueToJava2D(yClose, dataArea, edge); Paint outlinePaint = null; outlinePaint = getItemOutlinePaint(series, item); g2.setStroke(getItemStroke(series, item)); g2.setPaint(outlinePaint); double yyMaxOpenClose = Math.max(yyOpen, yyClose); double yyMinOpenClose = Math.min(yyOpen, yyClose); double maxOpenClose = Math.max(yOpen, yClose); double minOpenClose = Math.min(yOpen, yClose); Shape body = null; boolean highlight = highlight(series, item); /********************************** * draw the upper shadow START **********************************/ if (yHigh > maxOpenClose) { if (highlight) { body = new Rectangle2D.Double(xx - (translatedWidth / 2), yyHigh - 10, translatedWidth, (yyMaxOpenClose - yyHigh) + 10); g2.setPaint(Color.YELLOW); g2.fill(body); g2.draw(body); } } if (yHigh > maxOpenClose) { if (nightMode) { if (yClose > yOpen) { g2.setPaint(upPaint); } else { g2.setPaint(downPaint); } } else { g2.setPaint(Color.black); } g2.draw(new Line2D.Double(xx, yyHigh, xx, yyMaxOpenClose)); } /********************************** * draw the lower shadow START **********************************/ if (yLow < minOpenClose) { if (highlight) { body = new Rectangle2D.Double(xx - (translatedWidth / 2), yyMinOpenClose, translatedWidth, (yyLow - yyMinOpenClose) + 10); g2.setPaint(Color.YELLOW); g2.fill(body); g2.draw(body); } if (yLow < minOpenClose) { if (nightMode) { if (yClose > yOpen) { g2.setPaint(upPaint); } else { g2.setPaint(downPaint); } } else { g2.setPaint(Color.BLACK); } g2.draw(new Line2D.Double(xx, yyLow, xx, yyMinOpenClose)); } } /********************************** * draw the body **********************************/ body = new Rectangle2D.Double(xx - (translatedWidth / 2), yyMinOpenClose, translatedWidth, yyMaxOpenClose - yyMinOpenClose); if (nightMode) { g2.setPaint(Color.white); } else { if (yClose > yOpen) { g2.setPaint(upPaint); } else { g2.setPaint(downPaint); } } g2.fill(body); g2.draw(body); if (nightMode) { if (yClose > yOpen) { g2.setPaint(upPaint); } else { g2.setPaint(downPaint); } } else { g2.setPaint(outlinePaint); } g2.draw(body); // add an entity for the item... if (entities != null) { String tip = null; XYToolTipGenerator generator = getToolTipGenerator(series, item); if (generator != null) { tip = generator.generateToolTip(dataset, series, item); } XYItemEntity entity = new XYItemEntity(body, dataset, series, item, tip, null); entities.add(entity); } // update the cross hair point double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); double transX1 = domainAxis.valueToJava2D(x1, dataArea, location); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, plot.getRangeAxisEdge()); int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex, rangeAxisIndex, transX1, transY1, plot.getOrientation()); } }
From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java
public Point2D getPointInChart(MouseEvent e) { Insets insets = getInsets();//from w w w .j av a 2 s . co m //System.out.println("inset.top="+insets.top+" inset.left="+insets.left); //System.out.println("scaleX="+chartPaneltest.getScaleX()+" scaleY="+chartPaneltest.getScaleY()); //System.out.println(e.getX()); // int mouseX = (int) ((e.getX() - insets.left) / chartPaneltest.getScaleX()); // int mouseY = (int) ((e.getY() - insets.top) / chartPaneltest.getScaleY()); int mouseX = (int) (e.getX() - insets.left); int mouseY = (int) (e.getY() - insets.top); // Point2D pt = new Point2D.Double(); //pt.setLocation(mouseX, mouseY); //return pt; // System.out.println("x = " + mouseX + ", y = " + mouseY); Point2D p = chartPaneltest.translateScreenToJava2D(new Point(mouseX, mouseY)); XYPlot plot = (XYPlot) chart.getPlot(); ChartRenderingInfo info = chartPaneltest.getChartRenderingInfo(); Rectangle2D dataArea = info.getPlotInfo().getDataArea(); ValueAxis domainAxis = plot.getDomainAxis(); RectangleEdge domainAxisEdge = plot.getDomainAxisEdge(); ValueAxis rangeAxis = plot.getRangeAxis(); RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge(); double chartX = domainAxis.java2DToValue(p.getX(), dataArea, domainAxisEdge); double chartY = rangeAxis.java2DToValue(p.getY(), dataArea, rangeAxisEdge); Point2D pt2 = new Point2D.Double(); //double scale = (double)CHART_SIZE_X/(double)CHART_SIZE_Y; //System.out.println("scale="+scale); pt2.setLocation(chartX, chartY); //System.out.println("Chart: x = " + (chartX) + ", y = " + chartY); return pt2; }
From source file:org.yccheok.jstock.gui.charting.InvestmentFlowLayerUI.java
private Point2D.Double getPoint(int dataIndex, Type type) { if (dataIndex < 0) { return null; }// w w w. j a v a 2s . co m final ChartPanel chartPanel = this.investmentFlowChartJDialog.getChartPanel(); final JFreeChart chart = chartPanel.getChart(); final XYPlot plot = (XYPlot) chart.getPlot(); // Dataset 0 are the invest information. 1 is the ROI information. final TimeSeriesCollection timeSeriesCollection; if (type == Type.Invest) { timeSeriesCollection = (TimeSeriesCollection) plot.getDataset(0); } else { assert (type == Type.ROI); timeSeriesCollection = (TimeSeriesCollection) plot.getDataset(1); } final TimeSeries timeSeries = timeSeriesCollection.getSeries(0); if (dataIndex >= timeSeries.getItemCount()) { /* Not ready yet. */ return null; } final ValueAxis domainAxis = plot.getDomainAxis(); final RectangleEdge domainAxisEdge = plot.getDomainAxisEdge(); final ValueAxis rangeAxis = plot.getRangeAxis(); final RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge(); final TimeSeriesDataItem timeSeriesDataItem = timeSeries.getDataItem(dataIndex); final double xValue = timeSeriesDataItem.getPeriod().getFirstMillisecond(); final double yValue = timeSeriesDataItem.getValue().doubleValue(); final Rectangle2D plotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getDataArea(); final double xJava2D = domainAxis.valueToJava2D(xValue, plotArea, domainAxisEdge); final double yJava2D = rangeAxis.valueToJava2D(yValue, plotArea, rangeAxisEdge); // Use Double version, to avoid from losing precision. return new Point2D.Double(xJava2D, yJava2D); }
From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java
private void zoomEventUIUpdate() { // allow for better scrolling efficiency for new size chartPanelScrollPane().getHorizontalScrollBar().setUnitIncrement(zoomCounter * 10); // update the screen panels for repaint getChartPanel().updateUI();// w ww .ja va 2s . c om // updates the scroll bar after resize updates. // SwingUtilities.invokeLater(new Runnable() { // public void run() { // resetScrollPosition(); Rectangle2D plotArea = getChartPanel().getScreenDataArea(); XYPlot plot = (XYPlot) getAdvancedGraph().getPlot(); int plotWidth = initialPlotAreaWidth; for (int i = 1; i <= zoomCounter; i++) { plotWidth = (plotWidth * 2) + 16; } plotArea.setRect(plotArea.getX(), plotArea.getY(), plotWidth, plotArea.getHeight()); double scrollPoint = new Float( plot.getDomainAxis().valueToJava2D(getCrosshair(), plotArea, plot.getDomainAxisEdge())).intValue(); int width = chartPanelScrollPane().getWidth(); scrollPoint = Math.max(0, scrollPoint - (width / 2)); this.pointX = (int) scrollPoint; }
From source file:edu.dlnu.liuwenpeng.render.XYLineAndShapeRenderer.java
/** * Draws the item shapes and adds chart entities (second pass). This method * draws the shapes which mark the item positions. If <code>entities</code> * is not <code>null</code> it will be populated with entity information * for points that fall within the data area. * /*from w ww . j a v a 2 s .c om*/ * @param g2 the graphics device. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the domain axis. * @param dataArea the area within which the data is being drawn. * @param rangeAxis the range axis. * @param dataset the dataset. * @param pass the pass. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState the crosshair state. * @param entities the entity collection. */ protected void drawSecondaryPass(Graphics2D g2, XYPlot plot, XYDataset dataset, int pass, int series, int item, ValueAxis domainAxis, Rectangle2D dataArea, ValueAxis rangeAxis, CrosshairState crosshairState, EntityCollection entities) { Shape entityArea = null; // get the data point... double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); if (Double.isNaN(y1) || Double.isNaN(x1)) { return; } PlotOrientation orientation = plot.getOrientation(); RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation); if (getItemShapeVisible(series, item)) { Shape shape = getItemShape(series, item); if (orientation == PlotOrientation.HORIZONTAL) { shape = ShapeUtilities.createTranslatedShape(shape, transY1, transX1); } else if (orientation == PlotOrientation.VERTICAL) { shape = ShapeUtilities.createTranslatedShape(shape, transX1, transY1); } entityArea = shape; if (shape.intersects(dataArea)) { if (getItemShapeFilled(series, item)) { if (this.useFillPaint) { g2.setPaint(getItemFillPaint(series, item)); } else { g2.setPaint(getItemPaint(series, item)); } //g2.fill(shape); } if (this.drawOutlines) { if (getUseOutlinePaint()) { g2.setPaint(getItemOutlinePaint(series, item)); } else { g2.setPaint(getItemPaint(series, item)); } g2.setStroke(getItemOutlineStroke(series, item)); // g2.draw(shape); } } } double xx = transX1; double yy = transY1; if (orientation == PlotOrientation.HORIZONTAL) { xx = transY1; yy = transX1; } // draw the item label if there is one... if (isItemLabelVisible(series, item)) { drawItemLabel(g2, orientation, dataset, series, item, xx, yy, (y1 < 0.0)); } int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex, rangeAxisIndex, transX1, transY1, orientation); // add an entity for the item, but only if it falls within the data // area... if (entities != null && isPointInRect(dataArea, xx, yy)) { addEntity(entities, entityArea, dataset, series, item, xx, yy); } }