org.jfree.chart.plot.CrosshairState Java Examples

The following examples show how to use org.jfree.chart.plot.CrosshairState. 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: XYDifferenceRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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(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 (pass == 0) {
        drawItemPass0(g2, dataArea, info, plot, domainAxis, rangeAxis, 
                dataset, series, item, crosshairState);
    }
    else if (pass == 1) {
        drawItemPass1(g2, dataArea, info, plot, domainAxis, rangeAxis, 
                dataset, series, item, crosshairState);
    }

}
 
Example #2
Source File: XYImagePlot.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index, PlotRenderingInfo info, CrosshairState crosshairState) {
    final boolean foundData = super.render(g2, dataArea, index, info, crosshairState);
    if (image != null) {
        final int dx1 = (int) dataArea.getMinX();
        final int dy1 = (int) dataArea.getMinY();
        final int dx2 = (int) dataArea.getMaxX();
        final int dy2 = (int) dataArea.getMaxY();

        synchronized (imageLock) {
            final Rectangle rectangle = getImageSourceArea();
            final int sx1 = rectangle.x;
            final int sy1 = rectangle.y;
            final int sx2 = sx1 + rectangle.width - 1;
            final int sy2 = sy1 + rectangle.height - 1;
            g2.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null);
        }
    }
    return foundData;
}
 
Example #3
Source File: XYBoxAndWhiskerRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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 plot is being drawn.
 * @param info  collects info 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.
 */
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) {

    PlotOrientation orientation = plot.getOrientation();

    if (orientation == PlotOrientation.HORIZONTAL) {
        drawHorizontalItem(g2, dataArea, info, plot, domainAxis, rangeAxis,
                dataset, series, item, crosshairState, pass);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        drawVerticalItem(g2, dataArea, info, plot, domainAxis, rangeAxis,
                dataset, series, item, crosshairState, pass);
    }

}
 
Example #4
Source File: ExcitationRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
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 #5
Source File: XYDifferenceRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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(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 (pass == 0) {
        drawItemPass0(g2, dataArea, info, plot, domainAxis, rangeAxis, 
                dataset, series, item, crosshairState);
    }
    else if (pass == 1) {
        drawItemPass1(g2, dataArea, info, plot, domainAxis, rangeAxis, 
                dataset, series, item, crosshairState);
    }

}
 
Example #6
Source File: XYLineAndShapeRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * 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 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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }

    // first pass draws the background (lines, for instance)
    if (isLinePass(pass)) {
        if (getItemLineVisible(series, item)) {
            if (this.drawSeriesLineAsPath) {
                drawPrimaryLineAsPath(state, g2, plot, dataset, pass,
                        series, item, domainAxis, rangeAxis, dataArea);
            }
            else {
                drawPrimaryLine(state, g2, plot, dataset, pass, series,
                        item, domainAxis, rangeAxis, dataArea);
            }
        }
    }
    // second pass adds shapes where the items are ..
    else if (isItemPass(pass)) {

        // setup for collecting optional entity info...
        EntityCollection entities = null;
        if (info != null && info.getOwner() != null) {
            entities = info.getOwner().getEntityCollection();
        }

        drawSecondaryPass(g2, plot, dataset, pass, series, item,
                domainAxis, dataArea, rangeAxis, crosshairState, entities);
    }
}
 
Example #7
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Considers the current (x, y) coordinate and updates the crosshair point
 * if it meets the criteria (usually means the (x, y) coordinate is the
 * closest to the anchor point so far).
 *
 * @param crosshairState  the crosshair state (<code>null</code> permitted,
 *                        but the method does nothing in that case).
 * @param x  the x-value (in data space).
 * @param y  the y-value (in data space).
 * @param domainAxisIndex  the index of the domain axis for the point.
 * @param rangeAxisIndex  the index of the range axis for the point.
 * @param transX  the x-value translated to Java2D space.
 * @param transY  the y-value translated to Java2D space.
 * @param orientation  the plot orientation (<code>null</code> not
 *                     permitted).
 *
 * @since 1.0.4
 */
protected void updateCrosshairValues(CrosshairState crosshairState,
        double x, double y, int domainAxisIndex, int rangeAxisIndex,
        double transX, double transY, PlotOrientation orientation) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    if (crosshairState != null) {
        // do we need to update the crosshair values?
        if (this.plot.isDomainCrosshairLockedOnData()) {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // both axes
                crosshairState.updateCrosshairPoint(x, y, domainAxisIndex,
                        rangeAxisIndex, transX, transY, orientation);
            }
            else {
                // just the domain axis...
                crosshairState.updateCrosshairX(x, domainAxisIndex);
            }
        }
        else {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // just the range axis...
                crosshairState.updateCrosshairY(y, rangeAxisIndex);
            }
        }
    }

}
 
Example #8
Source File: XYLineAndShapeRenderer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }

    // first pass draws the background (lines, for instance)
    if (isLinePass(pass)) {
        if (getItemLineVisible(series, item)) {
            if (this.drawSeriesLineAsPath) {
                drawPrimaryLineAsPath(state, g2, plot, dataset, pass,
                        series, item, domainAxis, rangeAxis, dataArea);
            }
            else {
                drawPrimaryLine(state, g2, plot, dataset, pass, series,
                        item, domainAxis, rangeAxis, dataArea);
            }
        }
    }
    // second pass adds shapes where the items are ..
    else if (isItemPass(pass)) {

        // setup for collecting optional entity info...
        EntityCollection entities = null;
        if (info != null && info.getOwner() != null) {
            entities = info.getOwner().getEntityCollection();
        }

        drawSecondaryPass(g2, plot, dataset, pass, series, item,
                domainAxis, dataArea, rangeAxis, crosshairState, entities);
    }
}
 
Example #9
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Considers the current (x, y) coordinate and updates the crosshair point
 * if it meets the criteria (usually means the (x, y) coordinate is the
 * closest to the anchor point so far).
 *
 * @param crosshairState  the crosshair state (<code>null</code> permitted,
 *                        but the method does nothing in that case).
 * @param x  the x-value (in data space).
 * @param y  the y-value (in data space).
 * @param domainAxisIndex  the index of the domain axis for the point.
 * @param rangeAxisIndex  the index of the range axis for the point.
 * @param transX  the x-value translated to Java2D space.
 * @param transY  the y-value translated to Java2D space.
 * @param orientation  the plot orientation (<code>null</code> not
 *                     permitted).
 *
 * @since 1.0.4
 */
protected void updateCrosshairValues(CrosshairState crosshairState,
        double x, double y, int domainAxisIndex, int rangeAxisIndex,
        double transX, double transY, PlotOrientation orientation) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    if (crosshairState != null) {
        // do we need to update the crosshair values?
        if (this.plot.isDomainCrosshairLockedOnData()) {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // both axes
                crosshairState.updateCrosshairPoint(x, y, domainAxisIndex,
                        rangeAxisIndex, transX, transY, orientation);
            }
            else {
                // just the domain axis...
                crosshairState.updateCrosshairX(x, domainAxisIndex);
            }
        }
        else {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // just the range axis...
                crosshairState.updateCrosshairY(y, rangeAxisIndex);
            }
        }
    }

}
 
Example #10
Source File: PeakRenderer.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
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: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Considers the current (x, y) coordinate and updates the crosshair point
 * if it meets the criteria (usually means the (x, y) coordinate is the
 * closest to the anchor point so far).
 *
 * @param crosshairState  the crosshair state (<code>null</code> permitted,
 *                        but the method does nothing in that case).
 * @param x  the x-value (in data space).
 * @param y  the y-value (in data space).
 * @param domainAxisIndex  the index of the domain axis for the point.
 * @param rangeAxisIndex  the index of the range axis for the point.
 * @param transX  the x-value translated to Java2D space.
 * @param transY  the y-value translated to Java2D space.
 * @param orientation  the plot orientation (<code>null</code> not
 *                     permitted).
 *
 * @since 1.0.4
 */
protected void updateCrosshairValues(CrosshairState crosshairState,
        double x, double y, int domainAxisIndex, int rangeAxisIndex,
        double transX, double transY, PlotOrientation orientation) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }

    if (crosshairState != null) {
        // do we need to update the crosshair values?
        if (this.plot.isDomainCrosshairLockedOnData()) {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // both axes
                crosshairState.updateCrosshairPoint(x, y, domainAxisIndex,
                        rangeAxisIndex, transX, transY, orientation);
            }
            else {
                // just the domain axis...
                crosshairState.updateCrosshairX(x, domainAxisIndex);
            }
        }
        else {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // just the range axis...
                crosshairState.updateCrosshairY(y, rangeAxisIndex);
            }
        }
    }

}
 
Example #12
Source File: ContinuousRenderer.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
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: CombinedModuleDataPointRenderer.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
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 #14
Source File: NeutralLossDataPointRenderer.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
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 #15
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Considers the current (x, y) coordinate and updates the crosshair point
 * if it meets the criteria (usually means the (x, y) coordinate is the
 * closest to the anchor point so far).
 *
 * @param crosshairState  the crosshair state (<code>null</code> permitted,
 *                        but the method does nothing in that case).
 * @param x  the x-value (in data space).
 * @param y  the y-value (in data space).
 * @param domainAxisIndex  the index of the domain axis for the point.
 * @param rangeAxisIndex  the index of the range axis for the point.
 * @param transX  the x-value translated to Java2D space.
 * @param transY  the y-value translated to Java2D space.
 * @param orientation  the plot orientation (<code>null</code> not
 *                     permitted).
 *
 * @since 1.0.4
 */
protected void updateCrosshairValues(CrosshairState crosshairState,
        double x, double y, int domainAxisIndex, int rangeAxisIndex,
        double transX, double transY, PlotOrientation orientation) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }

    if (crosshairState != null) {
        // do we need to update the crosshair values?
        if (this.plot.isDomainCrosshairLockedOnData()) {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // both axes
                crosshairState.updateCrosshairPoint(x, y, domainAxisIndex,
                        rangeAxisIndex, transX, transY, orientation);
            }
            else {
                // just the domain axis...
                crosshairState.updateCrosshairX(x, domainAxisIndex);
            }
        }
        else {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // just the range axis...
                crosshairState.updateCrosshairY(y, rangeAxisIndex);
            }
        }
    }

}
 
Example #16
Source File: XYLineAndShapeRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }

    // first pass draws the background (lines, for instance)
    if (isLinePass(pass)) {
        if (getItemLineVisible(series, item)) {
            if (this.drawSeriesLineAsPath) {
                drawPrimaryLineAsPath(state, g2, plot, dataset, pass,
                        series, item, domainAxis, rangeAxis, dataArea);
            }
            else {
                drawPrimaryLine(state, g2, plot, dataset, pass, series,
                        item, domainAxis, rangeAxis, dataArea);
            }
        }
    }
    // second pass adds shapes where the items are ..
    else if (isItemPass(pass)) {

        // setup for collecting optional entity info...
        EntityCollection entities = null;
        if (info != null && info.getOwner() != null) {
            entities = info.getOwner().getEntityCollection();
        }

        drawSecondaryPass(g2, plot, dataset, pass, series, item,
                domainAxis, dataArea, rangeAxis, crosshairState, entities);
    }
}
 
Example #17
Source File: PeakTICPlotRenderer.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
@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 #18
Source File: ScatterPlotRenderer.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
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 #19
Source File: PseudoSpectraRenderer.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
@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 #20
Source File: FunctionPlot.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
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 #21
Source File: XYBlockRenderer.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * 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.
 */
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 + this.xOffset, dataArea, 
            plot.getDomainAxisEdge());
    double yy0 = rangeAxis.valueToJava2D(y + this.yOffset, dataArea, 
            plot.getRangeAxisEdge());
    double xx1 = domainAxis.valueToJava2D(x + this.blockWidth 
            + this.xOffset, dataArea, plot.getDomainAxisEdge());
    double yy1 = rangeAxis.valueToJava2D(y + this.blockHeight 
            + this.yOffset, 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), Math.abs(yy1 - yy0), 
                Math.abs(xx0 - xx1));
    }
    else {
        block = new Rectangle2D.Double(Math.min(xx0, xx1), 
                Math.min(yy0, yy1), Math.abs(xx1 - xx0), 
                Math.abs(yy1 - yy0));            
    }
    g2.setPaint(p);
    g2.fill(block);
    g2.setStroke(new BasicStroke(1.0f));
    g2.draw(block);
}
 
Example #22
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Considers the current (x, y) coordinate and updates the crosshair point
 * if it meets the criteria (usually means the (x, y) coordinate is the
 * closest to the anchor point so far).
 *
 * @param crosshairState  the crosshair state (<code>null</code> permitted,
 *                        but the method does nothing in that case).
 * @param x  the x-value (in data space).
 * @param y  the y-value (in data space).
 * @param domainAxisIndex  the index of the domain axis for the point.
 * @param rangeAxisIndex  the index of the range axis for the point.
 * @param transX  the x-value translated to Java2D space.
 * @param transY  the y-value translated to Java2D space.
 * @param orientation  the plot orientation (<code>null</code> not
 *                     permitted).
 *
 * @since 1.0.4
 */
protected void updateCrosshairValues(CrosshairState crosshairState,
        double x, double y, int domainAxisIndex, int rangeAxisIndex,
        double transX, double transY, PlotOrientation orientation) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    if (crosshairState != null) {
        // do we need to update the crosshair values?
        if (this.plot.isDomainCrosshairLockedOnData()) {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // both axes
                crosshairState.updateCrosshairPoint(x, y, domainAxisIndex,
                        rangeAxisIndex, transX, transY, orientation);
            }
            else {
                // just the domain axis...
                crosshairState.updateCrosshairX(x, domainAxisIndex);
            }
        }
        else {
            if (this.plot.isRangeCrosshairLockedOnData()) {
                // just the range axis...
                crosshairState.updateCrosshairY(y, rangeAxisIndex);
            }
        }
    }

}
 
Example #23
Source File: XYLineAndShapeRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }

    // first pass draws the background (lines, for instance)
    if (isLinePass(pass)) {
        if (getItemLineVisible(series, item)) {
            if (this.drawSeriesLineAsPath) {
                drawPrimaryLineAsPath(state, g2, plot, dataset, pass,
                        series, item, domainAxis, rangeAxis, dataArea);
            }
            else {
                drawPrimaryLine(state, g2, plot, dataset, pass, series,
                        item, domainAxis, rangeAxis, dataArea);
            }
        }
    }
    // second pass adds shapes where the items are ..
    else if (isItemPass(pass)) {

        // setup for collecting optional entity info...
        EntityCollection entities = null;
        if (info != null && info.getOwner() != null) {
            entities = info.getOwner().getEntityCollection();
        }

        drawSecondaryPass(g2, plot, dataset, pass, series, item,
                domainAxis, dataArea, rangeAxis, crosshairState, entities);
    }
}
 
Example #24
Source File: XYDifferenceRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
@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 (pass == 0) {
        drawItemPass0(g2, dataArea, info, plot, domainAxis, rangeAxis,
                dataset, series, item, crosshairState);
    }
    else if (pass == 1) {
        drawItemPass1(g2, dataArea, info, plot, domainAxis, rangeAxis,
                dataset, series, item, crosshairState);
    }

}
 
Example #25
Source File: XYDotRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
@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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }

    // get the data point...
    double x = dataset.getXValue(series, item);
    double y = dataset.getYValue(series, item);
    double adjx = (this.dotWidth - 1) / 2.0;
    double adjy = (this.dotHeight - 1) / 2.0;
    if (!Double.isNaN(y)) {
        RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
        RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
        double transX = domainAxis.valueToJava2D(x, dataArea,
                xAxisLocation) - adjx;
        double transY = rangeAxis.valueToJava2D(y, dataArea, yAxisLocation)
                - adjy;

        g2.setPaint(getItemPaint(series, item));
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            g2.fillRect((int) transY, (int) transX, this.dotHeight,
                    this.dotWidth);
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            g2.fillRect((int) transX, (int) transY, this.dotWidth,
                    this.dotHeight);
        }

        int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
        int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
        updateCrosshairValues(crosshairState, x, y, domainAxisIndex,
                rangeAxisIndex, transX, transY, orientation);
    }

}
 
Example #26
Source File: SamplingXYLineRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }
    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    // get the data point...
    double x1 = dataset.getXValue(series, item);
    double y1 = dataset.getYValue(series, item);
    double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
    double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);

    State s = (State) state;
    // update path to reflect latest point
    if (!Double.isNaN(transX1) && !Double.isNaN(transY1)) {
        float x = (float) transX1;
        float y = (float) transY1;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            x = (float) transY1;
            y = (float) transX1;
        }
        if (s.lastPointGood) {
            if ((Math.abs(x - s.lastX) > s.dX)) {
                s.seriesPath.lineTo(x, y);
                if (s.lowY < s.highY) {
                    s.intervalPath.moveTo((float) s.lastX, (float) s.lowY);
                    s.intervalPath.lineTo((float) s.lastX, (float) s.highY);
                }
                s.lastX = x;
                s.openY = y;
                s.highY = y;
                s.lowY = y;
                s.closeY = y;
            }
            else {
                s.highY = Math.max(s.highY, y);
                s.lowY = Math.min(s.lowY, y);
                s.closeY = y;
            }
        }
        else {
            s.seriesPath.moveTo(x, y);
            s.lastX = x;
            s.openY = y;
            s.highY = y;
            s.lowY = y;
            s.closeY = y;
        }
        s.lastPointGood = true;
    }
    else {
        s.lastPointGood = false;
    }
    // if this is the last item, draw the path ...
    if (item == s.getLastItemIndex()) {
        // draw path
        PathIterator pi = s.seriesPath.getPathIterator(null);
        int count = 0;
        while (!pi.isDone()) {
            count++;
            pi.next();
        }
        g2.setStroke(getItemStroke(series, item));
        g2.setPaint(getItemPaint(series, item));
        g2.draw(s.seriesPath);
        g2.draw(s.intervalPath);
    }
}
 
Example #27
Source File: XYLineAndShapeRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 *
 * @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 selected  is the data item selected?
 * @param crosshairState  the crosshair state.
 * @param entities the entity collection.
 */
protected void drawShape2(Graphics2D g2, Rectangle2D dataArea,
        XYPlot plot, XYDataset dataset, int pass, int series, int item,
        boolean selected, ValueAxis domainAxis, 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, selected);
        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, selected));
                }
                else {
                    g2.setPaint(getItemPaint(series, item, selected));
                }
                g2.fill(shape);
            }
            if (this.drawOutlines) {
                if (getUseOutlinePaint()) {
                    g2.setPaint(getItemOutlinePaint(series, item,
                            selected));
                }
                else {
                    g2.setPaint(getItemPaint(series, item, selected));
                }
                g2.setStroke(getItemOutlineStroke(series, item, selected));
                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, selected)) {
        drawItemLabel(g2, orientation, dataset, series, item, selected, 
                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 
            && ShapeUtilities.isPointInRect(xx, yy, dataArea)) {
        addEntity(entities, entityArea, dataset, series, item, selected,
                xx, yy);
    }
}
 
Example #28
Source File: XYDotRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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.
 */
@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) {

    // do nothing if item is not visible
    if (!getItemVisible(series, item)) {
        return;
    }

    // get the data point...
    double x = dataset.getXValue(series, item);
    double y = dataset.getYValue(series, item);
    double adjx = (this.dotWidth - 1) / 2.0;
    double adjy = (this.dotHeight - 1) / 2.0;
    if (!Double.isNaN(y)) {
        RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
        RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
        double transX = domainAxis.valueToJava2D(x, dataArea,
                xAxisLocation) - adjx;
        double transY = rangeAxis.valueToJava2D(y, dataArea, yAxisLocation)
                - adjy;

        g2.setPaint(getItemPaint(series, item));
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            g2.fillRect((int) transY, (int) transX, this.dotHeight,
                    this.dotWidth);
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            g2.fillRect((int) transX, (int) transY, this.dotWidth,
                    this.dotHeight);
        }

        int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
        int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
        updateCrosshairValues(crosshairState, x, y, domainAxisIndex,
                rangeAxisIndex, transX, transY, orientation);
    }

}
 
Example #29
Source File: XYShapeRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    EntityCollection entities = null;
    if (info != null) {
        entities = info.getOwner().getEntityCollection();
    }

    double x = dataset.getXValue(series, item);
    double y = dataset.getYValue(series, item);
    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();

    // draw optional guide lines
    if ((pass == 0) && this.guideLinesVisible) {
        g2.setStroke(this.guideLineStroke);
        g2.setPaint(this.guideLinePaint);
        if (orientation == PlotOrientation.HORIZONTAL) {
            g2.draw(new Line2D.Double(transY, dataArea.getMinY(), transY,
                    dataArea.getMaxY()));
            g2.draw(new Line2D.Double(dataArea.getMinX(), transX,
                    dataArea.getMaxX(), transX));
        }
        else {
            g2.draw(new Line2D.Double(transX, dataArea.getMinY(), transX,
                    dataArea.getMaxY()));
            g2.draw(new Line2D.Double(dataArea.getMinX(), transY,
                    dataArea.getMaxX(), transY));
        }
    }
    else if (pass == 1) {
        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)) {
            //if (getItemShapeFilled(series, item)) {
                g2.setPaint(getPaint(dataset, 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);
            }
        }

        // add an entity for the item...
        if (entities != null) {
            addEntity(entities, hotspot, dataset, series, item, transX,
                    transY);
        }
    }
}
 
Example #30
Source File: XYLineAndShapeRenderer.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * 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.
 *
 * @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);
    }
}