当前位置: 首页>>代码示例>>Java>>正文


Java CategoryDataset.getColumnCount方法代码示例

本文整理汇总了Java中org.jfree.data.category.CategoryDataset.getColumnCount方法的典型用法代码示例。如果您正苦于以下问题:Java CategoryDataset.getColumnCount方法的具体用法?Java CategoryDataset.getColumnCount怎么用?Java CategoryDataset.getColumnCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.data.category.CategoryDataset的用法示例。


在下文中一共展示了CategoryDataset.getColumnCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialise

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Initialises the renderer and returns a state object that will be used
 * for the remainder of the drawing process for a single chart.  The state
 * object allows for the fact that the renderer may be used simultaneously
 * by multiple threads (each thread will work with a separate state object).
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param rendererIndex  the renderer index.
 * @param info  an object for returning information about the structure of
 *              the plot (<code>null</code> permitted).
 *
 * @return The renderer state.
 */
public CategoryItemRendererState initialise(Graphics2D g2,
                                            Rectangle2D dataArea,
                                            CategoryPlot plot,
                                            int rendererIndex,
                                            PlotRenderingInfo info) {

    setPlot(plot);
    CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
        this.rowCount = data.getRowCount();
        this.columnCount = data.getColumnCount();
    }
    else {
        this.rowCount = 0;
        this.columnCount = 0;
    }
    return createState(info);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:AbstractCategoryItemRenderer.java

示例2: isEmptyOrNull

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if the dataset is empty (or <code>null</code>),
 * and <code>false</code> otherwise.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public static boolean isEmptyOrNull(CategoryDataset dataset) {

    if (dataset == null) {
        return true;
    }

    int rowCount = dataset.getRowCount();
    int columnCount = dataset.getColumnCount();
    if (rowCount == 0 || columnCount == 0) {
        return true;
    }

    for (int r = 0; r < rowCount; r++) {
        for (int c = 0; c < columnCount; c++) {
            if (dataset.getValue(r, c) != null) {
                return false;
            }

        }
    }

    return true;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:DatasetUtilities.java

示例3: isEmptyOrNull

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if the dataset is empty (or <code>null</code>), and
 * <code>false</code> otherwise.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public static boolean isEmptyOrNull(CategoryDataset dataset) {

    if (dataset == null) {
        return true;
    }

    int rowCount = dataset.getRowCount();
    int columnCount = dataset.getColumnCount();
    if (rowCount == 0 || columnCount == 0) {
        return true;
    }

    for (int r = 0; r < rowCount; r++) {
        for (int c = 0; c < columnCount; c++) {
            if (dataset.getValue(r, c) != null) {
                return false;
            }

        }
    }

    return true;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:DatasetUtilities.java

示例4: calculateBarWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, 
                                 Rectangle2D dataArea, 
                                 int rendererIndex,
                                 CategoryItemRendererState state) {
                                     
    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
        int columns = dataset.getColumnCount();
        int rows = dataset.getRowCount();
        double space = 0.0;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaximumBarWidth();
        double categoryMargin = 0.0;
        double currentItemMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }
        if (rows > 1) {
            currentItemMargin = getItemMargin();
        }
        double used = space * (1 - domainAxis.getLowerMargin() 
                                 - domainAxis.getUpperMargin()
                                 - categoryMargin - currentItemMargin);
        if ((rows * columns) > 0) {
            state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
        }
        else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:BarRenderer.java

示例5: calculateItemWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateItemWidth(CategoryPlot plot, 
                                  Rectangle2D dataArea, 
                                  int rendererIndex,
                                  CategoryItemRendererState state) {
                                     
    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
        int columns = dataset.getColumnCount();
        int rows = dataset.getRowCount();
        double space = 0.0;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaxItemWidth();
        double categoryMargin = 0.0;
        double currentItemMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }
        if (rows > 1) {
            currentItemMargin = getItemMargin();
        }
        double used = space * (1 - domainAxis.getLowerMargin() 
                                 - domainAxis.getUpperMargin()
                                 - categoryMargin - currentItemMargin);
        if ((rows * columns) > 0) {
            state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
        }
        else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:LevelRenderer.java

示例6: drawDomainGridlines

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Draws the gridlines for the plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * 
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea) {

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible()) {
        CategoryAnchor anchor = getDomainGridlinePosition();
        RectangleEdge domainAxisEdge = getDomainAxisEdge();
        Stroke gridStroke = getDomainGridlineStroke();
        Paint gridPaint = getDomainGridlinePaint();
        if ((gridStroke != null) && (gridPaint != null)) {
            // iterate over the categories
            CategoryDataset data = getDataset();
            if (data != null) {
                CategoryAxis axis = getDomainAxis();
                if (axis != null) {
                    int columnCount = data.getColumnCount();
                    for (int c = 0; c < columnCount; c++) {
                        double xx = axis.getCategoryJava2DCoordinate(
                                anchor, c, columnCount, dataArea, 
                                domainAxisEdge);
                        CategoryItemRenderer renderer1 = getRenderer();
                        if (renderer1 != null) {
                            renderer1.drawDomainGridline(g2, this, 
                                    dataArea, xx);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:CategoryPlot.java

示例7: calculateBarWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, 
                                 Rectangle2D dataArea, 
                                 int rendererIndex,
                                 CategoryItemRendererState state) {
                                     
    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
        int columns = dataset.getColumnCount();
        int rows = dataset.getRowCount();
        double space = 0.0;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaxBarWidth();
        double categoryMargin = 0.0;
        double currentItemMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }
        if (rows > 1) {
            currentItemMargin = getItemMargin();
        }
        double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin()
                                 - categoryMargin - currentItemMargin);
        if ((rows * columns) > 0) {
            state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
        }
        else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:46,代码来源:BarRenderer.java

示例8: calculateBarWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, 
                                 Rectangle2D dataArea, 
                                 int rendererIndex,
                                 CategoryItemRendererState state) {

    // calculate the bar width
    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
        int columns = dataset.getColumnCount();
        int rows = dataset.getRowCount();
        double space = 0.0;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double categoryMargin = 0.0;
        double currentItemMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }
        if (rows > 1) {
            currentItemMargin = getItemMargin();
        }
        double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin()
                                 - categoryMargin - currentItemMargin);
        if ((rows * columns) > 0) {
            state.setBarWidth(used / (dataset.getColumnCount()));
        } 
        else {
            state.setBarWidth(used);
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:46,代码来源:LayeredBarRenderer.java

示例9: calculateBarWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, 
                                 Rectangle2D dataArea, 
                                 int rendererIndex,
                                 CategoryItemRendererState state) {

    // calculate the bar width
    CategoryAxis xAxis = plot.getDomainAxisForDataset(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 * getMaxBarWidth();
        int columns = data.getColumnCount();
        double categoryMargin = 0.0;
        if (columns > 1) {
            categoryMargin = xAxis.getCategoryMargin();
        }

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

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:StackedBarRenderer.java

示例10: calculateBarWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, 
                                 Rectangle2D dataArea, 
                                 int rendererIndex,
                                 CategoryItemRendererState state) {

    // calculate the bar width - this calculation differs from the
    // BarRenderer calculation because the bars are layered on top of one
    // another, so there is effectively only one bar per category for
    // the purpose of the bar width calculation
    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
        int columns = dataset.getColumnCount();
        int rows = dataset.getRowCount();
        double space = 0.0;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double maxWidth = space * getMaximumBarWidth();
        double categoryMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }
        double used = space * (1 - domainAxis.getLowerMargin() 
            - domainAxis.getUpperMargin() - categoryMargin);
        if ((rows * columns) > 0) {
            state.setBarWidth(Math.min(used / (dataset.getColumnCount()), 
                    maxWidth));
        } 
        else {
            state.setBarWidth(Math.min(used, maxWidth));
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:LayeredBarRenderer.java

示例11: iterateCategoryRangeExtent

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Iterates over the data item of the category dataset to find
 * the range extent.
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * 
 * @return The range (possibly <code>null</code>).
 */
public static Range iterateCategoryRangeExtent(CategoryDataset dataset) {
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int rowCount = dataset.getRowCount();
    int columnCount = dataset.getColumnCount();
    for (int row = 0; row < rowCount; row++) {
        for (int column = 0; column < columnCount; column++) {
            Number lvalue;
            Number uvalue;
            if (dataset instanceof IntervalCategoryDataset) {
                IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
                lvalue = icd.getStartValue(row, column);
                uvalue = icd.getEndValue(row, column);
            }
            else {
                lvalue = dataset.getValue(row, column);
                uvalue = lvalue;
            }
            if (lvalue != null) {
                minimum = Math.min(minimum, lvalue.doubleValue());
            }
            if (uvalue != null) {
                maximum = Math.max(maximum, uvalue.doubleValue());
            }
        }
    }
    if (minimum == Double.POSITIVE_INFINITY) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:DatasetUtilities.java

示例12: createPieDatasetForRow

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Creates a pie dataset from a table dataset by taking all the values
 * for a single row.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row (zero-based index).
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForRow(CategoryDataset dataset, 
                                                int row) {
    DefaultPieDataset result = new DefaultPieDataset();
    int columnCount = dataset.getColumnCount();
    for (int current = 0; current < columnCount; current++) {
        Comparable columnKey = dataset.getColumnKey(current);
        result.setValue(columnKey, dataset.getValue(row, current));
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:DatasetUtilities.java

示例13: findMinimumStackedRangeValue

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Returns the minimum value in the dataset range, assuming that values in
 * each category are "stacked".
 *
 * @param dataset  the dataset.
 *
 * @return the minimum value.
 */
public static Number findMinimumStackedRangeValue(CategoryDataset dataset) {

    Number result = null;

    if (dataset != null) {

        double minimum = 0.0;

        int categoryCount = dataset.getRowCount();
        for (int item = 0; item < categoryCount; item++) {
            double total = 0.0;

            int seriesCount = dataset.getColumnCount();
            for (int series = 0; series < seriesCount; series++) {
                Number number = dataset.getValue(series, item);
                if (number != null) {
                    double value = number.doubleValue();
                    if (value < 0.0) {
                        total = total + value;  // '+', remember value is negative
                    }
                }
            }
            minimum = Math.min(minimum, total);

        }

        result = new Double(minimum);

    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:DatasetUtilities.java

示例14: findMinimumStackedRangeValue

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Returns the minimum value in the dataset range, assuming that values in
 * each category are "stacked".
 *
 * @param dataset  the dataset.
 *
 * @return The minimum value.
 */
public static Number findMinimumStackedRangeValue(CategoryDataset dataset) {

    Number result = null;
    if (dataset != null) {
        double minimum = 0.0;
        int categoryCount = dataset.getRowCount();
        for (int item = 0; item < categoryCount; item++) {
            double total = 0.0;

            int seriesCount = dataset.getColumnCount();
            for (int series = 0; series < seriesCount; series++) {
                Number number = dataset.getValue(series, item);
                if (number != null) {
                    double value = number.doubleValue();
                    if (value < 0.0) {
                        total = total + value;  
                        // '+', remember value is negative
                    }
                }
            }
            minimum = Math.min(minimum, total);

        }
        result = new Double(minimum);
    }
    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:DatasetUtilities.java

示例15: calculateBarWidth

import org.jfree.data.category.CategoryDataset; //导入方法依赖的package包/类
/**
 * Calculates the bar width and stores it in the renderer state.  We 
 * override the method in the base class to take account of the 
 * series-to-group mapping.
 * 
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, 
                                 Rectangle2D dataArea, 
                                 int rendererIndex,
                                 CategoryItemRendererState state) {

    // calculate the bar width
    CategoryAxis xAxis = plot.getDomainAxisForDataset(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 groups = this.seriesToGroupMap.getGroupCount();
        int categories = data.getColumnCount();
        int columns = groups * categories;
        double categoryMargin = 0.0;
        double itemMargin = 0.0;
        if (categories > 1) {
            categoryMargin = xAxis.getCategoryMargin();
        }
        if (groups > 1) {
            itemMargin = getItemMargin();   
        }

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

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:53,代码来源:GroupedStackedBarRenderer.java


注:本文中的org.jfree.data.category.CategoryDataset.getColumnCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。