Example usage for org.jfree.chart.plot XYPlot getDomainAxisEdge

List of usage examples for org.jfree.chart.plot XYPlot getDomainAxisEdge

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot getDomainAxisEdge.

Prototype

public RectangleEdge getDomainAxisEdge() 

Source Link

Document

Returns the edge for the primary domain axis (taking into account the plot's orientation).

Usage

From source file:org.trade.ui.chart.renderer.HeikinAshiRenderer.java

/**
 * Method initialise.//w w  w. j  a v a 2s  .co  m
 * 
 * @param g2
 *            Graphics2D
 * @param dataArea
 *            Rectangle2D
 * @param plot
 *            XYPlot
 * @param dataset
 *            XYDataset
 * @param info
 *            PlotRenderingInfo
 * @return XYItemRendererState
 * @see org.jfree.chart.renderer.xy.XYItemRenderer#initialise(Graphics2D,
 *      Rectangle2D, XYPlot, XYDataset, PlotRenderingInfo)
 */
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset,
        PlotRenderingInfo info) {

    ValueAxis axis = plot.getDomainAxis();
    double x1 = axis.getLowerBound();
    double x2 = x1 + getMaxCandleWidthInMilliseconds();
    RectangleEdge edge = plot.getDomainAxisEdge();
    double xx1 = axis.valueToJava2D(x1, dataArea, edge);
    double xx2 = axis.valueToJava2D(x2, dataArea, edge);
    maxCandleWidth = Math.abs(xx2 - xx1);
    return new XYItemRendererState(info);
}

From source file:de.laures.cewolf.jfree.XYSplineRenderer.java

/**
 * Draws the item (first pass). This method draws the lines
 * connecting the items. Instead of drawing separate lines,
 * a GeneralPath is constructed and drawn at the end of the series painting.
 *
 * @param g2  the graphics device.// w  ww.  j  a  v  a  2  s .c  o  m
 * @param state  the renderer state.
 * @param plot  the plot (can be used to obtain standard color information etc).
 * @param dataset  the dataset.
 * @param pass  the pass.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataArea  the area within which the data is being drawn.
 */
protected void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset,
        int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) {

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    // get the data points
    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);

    // collect points
    if (!Double.isNaN(transX1) && !Double.isNaN(transY1)) {
        ControlPoint p = new ControlPoint(
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transY1 : (float) transX1,
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transX1 : (float) transY1);
        if (!this.points.contains(p)) {
            this.points.add(p);
        }
    }
    if (item == dataset.getItemCount(series) - 1) {
        State s = (State) state;
        // construct path
        if (this.points.size() > 1) {
            // we need at least two points to draw something
            ControlPoint cp0 = (ControlPoint) this.points.get(0);
            s.seriesPath.moveTo(cp0.x, cp0.y);
            if (this.points.size() == 2) {
                // we need at least 3 points to spline. Draw simple line for two points
                ControlPoint cp1 = (ControlPoint) this.points.get(1);
                s.seriesPath.lineTo(cp1.x, cp1.y);
            } else {
                // construct spline
                int np = this.points.size(); // number of points
                float[] d = new float[np]; // Newton form coefficients
                float[] x = new float[np]; // x-coordinates of nodes
                float y;
                float t;
                float[] a = new float[np];
                float t1;
                float t2;
                float[] h = new float[np];

                for (int i = 0; i < np; i++) {
                    ControlPoint cpi = (ControlPoint) this.points.get(i);
                    x[i] = cpi.x;
                    d[i] = cpi.y;
                }

                for (int i = 1; i <= np - 1; i++) {
                    h[i] = x[i] - x[i - 1];
                }
                float[] sub = new float[np - 1];
                float[] diag = new float[np - 1];
                float[] sup = new float[np - 1];

                for (int i = 1; i <= np - 2; i++) {
                    diag[i] = (h[i] + h[i + 1]) / 3;
                    sup[i] = h[i + 1] / 6;
                    sub[i] = h[i] / 6;
                    a[i] = (d[i + 1] - d[i]) / h[i + 1] - (d[i] - d[i - 1]) / h[i];
                }
                solveTridiag(sub, diag, sup, a, np - 2);

                // note that a[0]=a[np-1]=0
                // draw
                s.seriesPath.moveTo(x[0], d[0]);
                for (int i = 1; i <= np - 1; i++) {
                    // loop over intervals between nodes
                    for (int j = 1; j <= this.precision; j++) {
                        t1 = (h[i] * j) / this.precision;
                        t2 = h[i] - t1;
                        y = ((-a[i - 1] / 6 * (t2 + h[i]) * t1 + d[i - 1]) * t2
                                + (-a[i] / 6 * (t1 + h[i]) * t2 + d[i]) * t1) / h[i];
                        t = x[i - 1] + t1;
                        s.seriesPath.lineTo(t, y);
                    }
                }
            }
            // draw path
            drawFirstPassShape(g2, pass, series, item, s.seriesPath);
        }

        // reset points vector
        this.points = new Vector();
    }
}

From source file:no.met.jtimeseries.chart.XYSplineRenderer.java

/**
 * Draws the item (first pass). This method draws the lines
 * connecting the items. Instead of drawing separate lines,
 * a GeneralPath is constructed and drawn at the end of
 * the series painting.// w ww .  j a va2  s. c om
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param plot  the plot (can be used to obtain standard color information
 *              etc).
 * @param dataset  the dataset.
 * @param pass  the pass.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataArea  the area within which the data is being drawn.
 */
@Override
protected void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset,
        int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) {

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    // get the data points
    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);

    // collect points
    if (!Double.isNaN(transX1) && !Double.isNaN(transY1)) {
        ControlPoint p = new ControlPoint(
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transY1 : (float) transX1,
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transX1 : (float) transY1);
        if (!this.points.contains(p)) {
            this.points.add(p);
        }
    }
    if (item == dataset.getItemCount(series) - 1) {
        State s = (State) state;
        // construct path
        if (this.points.size() > 1) {
            // we need at least two points to draw something
            ControlPoint cp0 = this.points.get(0);
            s.seriesPath.moveTo(cp0.x, cp0.y);
            if (this.points.size() == 2) {
                // we need at least 3 points to spline. Draw simple line
                // for two points
                ControlPoint cp1 = this.points.get(1);
                s.seriesPath.lineTo(cp1.x, cp1.y);
            } else {
                // construct spline
                int np = this.points.size(); // number of points
                float[] d = new float[np]; // Newton form coefficients
                float[] x = new float[np]; // x-coordinates of nodes
                float y;
                float t;
                float oldy = 0;
                float oldt = 0;

                float[] a = new float[np];
                float t1;
                float t2;
                float[] h = new float[np];

                for (int i = 0; i < np; i++) {
                    ControlPoint cpi = this.points.get(i);
                    x[i] = cpi.x;
                    d[i] = cpi.y;
                }

                for (int i = 1; i <= np - 1; i++) {
                    h[i] = x[i] - x[i - 1];
                }
                float[] sub = new float[np - 1];
                float[] diag = new float[np - 1];
                float[] sup = new float[np - 1];

                for (int i = 1; i <= np - 2; i++) {
                    diag[i] = (h[i] + h[i + 1]) / 3;
                    sup[i] = h[i + 1] / 6;
                    sub[i] = h[i] / 6;
                    a[i] = (d[i + 1] - d[i]) / h[i + 1] - (d[i] - d[i - 1]) / h[i];
                }
                solveTridiag(sub, diag, sup, a, np - 2);

                // note that a[0]=a[np-1]=0
                // draw
                oldt = x[0];
                oldy = d[0];
                s.seriesPath.moveTo(oldt, oldy);
                for (int i = 1; i <= np - 1; i++) {
                    // loop over intervals between nodes
                    for (int j = 1; j <= this.precision; j++) {
                        t1 = (h[i] * j) / this.precision;
                        t2 = h[i] - t1;
                        y = ((-a[i - 1] / 6 * (t2 + h[i]) * t1 + d[i - 1]) * t2
                                + (-a[i] / 6 * (t1 + h[i]) * t2 + d[i]) * t1) / h[i];
                        t = x[i - 1] + t1;
                        s.seriesPath.lineTo(t, y);
                        oldt = t;
                        oldy = y;
                    }
                }
            }
            // draw path
            drawFirstPassShape(g2, pass, series, item, s.seriesPath);
        }

        // reset points vector
        this.points = new Vector<ControlPoint>();
    }
}

From source file:com.android.ddmuilib.log.event.OccurrenceRenderer.java

@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) {
    TimeSeriesCollection timeDataSet = (TimeSeriesCollection) dataset;

    // get the x value for the series/item.
    double x = timeDataSet.getX(series, item).doubleValue();

    // get the min/max of the range axis
    double yMin = rangeAxis.getLowerBound();
    double yMax = rangeAxis.getUpperBound();

    RectangleEdge domainEdge = plot.getDomainAxisEdge();
    RectangleEdge rangeEdge = plot.getRangeAxisEdge();

    // convert the coordinates to java2d.
    double x2D = domainAxis.valueToJava2D(x, dataArea, domainEdge);
    double yMin2D = rangeAxis.valueToJava2D(yMin, dataArea, rangeEdge);
    double yMax2D = rangeAxis.valueToJava2D(yMax, dataArea, rangeEdge);

    // get the paint information for the series/item
    Paint p = getItemPaint(series, item);
    Stroke s = getItemStroke(series, item);

    Line2D line = null;/*from   w  w w .j a  v  a  2  s . c o m*/
    PlotOrientation orientation = plot.getOrientation();
    if (orientation == PlotOrientation.HORIZONTAL) {
        line = new Line2D.Double(yMin2D, x2D, yMax2D, x2D);
    } else if (orientation == PlotOrientation.VERTICAL) {
        line = new Line2D.Double(x2D, yMin2D, x2D, yMax2D);
    }
    g2.setPaint(p);
    g2.setStroke(s);
    g2.draw(line);
}

From source file:no.met.jtimeseries.chart.XYWindArrowRenderer.java

/**
 * Draws the visual representation of a single wind arrow.
 *///  ww  w .  jav a  2s .com
@Override
public void drawItem(Graphics2D g2d, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info,
        XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item,
        CrosshairState crosshairState, int pass) {
    resizeArrowByPlotHeight((int) plotArea.getHeight());
    // Needs a new graphics object to use translate() and rotate()
    Graphics2D g2 = (Graphics2D) g2d.create();
    g2.setRenderingHints(renderHints);
    RectangleEdge domainAxisLocation = plot.getDomainAxisEdge();
    double middleY = plotArea.getCenterY();

    WindDataset windData = (WindDataset) dataset;

    Number x = windData.getX(series, item);
    Number windDir = windData.getWindDirection(series, item);
    Number wforce = windData.getWindForce(series, item);

    double middleX = domainAxis.valueToJava2D(x.doubleValue(), plotArea, domainAxisLocation);

    g2.translate((int) middleX, (int) middleY);
    g2.setColor(Color.BLACK);

    if (wforce.doubleValue() <= zeroWindLimit) {
        drawCircle(g2);
    } else {
        g2.rotate(Math.toRadians(windDir.doubleValue() - 180));
        drawArrow(g2, wforce.doubleValue());

        if (useArrowHead) {
            g2.fill(getPolygonHead(arrowHeadSize, arrowHeight));
        } else {
            g2.draw(getCircleHead(arrowHeadSize, arrowHeight));
        }
    }
}

From source file:net.sf.maltcms.chromaui.charts.events.XYAnnotationAdder.java

/**
 *
 * @param g2/*from  w  w  w  . j a  va2 s  .c  o  m*/
 * @param chartPanel
 */
@Override
public void paintOverlay(Graphics2D g2, ChartPanel chartPanel) {
    if (visible) {
        Shape savedClip = g2.getClip();
        Rectangle2D dataArea = chartPanel.getScreenDataArea();
        g2.clip(dataArea);
        JFreeChart chart = chartPanel.getChart();
        XYPlot plot = (XYPlot) chart.getPlot();
        ValueAxis xAxis = plot.getDomainAxis();
        ValueAxis yAxis = plot.getRangeAxis();
        paint(g2, plot, dataArea, xAxis, yAxis, plot.getDomainAxisEdge(), plot.getRangeAxisEdge(), chartPanel);
        g2.setClip(savedClip);
    }
}

From source file:no.met.jtimeseries.chart.XYCardinalSplineRenderer.java

/**
 * Draws the item (first pass). This method draws the lines connecting the
 * items. Instead of drawing separate lines, a GeneralPath is constructed
 * and drawn at the end of the series painting.
 *
 * @param g2//ww w  .jav a  2s . c o  m
 *            the graphics device.
 * @param state
 *            the renderer state.
 * @param plot
 *            the plot (can be used to obtain standard color information
 *            etc).
 * @param dataset
 *            the dataset.
 * @param pass
 *            the pass.
 * @param series
 *            the series index (zero-based).
 * @param item
 *            the item index (zero-based).
 * @param domainAxis
 *            the domain axis.
 * @param rangeAxis
 *            the range axis.
 * @param dataArea
 *            the area within which the data is being drawn.
 */
@Override
protected void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset,
        int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) {

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    // get the data points
    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);

    // collect points
    if (!Double.isNaN(transX1) && !Double.isNaN(transY1)) {
        ControlPoint p = new ControlPoint(
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transY1 : (float) transX1,
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transX1 : (float) transY1);
        if (!this.points.contains(p)) {
            this.points.add(p);
        }
    }
    if (item == dataset.getItemCount(series) - 1) {
        State s = (State) state;
        // construct path
        // we need at least two points to draw something
        if (this.points.size() > 1) {
            ControlPoint cp0 = this.points.get(0);
            s.seriesPath.moveTo(cp0.x, cp0.y);
            // we need at least 2 points to spline. Draw simple line
            // for less then 2 points
            if (this.points.size() == 2) {
                ControlPoint cp1 = this.points.get(1);
                s.seriesPath.lineTo(cp1.x, cp1.y);

            } else {
                // construct spline
                // number of intervals (i.e. parametric curve would be
                // evaluted n+1 times)
                // set the minimum resolution
                int minimumN = 1;
                int maximumN = 4;

                // add two more points at the top and the end for drawing the curve between the first two and last two points
                this.points.add(0, this.points.get(0));
                this.points.add(this.points.get(this.points.size() - 1));

                // set the minimum distance when using minimumN
                double smallDistance = Math.pow(Math.pow(points.get(3).x - points.get(0).x, 2)
                        + Math.pow(points.get(3).y - points.get(0).y, 2), 0.5);

                double currentDistance;
                double currentN;

                List<ControlPoint> newPoints;
                for (int i = 0; i < this.points.size() - 3; i++) {
                    currentDistance = Math.pow(Math.pow(points.get(i + 3).x - points.get(i).x, 2)
                            + Math.pow(points.get(i + 3).y - points.get(i).y, 2), 0.5);
                    currentN = minimumN * currentDistance / smallDistance;
                    currentN = currentN > maximumN ? maximumN : currentN;
                    newPoints = evaluateCardinal2DAtNplusOneValues(this.points.get(i), this.points.get(i + 1),
                            this.points.get(i + 2), this.points.get(i + 3), tension, (int) currentN);
                    for (int j = 0; j < newPoints.size(); j++) {
                        s.seriesPath.lineTo(newPoints.get(j).x, newPoints.get(j).y);
                    }
                }
            }
            s.seriesPath.lineTo(points.get(points.size() - 1).x, points.get(points.size() - 1).y);
            // draw path
            drawFirstPassShape(g2, pass, series, item, s.seriesPath);

        }

        // reset points vector
        this.points = new Vector<ControlPoint>();
    }
}

From source file:no.met.jtimeseries.chart.XYCloudSymbolRenderer.java

/**
 * Draws the visual representation of a single symbol.
 *///from ww w.j av  a2  s  .c  om
@Override
public void drawItem(Graphics2D g2d, XYItemRendererState state, Rectangle2D plotArea, PlotRenderingInfo info,
        XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item,
        CrosshairState crosshairState, int pass) {
    // Needs a new graphics object to use translate() and rotate()
    Graphics2D g2 = (Graphics2D) g2d.create();
    g2.setRenderingHints(renderHints);

    double middleY = plotArea.getCenterY();
    CloudDataset cloudData = (CloudDataset) dataset;
    Number x = cloudData.getX(series, item);
    double middleX = domainAxis.valueToJava2D(x.doubleValue(), plotArea, plot.getDomainAxisEdge());
    g2.translate((int) middleX, (int) middleY); // make x=0, y=0 the middle of the symbol
    g2.setStroke(new BasicStroke());
    double height = plotArea.getHeight() - 2;

    // we set the width to be 20 which is the same as the weather symbols 
    double width = calculateWidth(plotArea.getWidth());
    double startX = -(width / 2);
    double startY[] = { -(height / 2), -(height / 4), 0, (height / 4) };
    double values[] = { (cloudData.getHighClouds(series, item).doubleValue() / 100.0),
            (cloudData.getMediumClouds(series, item).doubleValue() / 100.0),
            (cloudData.getLowClouds(series, item).doubleValue() / 100.0),
            (cloudData.getFog(series, item).doubleValue() / 100.0) };

    for (int i = 0; i < values.length; i++) { // for each cloud type
        g2.setColor(new Color(96, 96, 96));
        g2.fill(new Rectangle2D.Double(startX, startY[i], (width * values[i]), (height / 4 - 1))); // plot could
        g2.setColor(new Color(97, 204, 247));
        g2.fill(new Rectangle2D.Double(startX + (width * values[i]), startY[i], (width * (1 - values[i])),
                (height / 4 - 1))); // plot sky
    }
}

From source file:ec.ui.view.RevisionSaSeriesView.java

private void showSelectionPopup(Rectangle2D rectangle) {
    XYPlot plot = chartpanel_.getChart().getXYPlot();
    Rectangle2D dataArea = chartpanel_.getScreenDataArea();
    DateAxis domainAxis = (DateAxis) plot.getDomainAxis();
    double minX = domainAxis.java2DToValue(rectangle.getMinX(), dataArea, plot.getDomainAxisEdge());
    double maxX = domainAxis.java2DToValue(rectangle.getMaxX(), dataArea, plot.getDomainAxisEdge());

    Date startDate = new Date((long) minX);
    Date endDate = new Date((long) maxX);
    TsPeriod start = new TsPeriod(firstPeriod.getFrequency(), startDate);
    TsPeriod end = new TsPeriod(firstPeriod.getFrequency(), endDate);

    if (end.minus(start) == 0) {
        return;//from  www . j  a v a 2 s  .  c om
    }

    TsPeriodSelector sel = new TsPeriodSelector();
    sel.between(start.firstday(), end.lastday());
    List<TsData> listSeries = history_.Select(info_, startDate, endDate);
    List<TsData> revSeries = new ArrayList<>();

    for (TsData t : listSeries) {
        revSeries.add(t.select(sel));
    }

    Point pt = new Point((int) rectangle.getX(), (int) rectangle.getY());
    pt.translate(3, 3);
    SwingUtilities.convertPointToScreen(pt, chartpanel_);
    popup.setLocation(pt);
    popup.setChartTitle(info_.toUpperCase() + " First estimations");
    popup.setTsData(sRef.select(sel), revSeries);
    popup.setVisible(true);
    chartpanel_.repaint();
}

From source file:longMethod.jfreechart.drawItem.SamplingXYLineRenderer.java

/**
 * Draws the visual representation of a single data item.
 *
 * @param g2  the graphics device./*from   w  ww.  j av a2  s.c  o  m*/
 * @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.
 */
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);
    }
}