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


Java PieDataset.getValue方法代碼示例

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


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

示例1: createItemArray

import org.jfree.data.general.PieDataset; //導入方法依賴的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 key  the key.
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[3];
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    result[1] = this.numberFormat.format(value);  
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / DatasetUtilities.calculatePieDatasetTotal(dataset); 
        }
    }       
    result[2] = this.percentFormat.format(percent);
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:25,代碼來源:StandardPieItemLabelGenerator.java

示例2: createItemArray

import org.jfree.data.general.PieDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.  The returned array
 * contains four values:
 * <ul>
 * <li>result[0] = the section key converted to a <code>String</code>;</li>
 * <li>result[1] = the formatted data value;</li>
 * <li>result[2] = the formatted percentage (of the total);</li>
 * <li>result[3] = the formatted total value.</li>
 * </ul>
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[4];
    double total = DatasetUtilities.calculatePieDatasetTotal(dataset);
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    if (value != null) {
        result[1] = this.numberFormat.format(value);  
    }
    else {
        result[1] = "null";
    }
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / total; 
        }
    }       
    result[2] = this.percentFormat.format(percent);
    result[3] = this.numberFormat.format(total);
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:39,代碼來源:AbstractPieItemLabelGenerator.java

示例3: createItemArray

import org.jfree.data.general.PieDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the
 * {@link MessageFormat} class for creating labels.  The returned array
 * contains four values:
 * <ul>
 * <li>result[0] = the section key converted to a <code>String</code>;</li>
 * <li>result[1] = the formatted data value;</li>
 * <li>result[2] = the formatted percentage (of the total);</li>
 * <li>result[3] = the formatted total value.</li>
 * </ul>
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[4];
    double total = DatasetUtilities.calculatePieDatasetTotal(dataset);
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    if (value != null) {
        result[1] = this.numberFormat.format(value);
    }
    else {
        result[1] = "null";
    }
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / total;
        }
    }
    result[2] = this.percentFormat.format(percent);
    result[3] = this.numberFormat.format(total);
    return result;
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:39,代碼來源:AbstractPieItemLabelGenerator.java

示例4: createItemArray

import org.jfree.data.general.PieDataset; //導入方法依賴的package包/類
/**
 * Creates the array of items that can be passed to the
 * {@link MessageFormat} class for creating labels.  The returned array
 * contains four values:
 * <ul>
 * <li>result[0] = the section key converted to a {@code String};</li>
 * <li>result[1] = the formatted data value;</li>
 * <li>result[2] = the formatted percentage (of the total);</li>
 * <li>result[3] = the formatted total value.</li>
 * </ul>
 *
 * @param dataset  the dataset ({@code null} not permitted).
 * @param key  the key ({@code null} not permitted).
 *
 * @return The items (never {@code null}).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[4];
    double total = DatasetUtils.calculatePieDatasetTotal(dataset);
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    if (value != null) {
        result[1] = this.numberFormat.format(value);
    }
    else {
        result[1] = "null";
    }
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / total;
        }
    }
    result[2] = this.percentFormat.format(percent);
    result[3] = this.numberFormat.format(total);
    return result;
}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:39,代碼來源:AbstractPieItemLabelGenerator.java

示例5: equals

import org.jfree.data.general.PieDataset; //導入方法依賴的package包/類
/**
 * Tests this dataset for equality with an arbitrary object, returning
 * <code>true</code> if <code>obj</code> is a dataset containing the same
 * keys and values in the same order as this dataset.
 * 
 * @param obj  the object to test (<code>null</code> permitted).
 * 
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof PieDataset)) {
        return false;
    }
    PieDataset that = (PieDataset) obj;
    int count = getItemCount();
    if (that.getItemCount() != count) {
        return false;
    }
    for (int i = 0; i < count; i++) {
        Comparable k1 = getKey(i);
        Comparable k2 = that.getKey(i);
        if (!k1.equals(k2)) {
            return false;
        }

        Number v1 = getValue(i);
        Number v2 = that.getValue(i);
        if (v1 == null) {
            if (v2 != null) {
                return false;
            }
        }
        else {
            if (!v1.equals(v2)) {
                return false;
            }
        }
    }
    return true;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:44,代碼來源:CategoryToPieDataset.java

示例6: equals

import org.jfree.data.general.PieDataset; //導入方法依賴的package包/類
/**
 * Tests this dataset for equality with an arbitrary object, returning
 * <code>true</code> if <code>obj</code> is a dataset containing the same
 * keys and values in the same order as this dataset.
 *
 * @param obj  the object to test (<code>null</code> permitted).
 *
 * @return A boolean.
 */
@Override
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof PieDataset)) {
        return false;
    }
    PieDataset that = (PieDataset) obj;
    int count = getItemCount();
    if (that.getItemCount() != count) {
        return false;
    }
    for (int i = 0; i < count; i++) {
        Comparable k1 = getKey(i);
        Comparable k2 = that.getKey(i);
        if (!k1.equals(k2)) {
            return false;
        }

        Number v1 = getValue(i);
        Number v2 = that.getValue(i);
        if (v1 == null) {
            if (v2 != null) {
                return false;
            }
        }
        else {
            if (!v1.equals(v2)) {
                return false;
            }
        }
    }
    return true;
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:45,代碼來源:CategoryToPieDataset.java

示例7: equals

import org.jfree.data.general.PieDataset; //導入方法依賴的package包/類
/**
 * Tests this dataset for equality with an arbitrary object, returning
 * {@code true} if {@code obj} is a dataset containing the same
 * keys and values in the same order as this dataset.
 *
 * @param obj  the object to test ({@code null} permitted).
 *
 * @return A boolean.
 */
@Override
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof PieDataset)) {
        return false;
    }
    PieDataset that = (PieDataset) obj;
    int count = getItemCount();
    if (that.getItemCount() != count) {
        return false;
    }
    for (int i = 0; i < count; i++) {
        Comparable k1 = getKey(i);
        Comparable k2 = that.getKey(i);
        if (!k1.equals(k2)) {
            return false;
        }

        Number v1 = getValue(i);
        Number v2 = that.getValue(i);
        if (v1 == null) {
            if (v2 != null) {
                return false;
            }
        }
        else {
            if (!v1.equals(v2)) {
                return false;
            }
        }
    }
    return true;
}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:45,代碼來源:CategoryToPieDataset.java


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