Example usage for org.jfree.data.time TimeSeries getMinY

List of usage examples for org.jfree.data.time TimeSeries getMinY

Introduction

In this page you can find the example usage for org.jfree.data.time TimeSeries getMinY.

Prototype

public double getMinY() 

Source Link

Document

Returns the smallest y-value in the series, ignoring any null and Double.NaN values.

Usage

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Test for bug report 3446965.//from w ww.  java 2  s  .c  o  m
 */
public void testBug3446965() {
    TimeSeries s = new TimeSeries("s");
    s.addOrUpdate(new Year(2011), 100.0);
    s.addOrUpdate(new Year(2012), 150.0);
    s.addOrUpdate(new Year(2013), 200.0);
    s.addOrUpdate(new Year(2012), 250.0); // this line triggers the defect
    assertEquals(100.0, s.getMinY(), EPSILON);
    assertEquals(250.0, s.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count and a new value is added.
 *//*from  ww  w  .  jav  a  2  s.  com*/
public void testDelete_RegularTimePeriod() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    s1.add(new Year(2013), 4.4);
    s1.delete(new Year(2010));
    s1.delete(new Year(2013));
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count.//from   w  w  w  . ja  va 2  s.  c  o m
 */
public void testRemoveAgedItems4() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemAge(2);
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    s1.add(new Year(2013), 2.5);
    assertEquals(3, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Some checks for the update(RegularTimePeriod...method).
 *///www.  j a v a  2  s  . c o m
public void testUpdate_RegularTimePeriod() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    s1.update(new Year(2012), 4.4);
    assertEquals(4.4, s1.getMaxY(), EPSILON);
    s1.update(new Year(2010), 0.5);
    assertEquals(0.5, s1.getMinY(), EPSILON);
    s1.update(new Year(2012), null);
    assertEquals(2.2, s1.getMaxY(), EPSILON);
    s1.update(new Year(2010), null);
    assertEquals(2.2, s1.getMinY(), EPSILON);
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count and a new value is added.
 *///w  w  w . j a v a 2s.c  o m
@Test
public void testAdd() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemCount(2);
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    assertEquals(2, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * A test for the clear method./*from   w  w w  . j av a 2s .com*/
 */
@Test
public void testClear() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2009), 1.1);
    s1.add(new Year(2010), 2.2);

    assertEquals(2, s1.getItemCount());

    s1.clear();
    assertEquals(0, s1.getItemCount());
    assertTrue(Double.isNaN(s1.getMinY()));
    assertTrue(Double.isNaN(s1.getMaxY()));
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * Test the add branch of the addOrUpdate() method.
 *///from   ww  w . jav a2s  . c om
@Test
public void testAddOrUpdate2() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemCount(2);
    s1.addOrUpdate(new Year(2010), 1.1);
    s1.addOrUpdate(new Year(2011), 2.2);
    s1.addOrUpdate(new Year(2012), 3.3);
    assertEquals(2, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Check that the item bounds are determined correctly after a call to
 * removeAgedItems().//from w  w  w .  j ava2  s.  c o  m
 */
public void testRemoveAgedItems5() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemAge(4);
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    s1.add(new Year(2013), 2.5);
    s1.removeAgedItems(new Year(2015).getMiddleMillisecond(), true);
    assertEquals(3, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * Test for bug report 3446965./*  ww  w  . j a  v a 2 s  .  co m*/
 */
@Test
public void testBug3446965() {
    TimeSeries s = new TimeSeries("s");
    s.addOrUpdate(new Year(2011), 100.0);
    s.addOrUpdate(new Year(2012), 150.0);
    s.addOrUpdate(new Year(2013), 200.0);
    s.addOrUpdate(new Year(2012), 250.0); // this line triggers the defect
    assertEquals(100.0, s.getMinY(), EPSILON);
    assertEquals(250.0, s.getMaxY(), EPSILON);
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count and a new value is added.
 */// w  w w .ja va2  s . com
@Test
public void testDelete_RegularTimePeriod() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    s1.add(new Year(2013), 4.4);
    s1.delete(new Year(2010));
    s1.delete(new Year(2013));
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}