afreechart/src/main/java/org/afree/chart/plot/XYPlot.java
/**
     * Draws a representation of the data within the dataArea region, using the
     * current renderer.
     * <P>
     * The <code>info</code> and <code>crosshairState</code> arguments may be
     * <code>null</code>.
     * 
     * @param canvas
     *            the graphics device.
     * @param dataArea
     *            the region in which the data is to be drawn.
     * @param index
     *            the dataset index.
     * @param info
     *            an optional object for collection dimension information.
     * @param crosshairState
     *            collects crosshair information (<code>null</code> permitted).
     * 
     * @return A flag that indicates whether any data was actually rendered.
     */
Draws a representation of the data within the dataArea region, using the
current renderer.

The info and crosshairState arguments may be
null.

@param canvas
the graphics device.
@param dataArea
the region in which the data is to be drawn.
@param index
the dataset index.
@param info
an optional object for collection dimension information.
@param crosshairState
collects crosshair information (null permitted).

@return A flag that indicates whether any data was actually rendered.
Draws a representation of the data within the dataArea region using the current renderer . The info and crosshairState arguments may be null . @param canvas the graphics device . @param dataArea the region in which the data is to be drawn . @param index the dataset index . @param info an optional object for collection dimension information . @param crosshairState collects crosshair information ( null permitted ) . @return A flag that indicates whether any data was actually rendered .
public boolean render(Canvas canvas, RectShape dataArea, int index,
            PlotRenderingInfo info, CrosshairState crosshairState) {
        boolean foundData = false;
        XYDataset dataset = getDataset(index);
        if (!DatasetUtilities.isEmptyOrNull(dataset)) {
            foundData = true;
            ValueAxis xAxis = getDomainAxisForDataset(index);
            ValueAxis yAxis = getRangeAxisForDataset(index);
            if (xAxis == null || yAxis == null) {
                return foundData; 
            }
            XYItemRenderer renderer = getRenderer(index);
            if (renderer == null) {
                renderer = getRenderer();
                if (renderer == null) { 
                    return foundData;
                }
            }
            XYItemRendererState state = renderer.initialise(canvas, dataArea, this,
                    dataset, info);
            int passCount = renderer.getPassCount();
            SeriesRenderingOrder seriesOrder = getSeriesRenderingOrder();
            if (seriesOrder == SeriesRenderingOrder.REVERSE) {
                for (int pass = 0; pass < passCount; pass++) {
                    int seriesCount = dataset.getSeriesCount();
                    for (int series = seriesCount - 1; series >= 0; series--) {
                        int firstItem = 0;
                        int lastItem = dataset.getItemCount(series) - 1;
                        if (lastItem == -1) {
                            continue;
                        }
                        if (state.getProcessVisibleItemsOnly()) {
                            int[] itemBounds = RendererUtilities.findLiveItems(
                                    dataset, series, xAxis.getLowerBound(),
                                    xAxis.getUpperBound());
                            firstItem = Math.max(itemBounds[0] - 1, 0);
                            lastItem = Math.min(itemBounds[1] + 1, lastItem);
                        }
                        state.startSeriesPass(dataset, series, firstItem,
                                lastItem, pass, passCount);
                        for (int item = firstItem; item <= lastItem; item++) {
                            renderer.drawItem(canvas, state, dataArea, info, this,
                                    xAxis, yAxis, dataset, series, item,
                                    crosshairState, pass);
                        }
                        state.endSeriesPass(dataset, series, firstItem,
                                lastItem, pass, passCount);
                    }
                }
            } else {
                for (int pass = 0; pass < passCount; pass++) {
                    int seriesCount = dataset.getSeriesCount();
                    for (int series = 0; series < seriesCount; series++) {
                        int firstItem = 0;
                        int lastItem = dataset.getItemCount(series) - 1;
                        if (state.getProcessVisibleItemsOnly()) {
                            int[] itemBounds = RendererUtilities.findLiveItems(
                                    dataset, series, xAxis.getLowerBound(),
                                    xAxis.getUpperBound());
                            firstItem = Math.max(itemBounds[0] - 1, 0);
                            lastItem = Math.min(itemBounds[1] + 1, lastItem);
                        }
                        state.startSeriesPass(dataset, series, firstItem,
                                lastItem, pass, passCount);
                        for (int item = firstItem; item <= lastItem; item++) {
                            renderer.drawItem(canvas, state, dataArea, info, this,
                                    xAxis, yAxis, dataset, series, item,
                                    crosshairState, pass);
                        }
                        state.endSeriesPass(dataset, series, firstItem,
                                lastItem, pass, passCount);
                    }
                }
            }
        }
        return foundData;
    }
public boolean render ( Canvas canvas , RectShape dataArea , int index , PlotRenderingInfo info , CrosshairState crosshairState ) { boolean foundData = false ; XYDataset dataset = getDataset ( index ) ; if ( ! DatasetUtilities . isEmptyOrNull ( dataset ) ) { foundData = true ; ValueAxis xAxis = getDomainAxisForDataset ( index ) ; ValueAxis yAxis = getRangeAxisForDataset ( index ) ; if ( xAxis == null || yAxis == null ) { return foundData ; } XYItemRenderer renderer = getRenderer ( index ) ; if ( renderer == null ) { renderer = getRenderer ( ) ; if ( renderer == null ) { return foundData ; } } XYItemRendererState state = renderer . initialise ( canvas , dataArea , this , dataset , info ) ; int passCount = renderer . getPassCount ( ) ; SeriesRenderingOrder seriesOrder = getSeriesRenderingOrder ( ) ; if ( seriesOrder == SeriesRenderingOrder . REVERSE ) { for ( int pass = 0 ; pass < passCount ; pass ++ ) { int seriesCount = dataset . getSeriesCount ( ) ; for ( int series = seriesCount - 1 ; series >= 0 ; series -- ) { int firstItem = 0 ; int lastItem = dataset . getItemCount ( series ) - 1 ; if ( lastItem == - 1 ) { continue ; } if ( state . getProcessVisibleItemsOnly ( ) ) { int [ ] itemBounds = RendererUtilities . findLiveItems ( dataset , series , xAxis . getLowerBound ( ) , xAxis . getUpperBound ( ) ) ; firstItem = Math . max ( itemBounds [ 0 ] - 1 , 0 ) ; lastItem = Math . min ( itemBounds [ 1 ] + 1 , lastItem ) ; } state . startSeriesPass ( dataset , series , firstItem , lastItem , pass , passCount ) ; for ( int item = firstItem ; item <= lastItem ; item ++ ) { renderer . drawItem ( canvas , state , dataArea , info , this , xAxis , yAxis , dataset , series , item , crosshairState , pass ) ; } state . endSeriesPass ( dataset , series , firstItem , lastItem , pass , passCount ) ; } } } else { for ( int pass = 0 ; pass < passCount ; pass ++ ) { int seriesCount = dataset . getSeriesCount ( ) ; for ( int series = 0 ; series < seriesCount ; series ++ ) { int firstItem = 0 ; int lastItem = dataset . getItemCount ( series ) - 1 ; if ( state . getProcessVisibleItemsOnly ( ) ) { int [ ] itemBounds = RendererUtilities . findLiveItems ( dataset , series , xAxis . getLowerBound ( ) , xAxis . getUpperBound ( ) ) ; firstItem = Math . max ( itemBounds [ 0 ] - 1 , 0 ) ; lastItem = Math . min ( itemBounds [ 1 ] + 1 , lastItem ) ; } state . startSeriesPass ( dataset , series , firstItem , lastItem , pass , passCount ) ; for ( int item = firstItem ; item <= lastItem ; item ++ ) { renderer . drawItem ( canvas , state , dataArea , info , this , xAxis , yAxis , dataset , series , item , crosshairState , pass ) ; } state . endSeriesPass ( dataset , series , firstItem , lastItem , pass , passCount ) ; } } } } return foundData ; }
Draws a representation of the data within the dataArea region, using the
 current renderer.
Draws a representation of the data within the dataArea region using the current renderer .
// can't render anything without axes // no default renderer available // render series in reverse order // render series in forward order