Java Code Examples for org.jfree.util.SortOrder#ASCENDING

The following examples show how to use org.jfree.util.SortOrder#ASCENDING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegendTitle.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new legend title with the specified arrangement.
 *
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source,
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.sortOrder = SortOrder.ASCENDING;
}
 
Example 2
Source File: LegendTitle.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new legend title with the specified arrangement.
 *
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source,
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.sortOrder = SortOrder.ASCENDING;
}
 
Example 3
Source File: LegendTitle.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new legend title with the specified arrangement.
 *
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source,
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.sortOrder = SortOrder.ASCENDING;
}
 
Example 4
Source File: LegendTitle.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new legend title with the specified arrangement.
 *
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source,
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.sortOrder = SortOrder.ASCENDING;
}
 
Example 5
Source File: LegendTitle.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new legend title with the specified arrangement.
 *
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source,
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.sortOrder = SortOrder.ASCENDING;
}
 
Example 6
Source File: LegendTitle.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new legend title with the specified arrangement.
 *
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source,
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.sortOrder = SortOrder.ASCENDING;
}
 
Example 7
Source File: CategoryPlot.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * @param crosshairState  a state object for tracking crosshair info
 *        (<code>null</code> permitted).
 *
 * @return A boolean that indicates whether or not real data was found.
 *
 * @since 1.0.11
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index,
        PlotRenderingInfo info, CategoryCrosshairState crosshairState) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {

        foundData = true;
        CategoryItemRendererState state = renderer.initialise(g2, dataArea,
                this, index, info);
        state.setCrosshairState(crosshairState);
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
        }
    }
    return foundData;

}
 
Example 8
Source File: CategoryPlot.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * @param crosshairState  a state object for tracking crosshair info
 *        (<code>null</code> permitted).
 *
 * @return A boolean that indicates whether or not real data was found.
 *
 * @since 1.0.11
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index,
        PlotRenderingInfo info, CategoryCrosshairState crosshairState) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {

        foundData = true;
        CategoryItemRendererState state = renderer.initialise(g2, dataArea,
                this, index, info);
        state.setCrosshairState(crosshairState);
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
        }
    }
    return foundData;

}
 
Example 9
Source File: CategoryPlot.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * @param crosshairState  a state object for tracking crosshair info
 *        (<code>null</code> permitted).
 *
 * @return A boolean that indicates whether or not real data was found.
 *
 * @since 1.0.11
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index,
        PlotRenderingInfo info, CategoryCrosshairState crosshairState) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {

        foundData = true;
        CategoryItemRendererState state = renderer.initialise(g2, dataArea,
                this, index, info);
        state.setCrosshairState(crosshairState);
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
        }
    }
    return foundData;

}
 
Example 10
Source File: CategoryPlot.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * @param crosshairState  a state object for tracking crosshair info
 *        (<code>null</code> permitted).
 *
 * @return A boolean that indicates whether or not real data was found.
 *
 * @since 1.0.11
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index,
        PlotRenderingInfo info, CategoryCrosshairState crosshairState) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {

        foundData = true;
        CategoryItemRendererState state = renderer.initialise(g2, dataArea,
                this, index, info);
        state.setCrosshairState(crosshairState);
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
        }
    }
    return foundData;

}
 
Example 11
Source File: CategoryPlot.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * 
 * @return A boolean that indicates whether or not real data was found.
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index, 
                      PlotRenderingInfo info) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {
        
        foundData = true;
        CategoryItemRendererState state = renderer.initialise(
            g2, dataArea, this, index, info
        );
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {            
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this, 
                                    domainAxis, rangeAxis, currentDataset, 
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this, 
                                    domainAxis, rangeAxis, currentDataset, 
                                    row, column, pass);
                        }                        
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this, 
                                    domainAxis, rangeAxis, currentDataset, 
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this, 
                                    domainAxis, rangeAxis, currentDataset, 
                                    row, column, pass);
                        }                        
                    }
                }
            }
        }
    }
    return foundData;
    
}
 
Example 12
Source File: CategoryPlot.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * @param crosshairState  a state object for tracking crosshair info
 *        (<code>null</code> permitted).
 *
 * @return A boolean that indicates whether or not real data was found.
 *
 * @since 1.0.11
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index,
        PlotRenderingInfo info, CategoryCrosshairState crosshairState) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {

        foundData = true;
        CategoryItemRendererState state = renderer.initialise(g2, dataArea,
                this, index, info);
        state.setCrosshairState(crosshairState);
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
        }
    }
    return foundData;

}
 
Example 13
Source File: CategoryPlot.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws a representation of a dataset within the dataArea region using the
 * appropriate renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param index  the dataset and renderer index.
 * @param info  an optional object for collection dimension information.
 * @param crosshairState  a state object for tracking crosshair info
 *        (<code>null</code> permitted).
 *
 * @return A boolean that indicates whether or not real data was found.
 *
 * @since 1.0.11
 */
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index,
        PlotRenderingInfo info, CategoryCrosshairState crosshairState) {

    boolean foundData = false;
    CategoryDataset currentDataset = getDataset(index);
    CategoryItemRenderer renderer = getRenderer(index);
    CategoryAxis domainAxis = getDomainAxisForDataset(index);
    ValueAxis rangeAxis = getRangeAxisForDataset(index);
    boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && renderer != null) {

        foundData = true;
        CategoryItemRendererState state = renderer.initialise(g2, dataArea,
                this, index, info);
        state.setCrosshairState(crosshairState);
        int columnCount = currentDataset.getColumnCount();
        int rowCount = currentDataset.getRowCount();
        int passCount = renderer.getPassCount();
        for (int pass = 0; pass < passCount; pass++) {
            if (this.columnRenderingOrder == SortOrder.ASCENDING) {
                for (int column = 0; column < columnCount; column++) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
            else {
                for (int column = columnCount - 1; column >= 0; column--) {
                    if (this.rowRenderingOrder == SortOrder.ASCENDING) {
                        for (int row = 0; row < rowCount; row++) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                    else {
                        for (int row = rowCount - 1; row >= 0; row--) {
                            renderer.drawItem(g2, state, dataArea, this,
                                    domainAxis, rangeAxis, currentDataset,
                                    row, column, pass);
                        }
                    }
                }
            }
        }
    }
    return foundData;

}