本文整理汇总了Java中org.jfree.data.general.DatasetUtilities.createConsolidatedPieDataset方法的典型用法代码示例。如果您正苦于以下问题:Java DatasetUtilities.createConsolidatedPieDataset方法的具体用法?Java DatasetUtilities.createConsolidatedPieDataset怎么用?Java DatasetUtilities.createConsolidatedPieDataset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.general.DatasetUtilities
的用法示例。
在下文中一共展示了DatasetUtilities.createConsolidatedPieDataset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLimitPieDataset
import org.jfree.data.general.DatasetUtilities; //导入方法依赖的package包/类
/**
* Some checks for the limitPieDataset() methods.
*/
public void testLimitPieDataset() {
// check that empty dataset is handled OK
DefaultPieDataset d1 = new DefaultPieDataset();
PieDataset d2 = DatasetUtilities.createConsolidatedPieDataset(
d1, "Other", 0.05
);
assertEquals(0, d2.getItemCount());
// check that minItem limit is observed
d1.setValue("Item 1", 1.0);
d1.setValue("Item 2", 49.50);
d1.setValue("Item 3", 49.50);
d2 = DatasetUtilities.createConsolidatedPieDataset(d1, "Other", 0.05);
assertEquals(3, d2.getItemCount());
assertEquals("Item 1", d2.getKey(0));
assertEquals("Item 2", d2.getKey(1));
assertEquals("Item 3", d2.getKey(2));
// check that minItem limit is observed
d1.setValue("Item 4", 1.0);
d2 = DatasetUtilities.createConsolidatedPieDataset(
d1, "Other", 0.05, 2
);
// and that simple aggregation works
assertEquals(3, d2.getItemCount());
assertEquals("Item 2", d2.getKey(0));
assertEquals("Item 3", d2.getKey(1));
assertEquals("Other", d2.getKey(2));
assertEquals(new Double(2.0), d2.getValue("Other"));
}