當前位置: 首頁>>代碼示例>>Java>>正文


Java CategoryDataset.getValue方法代碼示例

本文整理匯總了Java中org.jfree.data.category.CategoryDataset.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java CategoryDataset.getValue方法的具體用法?Java CategoryDataset.getValue怎麽用?Java CategoryDataset.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.data.category.CategoryDataset的用法示例。


在下文中一共展示了CategoryDataset.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPreviousHeight

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Calculates the stacked value of the all series up to, but not including <code>series</code>
 * for the specified category, <code>category</code>.  It returns 0.0 if <code>series</code>
 * is the first series, i.e. 0.
 *
 * @param data  the data.
 * @param series  the series.
 * @param category  the category.
 *
 * @return double returns a cumulative value for all series' values up to but excluding
 *                <code>series</code> for Object <code>category</code>.
 */
protected double getPreviousHeight(CategoryDataset data, int series, int category) {

    double result = 0.0;

    Number tmp;
    for (int i = 0; i < series; i++) {
        tmp = data.getValue(i, category);
        if (tmp != null) {
            result += tmp.doubleValue();
        }
    }

    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:28,代碼來源:StackedAreaRenderer.java

示例2: createItemArray

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param series  the series (zero-based index).
 * @param item  the item (zero-based index).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(CategoryDataset dataset, int series, 
                                   int item) {
    Object[] result = new Object[8];
    result[0] = dataset.getRowKey(series);
    Number y = dataset.getValue(series, item);
    NumberFormat formatter = getNumberFormat();
    result[1] = formatter.format(y);
    if (dataset instanceof BoxAndWhiskerCategoryDataset) {
        BoxAndWhiskerCategoryDataset d 
            = (BoxAndWhiskerCategoryDataset) dataset;
        result[2] = formatter.format(d.getMeanValue(series, item));
        result[3] = formatter.format(d.getMedianValue(series, item));
        result[4] = formatter.format(d.getMinRegularValue(series, item));
        result[5] = formatter.format(d.getMaxRegularValue(series, item));
        result[6] = formatter.format(d.getQ1Value(series, item));
        result[7] = formatter.format(d.getQ3Value(series, item));
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:BoxAndWhiskerToolTipGenerator.java

示例3: createItemArray

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(CategoryDataset dataset, 
                                   int row, int column) {
    Object[] result = new Object[4];
    result[0] = dataset.getRowKey(row).toString();
    result[1] = dataset.getColumnKey(column).toString();
    Number value = dataset.getValue(row, column);
    if (value != null) {
        if (this.numberFormat != null) {
            result[2] = this.numberFormat.format(value);  
        }
        else if (this.dateFormat != null) {
            result[2] = this.dateFormat.format(value);
        }
    }
    else {
        result[2] = this.nullValueString;   
    }
    if (value != null) {
        double total = DataUtilities.calculateColumnTotal(dataset, column);
        double percent = value.doubleValue() / total;
        result[3] = this.percentFormat.format(percent);
    }
   
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:36,代碼來源:AbstractCategoryItemLabelGenerator.java

示例4: generateLabel

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
* Generates a label for the specified item. The label is typically a
* formatted version of the data value, but any text can be used.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param series the series index (zero-based).
* @param category the category index (zero-based).
*
* @return the label (possibly <code>null</code>).
*/
public String generateLabel(CategoryDataset dataset,
int series,
int category) {
String result = null;
Number value = dataset.getValue(series, category);
if (value != null) {
double v = value.doubleValue();
if (v > this.threshold) {
result = value.toString(); // could apply formatting here
}
}
return result;
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:24,代碼來源:ItemLabelGeneratorVictims.java

示例5: createItemArray

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the <code>MessageFormat</code> class
 * for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(CategoryDataset dataset, int row, int column) {
    Object[] result = new Object[5];
    result[0] = dataset.getRowKey(row).toString();
    result[1] = dataset.getColumnKey(column).toString();
    Number value = dataset.getValue(row, column);
    if (getNumberFormat() != null) {
        result[2] = getNumberFormat().format(value);  
    }
    else if (getDateFormat() != null) {
        result[2] = getDateFormat().format(value);
    }
    
    if (dataset instanceof IntervalCategoryDataset) {
        IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
        Number start = icd.getStartValue(row, column);
        Number end = icd.getEndValue(row, column);
        if (getNumberFormat() != null) {
            result[3] = getNumberFormat().format(start);  
            result[4] = getNumberFormat().format(end);  
        }
        else if (getDateFormat() != null) {
            result[3] = getDateFormat().format(start);
            result[4] = getDateFormat().format(end);
        }
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:38,代碼來源:IntervalCategoryToolTipGenerator.java

示例6: findCumulativeRangeBounds

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Calculates the range of values for a dataset where each item is the 
 * running total of the items for the current series.
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * 
 * @return The range.
 */
public static Range findCumulativeRangeBounds(CategoryDataset dataset) {
    
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    
    boolean allItemsNull = true; // we'll set this to false if there is at 
                                 // least one non-null data item... 
    double minimum = 0.0;
    double maximum = 0.0;
    for (int row = 0; row < dataset.getRowCount(); row++) {
        double runningTotal = 0.0;
        for (int column = 0; column < dataset.getColumnCount() - 1; 
             column++) {
            Number n = dataset.getValue(row, column);
            if (n != null) {
                allItemsNull = false;
                double value = n.doubleValue();
                runningTotal = runningTotal + value;
                minimum = Math.min(minimum, runningTotal);
                maximum = Math.max(maximum, runningTotal);
            }
        }    
    }
    if (!allItemsNull) {
        return new Range(minimum, maximum);
    }
    else {
        return null;
    }
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:41,代碼來源:DatasetUtilities.java

示例7: createItemArray

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the {@link MessageFormat} class
 * for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(CategoryDataset dataset, int row, int column) {
    Object[] result = new Object[3];
    result[0] = dataset.getRowKey(row).toString();
    result[1] = dataset.getColumnKey(column).toString();
    Number value = dataset.getValue(row, column);
    if (this.numberFormat != null) {
        result[2] = this.numberFormat.format(value);  
    }
    else if (this.dateFormat != null) {
        result[2] = this.dateFormat.format(value);
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:24,代碼來源:AbstractCategoryItemLabelGenerator.java

示例8: iterateCategoryRangeBounds

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Iterates over the data item of the category dataset to find
 * the range bounds.
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param includeInterval  a flag that determines whether or not the
 *                         y-interval is taken into account.
 * 
 * @return The range (possibly <code>null</code>).
 */
public static Range iterateCategoryRangeBounds(CategoryDataset dataset, 
        boolean includeInterval) {
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    boolean interval = includeInterval 
                       && dataset instanceof IntervalCategoryDataset;
    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 (interval) {
                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,代碼行數:48,代碼來源:DatasetUtilities.java

示例9: 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

示例10: findMaximumStackedRangeValue

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Returns the maximum value in the dataset range, assuming that values in
 * each category are "stacked".
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumStackedRangeValue(CategoryDataset dataset) {

    Number result = null;

    if (dataset != null) {
        double maximum = 0.0;
        int categoryCount = dataset.getColumnCount();
        for (int item = 0; item < categoryCount; item++) {
            double total = 0.0;
            int seriesCount = dataset.getRowCount();
            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;
                    }
                }
            }
            maximum = Math.max(maximum, total);
        }
        result = new Double(maximum);
    }

    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:36,代碼來源:DatasetUtilities.java

示例11: findCumulativeRangeExtent

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Calculates the range of values for a dataset where each item is the running total of 
 * the items for the current series.
 * 
 * @param dataset  the dataset.
 * 
 * @return The range.
 */
public static Range findCumulativeRangeExtent(CategoryDataset dataset) {
    

    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    
    boolean allItemsNull = true; // we'll set this to false if there is at least one
                                 // non-null data item... 
    double minimum = 0.0;
    double maximum = 0.0;
    for (int row = 0; row < dataset.getRowCount(); row++) {
        double runningTotal = 0.0;
        for (int column = 0; column < dataset.getColumnCount() - 1; column++) {
            Number n = dataset.getValue(row, column);
            if (n != null) {
                allItemsNull = false;
                double value = n.doubleValue();
                runningTotal = runningTotal + value;
                minimum = Math.min(minimum, runningTotal);
                maximum = Math.max(maximum, runningTotal);
            }
        }    
    }
    if (!allItemsNull) {
        return new Range(minimum, maximum);
    }
    else {
        return null;
    }
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:41,代碼來源:DatasetUtilities.java

示例12: createItemArray

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the 
 * <code>MessageFormat</code> class for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(CategoryDataset dataset, 
                                   int row, int column) {
    Object[] result = new Object[5];
    result[0] = dataset.getRowKey(row).toString();
    result[1] = dataset.getColumnKey(column).toString();
    Number value = dataset.getValue(row, column);
    if (getNumberFormat() != null) {
        result[2] = getNumberFormat().format(value);  
    }
    else if (getDateFormat() != null) {
        result[2] = getDateFormat().format(value);
    }
    
    if (dataset instanceof IntervalCategoryDataset) {
        IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
        Number start = icd.getStartValue(row, column);
        Number end = icd.getEndValue(row, column);
        if (getNumberFormat() != null) {
            result[3] = getNumberFormat().format(start);  
            result[4] = getNumberFormat().format(end);  
        }
        else if (getDateFormat() != null) {
            result[3] = getDateFormat().format(start);
            result[4] = getDateFormat().format(end);
        }
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:39,代碼來源:IntervalCategoryToolTipGenerator.java

示例13: findMinimumRangeValue

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Returns the minimum range value for the specified dataset.  This is easy if the 
 * dataset implements the {@link RangeInfo} interface (a good idea if there is an 
 * efficient way to determine the minimum value).  Otherwise, it involves iterating 
 * over the entire data-set.  Returns <code>null</code> if all the data values in the 
 * dataset are <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The minimum value (possibly <code>null</code>).
 */
public static Number findMinimumRangeValue(CategoryDataset dataset) {

    // check parameters...
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }

    // work out the minimum value...
    if (dataset instanceof RangeInfo) {
        RangeInfo info = (RangeInfo) dataset;
        return info.getMinimumRangeValue();
    }

    // hasn't implemented RangeInfo, so we'll have to iterate...
    else {
        double minimum = Double.POSITIVE_INFINITY;
        int seriesCount = dataset.getRowCount();
        int itemCount = dataset.getColumnCount();
        for (int series = 0; series < seriesCount; series++) {
            for (int item = 0; item < itemCount; item++) {
                Number value;
                if (dataset instanceof IntervalCategoryDataset) {
                    IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
                    value = icd.getStartValue(series, item);
                }
                else {
                    value = dataset.getValue(series, item);
                }
                if (value != null) {
                    minimum = Math.min(minimum, value.doubleValue());
                }
            }
        }
        if (minimum == Double.POSITIVE_INFINITY) {
            return null;
        }
        else {
            return new Double(minimum);
        }

    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:55,代碼來源:DatasetUtilities.java

示例14: findMaximumRangeValue

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Returns the maximum range value for the specified dataset.  This is easy if the 
 * dataset implements the {@link RangeInfo} interface (a good idea if there is an 
 * efficient way to determine the maximum value).  Otherwise, it involves iterating over 
 * the entire data-set.  Returns <code>null</code> if all the data values are 
 * <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumRangeValue(CategoryDataset dataset) {

    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }

    // work out the minimum value...
    if (dataset instanceof RangeInfo) {
        RangeInfo info = (RangeInfo) dataset;
        return info.getMaximumRangeValue();
    }

    // hasn't implemented RangeInfo, so we'll have to iterate...
    else {

        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getRowCount();
        int itemCount = dataset.getColumnCount();
        for (int series = 0; series < seriesCount; series++) {
            for (int item = 0; item < itemCount; item++) {
                Number value;
                if (dataset instanceof IntervalCategoryDataset) {
                    IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
                    value = icd.getEndValue(series, item);
                }
                else {
                    value = dataset.getValue(series, item);
                }
                if (value != null) {
                    maximum = Math.max(maximum, value.doubleValue());
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            return null;
        }
        else {
            return new Double(maximum);
        }

    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:55,代碼來源:DatasetUtilities.java

示例15: findStackedRangeExtent

import org.jfree.data.category.CategoryDataset; //導入方法依賴的package包/類
/**
 * Returns the minimum and maximum values for the dataset's range (as in domain/range),
 * assuming that the series in one category are stacked.
 *
 * @param dataset  the dataset.
 * @param map  a structure that maps series to groups.
 *
 * @return the value range.
 */
public static Range findStackedRangeExtent(CategoryDataset dataset,
                                           KeyToGroupMap map) {

    Range result = null;
    if (dataset != null) {
        
        // create an array holding the group indices...
        int[] groupIndex = new int[dataset.getRowCount()];
        for (int i = 0; i < dataset.getRowCount(); i++) {
            groupIndex[i] = map.getGroupIndex(map.getGroup(dataset.getRowKey(i)));   
        }
        
        // minimum and maximum for each group...
        int groupCount = map.getGroupCount();
        double[] minimum = new double[groupCount];
        double[] maximum = new double[groupCount];
        
        int categoryCount = dataset.getColumnCount();
        for (int item = 0; item < categoryCount; item++) {
            double[] positive = new double[groupCount];
            double[] negative = new double[groupCount];
            int seriesCount = dataset.getRowCount();
            for (int series = 0; series < seriesCount; series++) {
                Number number = dataset.getValue(series, item);
                if (number != null) {
                    double value = number.doubleValue();
                    if (value > 0.0) {
                        positive[groupIndex[series]] = positive[groupIndex[series]] + value;
                    }
                    if (value < 0.0) {
                        negative[groupIndex[series]] = negative[groupIndex[series]] + value;
                        // '+', remember value is negative
                    }
                }
            }
            for (int g = 0; g < groupCount; g++) {
                minimum[g] = Math.min(minimum[g], negative[g]);
                maximum[g] = Math.max(maximum[g], positive[g]);
            }
        }
        for (int j = 0; j < groupCount; j++) {
            result = Range.combine(result, new Range(minimum[j], maximum[j]));
        }
    }
    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:57,代碼來源:DatasetUtilities.java


注:本文中的org.jfree.data.category.CategoryDataset.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。