My code (replacing 896-911 of AbstractXYItemRenderer):
Code: Select all
Polygon arrow = null;
if (orientation == PlotOrientation.HORIZONTAL) {
arrow = new Polygon(
new int[] {(int)dataArea.getMaxX(), (int)dataArea.getMaxX() + 5, (int)dataArea.getMaxX() + 5},
new int[] {(int)v, (int)v - 4, (int)v + 4},
3);
}
else if (orientation == PlotOrientation.VERTICAL) {
arrow = new Polygon(
new int[] {(int)v, (int)v - 4, (int)v + 4},
new int[] {(int)dataArea.getMinY(), (int)dataArea.getMinY() - 5, (int)dataArea.getMinY() - 5},
3);
}
g2.setPaint(marker.getPaint());
g2.setStroke(marker.getStroke());
Shape clip = g2.getClip();
g2.setClip(null);
g2.fill(arrow);
g2.setClip(clip);
In what ways can JFreeChart support this? A boolean for drawMarkersAsLines/AsArrows? A MarkerRenderer? What is a better solution to drawing the arrows outside the plot's drawable area without swapping out the clip like that?
Thanks.