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

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

Introduction

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

Prototype

public double getMaxY() 

Source Link

Document

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

Usage

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

/**
 * Checks that the min and max y values are updated correctly when copying
 * a subset./*from w ww  .j ava  2  s  .c o m*/
 *
 * @throws java.lang.CloneNotSupportedException
 */
@Test
public void testCreateCopy3() throws CloneNotSupportedException {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2009), 100.0);
    s1.add(new Year(2010), 101.0);
    s1.add(new Year(2011), 102.0);
    assertEquals(100.0, s1.getMinY(), EPSILON);
    assertEquals(102.0, s1.getMaxY(), EPSILON);

    TimeSeries s2 = s1.createCopy(0, 1);
    assertEquals(100.0, s2.getMinY(), EPSILON);
    assertEquals(101.0, s2.getMaxY(), EPSILON);

    TimeSeries s3 = s1.createCopy(1, 2);
    assertEquals(101.0, s3.getMinY(), EPSILON);
    assertEquals(102.0, s3.getMaxY(), EPSILON);
}

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

/**
 * Test the add branch of the addOrUpdate() method.
 *///  w  w w  . j a  va 2 s  .c o  m
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

/**
 * Test for bug report 3446965.//  www .j  a va 2s .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.
 *//* w ww  .j a  v  a2 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 ww .j  a v a2s. com*/
 */
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.TimeSeriesTest.java

/**
 * A test for the clear method.//from w  w  w  . j  a  v a 2  s  .c  om
 */
@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

/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count and a new value is added.
 *///from w  w  w .ja  v  a 2  s  .  com
@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

/**
 * Test the add branch of the addOrUpdate() method.
 *///from  ww w  .  jav  a 2 s  .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()./* w  ww. j  a  v  a 2 s . c  om*/
 */
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./*from w w w. ja v a2  s.c  o  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);
}