當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。