List of usage examples for org.jfree.data.category CategoryToPieDataset getUnderlyingDataset
public CategoryDataset getUnderlyingDataset()
From source file:org.jfree.data.category.CategoryToPieDatasetTest.java
/** * Some tests for the constructor.//w w w .j a v a2s. c o m */ @Test public void testConstructor() { // try a null source CategoryToPieDataset p1 = new CategoryToPieDataset(null, TableOrder.BY_COLUMN, 0); assertNull(p1.getUnderlyingDataset()); assertEquals(p1.getItemCount(), 0); assertTrue(p1.getKeys().isEmpty()); assertNull(p1.getValue("R1")); }
From source file:org.jfree.data.category.junit.CategoryToPieDatasetTest.java
/** * Some tests for the constructor./*from w w w . j a v a 2 s. c o m*/ */ public void testConstructor() { // try a null source CategoryToPieDataset p1 = new CategoryToPieDataset(null, TableOrder.BY_COLUMN, 0); assertNull(p1.getUnderlyingDataset()); assertEquals(p1.getItemCount(), 0); assertTrue(p1.getKeys().isEmpty()); assertNull(p1.getValue("R1")); }
From source file:org.openfaces.component.chart.impl.plots.PiePlot3DAdapter.java
private int getIterationCount(CategoryToPieDataset cds) { if (order == TableOrder.BY_ROW) { return cds.getUnderlyingDataset().getRowCount(); }/*from w ww. java 2 s. co m*/ if (order == TableOrder.BY_COLUMN) { return cds.getUnderlyingDataset().getColumnCount(); } return 0; }
From source file:org.jfree.data.category.CategoryToPieDatasetTest.java
/** * Serialize an instance, restore it, and check for equality. *///from w w w .j a v a 2s. c om @Test public void testSerialization() { DefaultCategoryDataset underlying = new DefaultCategoryDataset(); underlying.addValue(1.1, "R1", "C1"); underlying.addValue(2.2, "R1", "C2"); CategoryToPieDataset d1 = new CategoryToPieDataset(underlying, TableOrder.BY_COLUMN, 1); CategoryToPieDataset d2 = (CategoryToPieDataset) TestUtilities.serialised(d1); assertEquals(d1, d2); // regular equality for the datasets doesn't check the fields, just // the data values...so let's check some more things... assertEquals(d1.getUnderlyingDataset(), d2.getUnderlyingDataset()); assertEquals(d1.getExtractType(), d2.getExtractType()); assertEquals(d1.getExtractIndex(), d2.getExtractIndex()); }
From source file:org.jfree.data.category.junit.CategoryToPieDatasetTest.java
/** * Serialize an instance, restore it, and check for equality. *//*from w w w . j a va 2 s .co m*/ public void testSerialization() { DefaultCategoryDataset underlying = new DefaultCategoryDataset(); underlying.addValue(1.1, "R1", "C1"); underlying.addValue(2.2, "R1", "C2"); CategoryToPieDataset d1 = new CategoryToPieDataset(underlying, TableOrder.BY_COLUMN, 1); CategoryToPieDataset d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); d2 = (CategoryToPieDataset) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(d1, d2); // regular equality for the datasets doesn't check the fields, just // the data values...so let's check some more things... assertEquals(d1.getUnderlyingDataset(), d2.getUnderlyingDataset()); assertEquals(d1.getExtractType(), d2.getExtractType()); assertEquals(d1.getExtractIndex(), d2.getExtractIndex()); }