List of usage examples for org.jfree.chart.plot PlotRenderingInfo PlotRenderingInfo
public PlotRenderingInfo(ChartRenderingInfo owner)
From source file:org.jfree.chart.plot.StackedXYPlot.java
/** * Draws the plot.//from w w w .j a va2 s. c om * @param graphics2d the graphics device. * @param plotArea the plot plotArea (in Java2D space). * @param anchor an anchor point in Java2D space (<code>null</code> permitted). * @param parentState the state from the parent plot (<code>null</code> permitted). * @param plotRenderingInfo chart drawing information (<code>null</code> permitted). */ @Override public void draw(Graphics2D graphics2d, Rectangle2D plotArea, Point2D anchor, PlotState parentState, PlotRenderingInfo plotRenderingInfo) { if (plotRenderingInfo != null) { plotRenderingInfo.setPlotArea(plotArea); } RectangleInsets insets = getInsets(); insets.trim(plotArea); setFixedRangeAxisSpaceForSubplots(null); //calculateAxisSpace will also calculate sub-plot plotArea AxisSpace space = calculateAxisSpace(graphics2d, plotArea); Rectangle2D dataArea = space.shrink(plotArea, null); Rectangle2D[] calculatedSubPlotAreas = null; //get subplotsAreas from parent class try { calculatedSubPlotAreas = (Rectangle2D[]) FieldUtils.readField(this, "subplotAreas", true); } catch (IllegalAccessException ex) { Logger.getLogger(StackedXYPlot.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } setFixedRangeAxisSpaceForSubplots(space); // draw all the subplots for (int i = 0; i < getSubplots().size(); i++) { XYPlot plot = (XYPlot) getSubplots().get(i); PlotRenderingInfo subplotInfo = null; if (plotRenderingInfo != null) { subplotInfo = new PlotRenderingInfo(plotRenderingInfo.getOwner()); plotRenderingInfo.addSubplotInfo(subplotInfo); } plot.draw(graphics2d, calculatedSubPlotAreas[i], anchor, parentState, subplotInfo); } if (plotRenderingInfo != null) { plotRenderingInfo.setDataArea(dataArea); } }