org.jfree.chart.renderer.category.CategoryItemRendererState Java Examples

The following examples show how to use org.jfree.chart.renderer.category.CategoryItemRendererState. 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: JGenProg2017_0081_t.java    From coming with MIT License 6 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();
    }
    return foundData;
    
}
 
Example #2
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void calculateBarWidth(CategoryPlot plot,
                                 Rectangle2D dataArea,
                                 int rendererIndex,
                                 CategoryItemRendererState state) {


    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
        PlotOrientation orientation = plot.getOrientation();
        double space = 0.0;
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        } else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaximumBarWidth();
        int columns = data.getColumnCount();
        double categoryMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }

        double used = space * (1 - domainAxis.getLowerMargin()
                - domainAxis.getUpperMargin()
                - categoryMargin);
        if (columns > 0) {
            state.setBarWidth(Math.min(used / columns, maxWidth));
        } else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }

}
 
Example #3
Source File: CategoryPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Perform a select for the item(s) at the specified (x, y) coordinates
 * in Java2D space.
 *
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 * @param dataArea  the data area.
 * @param source  the rendering source.
 *
 * @since 1.2.0
 */
public void select(double x, double y, Rectangle2D dataArea,
        RenderingSource source) {

    int datasetCount = this.datasets.size();
    for (int d = 0; d < datasetCount; d++) {
        CategoryDataset dataset = (CategoryDataset) this.datasets.get(d);
        if (dataset == null) {
            continue;
        }
        CategoryDatasetSelectionState state = findSelectionStateForDataset(
                dataset, source);
        if (state == null) {
            continue;
        }
        Graphics2D g2 = source.createGraphics2D();
        CategoryItemRenderer renderer = getRendererForDataset(dataset);
        CategoryItemRendererState rs = renderer.initialise(g2, dataArea,
                this, dataset, null);
        int rowCount = dataset.getRowCount();
        int columnCount = dataset.getColumnCount();
        for (int r = 0; r < rowCount; r++) {
            for (int c = 0; c < columnCount; c++) {
                if (renderer.hitTest(x, y, null, dataArea, this,
                        getDomainAxisForDataset(d),
                        getRangeAxisForDataset(d), dataset, r, c, false,
                        rs)) {
                    state.setSelected(r, c, !state.isSelected(r, c));
                }
            }
        }
    }
}
 
Example #4
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void drawStackVertical(List values, Comparable category,
                                 Graphics2D g2, CategoryItemRendererState state,
                                 Rectangle2D dataArea, CategoryPlot plot,
                                 CategoryAxis domainAxis, ValueAxis rangeAxis,
                                 CategoryDataset dataset) {

    drawStack(category, dataset, state, dataArea, plot, domainAxis, rangeAxis, values, g2,
            (double barX0, double barW, double vv0, double vv1,
             boolean inverted) -> createVerticalBlock(barX0, barW, vv0, vv1, inverted));
}
 
Example #5
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void drawStackHorizontal(List values, Comparable category,
                                   Graphics2D g2, CategoryItemRendererState state,
                                   Rectangle2D dataArea, CategoryPlot plot,
                                   CategoryAxis domainAxis, ValueAxis rangeAxis,
                                   CategoryDataset dataset) {

    drawStack(category, dataset, state, dataArea, plot, domainAxis, rangeAxis, values, g2,
            (double barX0, double barW, double vv0, double vv1,
             boolean inverted) -> createHorizontalBlock(barX0, barW, vv0, vv1, inverted));
}
 
Example #6
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
                     Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
                     ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
                     int pass) {


    if (row < dataset.getRowCount() - 1) {
        return;
    }
    Comparable category = dataset.getColumnKey(column);

    List values = createStackedValueList(dataset,
            dataset.getColumnKey(column), state.getVisibleSeriesArray(),
            getBase(), this.renderAsPercentages);

    Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),
            dataArea.getY() + getYOffset(),
            dataArea.getWidth() - getXOffset(),
            dataArea.getHeight() - getYOffset());


    PlotOrientation orientation = plot.getOrientation();


    if (orientation == PlotOrientation.HORIZONTAL) {
        drawStackHorizontal(values, category, g2, state, adjusted, plot,
                domainAxis, rangeAxis, dataset);
    } else {
        drawStackVertical(values, category, g2, state, adjusted, plot,
                domainAxis, rangeAxis, dataset);
    }

}
 
Example #7
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void calculateBarWidth(CategoryPlot plot,
                                 Rectangle2D dataArea,
                                 int rendererIndex,
                                 CategoryItemRendererState state) {


    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
        PlotOrientation orientation = plot.getOrientation();
        double space = 0.0;
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        } else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaximumBarWidth();
        int columns = data.getColumnCount();
        double categoryMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }

        double used = space * (1 - domainAxis.getLowerMargin()
                - domainAxis.getUpperMargin()
                - categoryMargin);
        if (columns > 0) {
            state.setBarWidth(Math.min(used / columns, maxWidth));
        } else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }

}
 
Example #8
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void drawStackVertical(List values, Comparable category,
                                 Graphics2D g2, CategoryItemRendererState state,
                                 Rectangle2D dataArea, CategoryPlot plot,
                                 CategoryAxis domainAxis, ValueAxis rangeAxis,
                                 CategoryDataset dataset) {

    drawStack(category, dataset, state, dataArea, plot, domainAxis, rangeAxis, values, g2,
            (double barX0, double barW, double vv0, double vv1,
             boolean inverted) -> createVerticalBlock(barX0, barW, vv0, vv1, inverted));
}
 
Example #9
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
                     Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
                     ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
                     int pass) {


    if (row < dataset.getRowCount() - 1) {
        return;
    }
    Comparable category = dataset.getColumnKey(column);

    List values = testProduct.createStackedValueList(dataset,
            dataset.getColumnKey(column), state.getVisibleSeriesArray(),
            getBase(), this.renderAsPercentages);

    Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),
            dataArea.getY() + getYOffset(),
            dataArea.getWidth() - getXOffset(),
            dataArea.getHeight() - getYOffset());


    PlotOrientation orientation = plot.getOrientation();


    if (orientation == PlotOrientation.HORIZONTAL) {
        drawStackHorizontal(values, category, g2, state, adjusted, plot,
                domainAxis, rangeAxis, dataset);
    } else {
        drawStackVertical(values, category, g2, state, adjusted, plot,
                domainAxis, rangeAxis, dataset);
    }

}
 
Example #10
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void calculateBarWidth(CategoryPlot plot,
                                 Rectangle2D dataArea,
                                 int rendererIndex,
                                 CategoryItemRendererState state) {


    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
        PlotOrientation orientation = plot.getOrientation();
        double space = 0.0;
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        } else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaximumBarWidth();
        int columns = data.getColumnCount();
        double categoryMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }

        double used = space * (1 - domainAxis.getLowerMargin()
                - domainAxis.getUpperMargin()
                - categoryMargin);
        if (columns > 0) {
            state.setBarWidth(Math.min(used / columns, maxWidth));
        } else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }

}
 
Example #11
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void drawStackVertical(List values, Comparable category,
                                 Graphics2D g2, CategoryItemRendererState state,
                                 Rectangle2D dataArea, CategoryPlot plot,
                                 CategoryAxis domainAxis, ValueAxis rangeAxis,
                                 CategoryDataset dataset) {

    drawStack(category, dataset, state, dataArea, plot, domainAxis, rangeAxis, values, g2,
            (double barX0, double barW, double vv0, double vv1,
             boolean inverted) -> createVerticalBlock(barX0, barW, vv0, vv1, inverted));
}
 
Example #12
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void drawStackHorizontal(List values, Comparable category,
                                   Graphics2D g2, CategoryItemRendererState state,
                                   Rectangle2D dataArea, CategoryPlot plot,
                                   CategoryAxis domainAxis, ValueAxis rangeAxis,
                                   CategoryDataset dataset) {

    drawStack(category, dataset, state, dataArea, plot, domainAxis, rangeAxis, values, g2,
            (double barX0, double barW, double vv0, double vv1,
             boolean inverted) -> createHorizontalBlock(barX0, barW, vv0, vv1, inverted));
}
 
Example #13
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
protected void drawStackHorizontal(List values, Comparable category,
                                   Graphics2D g2, CategoryItemRendererState state,
                                   Rectangle2D dataArea, CategoryPlot plot,
                                   CategoryAxis domainAxis, ValueAxis rangeAxis,
                                   CategoryDataset dataset) {

    drawStack(category, dataset, state, dataArea, plot, domainAxis, rangeAxis, values, g2,
            (double barX0, double barW, double vv0, double vv1,
             boolean inverted) -> createHorizontalBlock(barX0, barW, vv0, vv1, inverted));
}
 
Example #14
Source File: Test.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
                     Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
                     ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
                     int pass) {


    if (row < dataset.getRowCount() - 1) {
        return;
    }
    Comparable category = dataset.getColumnKey(column);

    List values = testProduct.createStackedValueList(dataset, dataset.getColumnKey(column), state.getVisibleSeriesArray(), getBase(), this.renderAsPercentages);

    Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX(),
            dataArea.getY() + getYOffset(),
            dataArea.getWidth() - getXOffset(),
            dataArea.getHeight() - getYOffset());


    PlotOrientation orientation = plot.getOrientation();


    if (orientation == PlotOrientation.HORIZONTAL) {
        drawStackHorizontal(values, category, g2, state, adjusted, plot,
                domainAxis, rangeAxis, dataset);
    } else {
        drawStackVertical(values, category, g2, state, adjusted, plot,
                domainAxis, rangeAxis, dataset);
    }

}
 
Example #15
Source File: jMutRepair_0021_s.java    From coming with MIT License 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 #16
Source File: jMutRepair_0021_t.java    From coming with MIT License 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 #17
Source File: jMutRepair_0030_t.java    From coming with MIT License 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 #18
Source File: jMutRepair_0030_s.java    From coming with MIT License 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 #19
Source File: jMutRepair_001_t.java    From coming with MIT License 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 #20
Source File: jMutRepair_001_s.java    From coming with MIT License 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 #21
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_t.java    From coming with MIT License 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 #22
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 #23
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_s.java    From coming with MIT License 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 #24
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_t.java    From coming with MIT License 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 #25
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_s.java    From coming with MIT License 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 #26
Source File: Chart_14_CategoryPlot_t.java    From coming with MIT License 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 #27
Source File: Chart_14_CategoryPlot_s.java    From coming with MIT License 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 #28
Source File: Chart_19_CategoryPlot_t.java    From coming with MIT License 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 #29
Source File: Chart_19_CategoryPlot_s.java    From coming with MIT License 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 #30
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;

}