@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 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)) { this.points.add(new Point2D.Double(transX1, transY1)); } // if this is the last item, draw the path ... if (item == s.getLastItemIndex()) { List<Point2D> pts = this.getCurvePoints(); s.seriesPath.moveTo(pts.get(0).getX(), pts.get(0).getY()); for (int i = 1; i < pts.size(); i++) { final Point2D p = pts.get(i); s.seriesPath.lineTo(p.getX(), p.getY()); } // draw path drawFirstPassShape(g2, pass, series, item, s.seriesPath); this.points.clear(); } }
/** * Initialises the renderer. * <P> * This method will be called before the first item is rendered, giving the * renderer an opportunity to initialise any state information it wants to * maintain. The renderer can do nothing if it chooses. * * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param plot the plot. * @param data the data. * @param info an optional info collection object to return data back to * the caller. * * @return The renderer state. */ public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = new State(info); state.seriesPath = new GeneralPath(); return state; }
@Override public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = (State) super.initialise(g2, dataArea, plot, data, info); state.setProcessVisibleItemsOnly(false); this.points.clear(); setDrawSeriesLineAsPath(true); return state; }
y = (float) transX1; if (s.isLastPointGood()) { s.seriesPath.lineTo(x, y); s.seriesPath.moveTo(x, y); s.setLastPointGood(true); s.setLastPointGood(false); if (item == s.getLastItemIndex()) {
y = (float) transX1; if (s.isLastPointGood()) { s.seriesPath.lineTo(x, y); s.seriesPath.moveTo(x, y); s.setLastPointGood(true); } else { s.setLastPointGood(false); if (item == s.getLastItemIndex()) {
/** * Initialises the renderer. * <P> * This method will be called before the first item is rendered, giving the * renderer an opportunity to initialise any state information it wants to * maintain. The renderer can do nothing if it chooses. * * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param plot the plot. * @param data the data. * @param info an optional info collection object to return data back to * the caller. * * @return The renderer state. */ public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = (State) super.initialise(g2, dataArea, plot, data, info); state.setProcessVisibleItemsOnly(false); this.points = new Vector(); setDrawSeriesLineAsPath(true); return state; }
/** * Initialises the renderer. * <P> * This method will be called before the first item is rendered, giving the * renderer an opportunity to initialise any state information it wants to * maintain. The renderer can do nothing if it chooses. * * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param plot the plot. * @param data the data. * @param info an optional info collection object to return data back to * the caller. * * @return The renderer state. */ @Override public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { return new State(info); }