private void drawStepBar( Graphics2D g, S series, ArrayList<Point2D.Double> path, ArrayList<Point2D.Double> returnPath) { Collections.reverse(returnPath); // The last point will be a duplicate of the first. // Pop it before adding all to the main path returnPath.remove(returnPath.size() - 1); path.addAll(returnPath); Path2D.Double drawPath = new Path2D.Double(); // Start draw path from first point, which can then be discarded Point2D.Double startPoint = path.remove(0); drawPath.moveTo(startPoint.getX(), startPoint.getY()); // Prepare complete fill path for (Point2D.Double currentPoint : path) { drawPath.lineTo(currentPoint.getX(), currentPoint.getY()); } drawStepBarFill(g, series, drawPath); // Remove the bottom portion and draw only the upper outline drawPath.reset(); drawPath.moveTo(startPoint.getX(), startPoint.getY()); List<Point2D.Double> linePath = path.subList(0, path.size() - returnPath.size() + 1); for (Point2D.Double currentPoint : linePath) { drawPath.lineTo(currentPoint.getX(), currentPoint.getY()); } drawStepBarLine(g, series, drawPath); }
private void drawStepBar( Graphics2D g, S series, ArrayList<Point2D.Double> path, ArrayList<Point2D.Double> returnPath) { Collections.reverse(returnPath); // The last point will be a duplicate of the first. // Pop it before adding all to the main path returnPath.remove(returnPath.size() - 1); path.addAll(returnPath); Path2D.Double drawPath = new Path2D.Double(); // Start draw path from first point, which can then be discarded Point2D.Double startPoint = path.remove(0); drawPath.moveTo(startPoint.getX(), startPoint.getY()); // Prepare complete fill path for (Point2D.Double currentPoint : path) { drawPath.lineTo(currentPoint.getX(), currentPoint.getY()); } drawStepBarFill(g, series, drawPath); // Remove the bottom portion and draw only the upper outline drawPath.reset(); drawPath.moveTo(startPoint.getX(), startPoint.getY()); List<Point2D.Double> linePath = path.subList(0, path.size() - returnPath.size() + 1); for (Point2D.Double currentPoint : linePath) { drawPath.lineTo(currentPoint.getX(), currentPoint.getY()); } drawStepBarLine(g, series, drawPath); }