org.jfree.data.time.TimeTableXYDataset Java Examples

The following examples show how to use org.jfree.data.time.TimeTableXYDataset. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimeTableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for a simple dataset.
 */
public void testStandard() {
    TimeTableXYDataset d = new TimeTableXYDataset();
    d.add(new Year(1999), 1.0, "Series 1");
    assertEquals(d.getItemCount(), 1);
    assertEquals(d.getSeriesCount(), 1);
    d.add(new Year(2000), 2.0, "Series 2");
    assertEquals(d.getItemCount(), 2);
    assertEquals(d.getSeriesCount(), 2);
    assertEquals(d.getYValue(0, 0), 1.0, DELTA);
    assertTrue(Double.isNaN(d.getYValue(0, 1)));
    assertTrue(Double.isNaN(d.getYValue(1, 0)));
    assertEquals(d.getYValue(1, 1), 2.0, DELTA);
}
 
Example #2
Source File: TimeTableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getTimePeriod() method.
 */
public void testGetTimePeriod()  {
    TimeTableXYDataset d = new TimeTableXYDataset();
    d.add(new Year(1999), 1.0, "Series 1");
    d.add(new Year(1998), 2.0, "Series 1");
    d.add(new Year(1996), 3.0, "Series 1");
    assertEquals(d.getTimePeriod(0), new Year(1996));
    assertEquals(d.getTimePeriod(1), new Year(1998));
    assertEquals(d.getTimePeriod(2), new Year(1999));
}
 
Example #3
Source File: TimeTableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test clearing data.
 */
public void testClear() {
    TimeTableXYDataset d = new TimeTableXYDataset();
    d.add(new Year(1999), 1.0, "Series 1");
    assertEquals(d.getItemCount(), 1);
    assertEquals(d.getSeriesCount(), 1);
    d.add(new Year(2000), 2.0, "Series 2");

    d.clear();
    // Make sure there's nothing left
    assertEquals(0, d.getItemCount());
    assertEquals(0, d.getSeriesCount());
}
 
Example #4
Source File: TimeTableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for a simple dataset.
 */
public void testStandard() {
    TimeTableXYDataset d = new TimeTableXYDataset();
    d.add(new Year(1999), 1.0, "Series 1");
    assertEquals(d.getItemCount(), 1);
    assertEquals(d.getSeriesCount(), 1);
    d.add(new Year(2000), 2.0, "Series 2");
    assertEquals(d.getItemCount(), 2);
    assertEquals(d.getSeriesCount(), 2);
    assertEquals(d.getYValue(0, 0), 1.0, DELTA);
    assertTrue(Double.isNaN(d.getYValue(0, 1)));
    assertTrue(Double.isNaN(d.getYValue(1, 0)));
    assertEquals(d.getYValue(1, 1), 2.0, DELTA);
}
 
Example #5
Source File: TimeTableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getTimePeriod() method.
 */
public void testGetTimePeriod()  {
    TimeTableXYDataset d = new TimeTableXYDataset();
    d.add(new Year(1999), 1.0, "Series 1");
    d.add(new Year(1998), 2.0, "Series 1");
    d.add(new Year(1996), 3.0, "Series 1");
    assertEquals(d.getTimePeriod(0), new Year(1996));
    assertEquals(d.getTimePeriod(1), new Year(1998));
    assertEquals(d.getTimePeriod(2), new Year(1999));
}
 
Example #6
Source File: TimeTableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test clearing data.
 */
public void testClear() {
    TimeTableXYDataset d = new TimeTableXYDataset();
    d.add(new Year(1999), 1.0, "Series 1");
    assertEquals(d.getItemCount(), 1);
    assertEquals(d.getSeriesCount(), 1);
    d.add(new Year(2000), 2.0, "Series 2"); 

    d.clear();
    // Make sure there's nothing left
    assertEquals(0, d.getItemCount());
    assertEquals(0, d.getSeriesCount());
}