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:utilesChart.util.TimeSeriesCollection.java

/**
 * Returns the bounds for the y-values in the dataset.
 *
 * @param visibleSeriesKeys  the visible series keys.
 * @param xRange  the x-range (null not permitted).
 * @param includeInterval  ignored.//  w w  w .  j  a  v a  2 s  . c o m
 *
 * @return The bounds.
 *
 * @since 1.0.14
 */
public Range getRangeBounds(List visibleSeriesKeys, Range xRange, boolean includeInterval) {
    Range result = null;
    Iterator iterator = visibleSeriesKeys.iterator();
    while (iterator.hasNext()) {
        Comparable seriesKey = (Comparable) iterator.next();
        TimeSeries series = getSeries(seriesKey);
        Range r = null;
        r = new Range(series.getMinY(), series.getMaxY());
        // FIXME: Here we are ignoring the xRange
        result = Range.combine(result, r);
    }
    return result;
}

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

/**
 * Returns the bounds for the y-values in the dataset.
 * //w ww.j  a  v  a 2  s  . c om
 * @param includeInterval  ignored for this dataset.
 * 
 * @return The range of value in the dataset (possibly <code>null</code>).
 *
 * @since 1.0.15
 */
public Range getRangeBounds(boolean includeInterval) {
    Range result = null;
    Iterator iterator = this.data.iterator();
    while (iterator.hasNext()) {
        TimeSeries series = (TimeSeries) iterator.next();
        Range r = new Range(series.getMinY(), series.getMaxY());
        result = Range.combineIgnoringNaN(result, r);
    }
    return result;
}

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

/**
 * Some checks for the getMinY() method.
 *///w ww  .j  a v a  2 s  . c  om
public void testGetMinY() {
    TimeSeries s1 = new TimeSeries("S1");
    assertTrue(Double.isNaN(s1.getMinY()));

    s1.add(new Year(2008), 1.1);
    assertEquals(1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2009), 2.2);
    assertEquals(1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2000), 99.9);
    assertEquals(1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2002), -1.1);
    assertEquals(-1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2003), null);
    assertEquals(-1.1, s1.getMinY(), EPSILON);

    s1.addOrUpdate(new Year(2002), null);
    assertEquals(1.1, s1.getMinY(), EPSILON);
}

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

/**
 * Some checks for the getMinY() method.
 *//*  w  w  w.  j a v  a 2s.co m*/
@Test
public void testGetMinY() {
    TimeSeries s1 = new TimeSeries("S1");
    assertTrue(Double.isNaN(s1.getMinY()));

    s1.add(new Year(2008), 1.1);
    assertEquals(1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2009), 2.2);
    assertEquals(1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2000), 99.9);
    assertEquals(1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2002), -1.1);
    assertEquals(-1.1, s1.getMinY(), EPSILON);

    s1.add(new Year(2003), null);
    assertEquals(-1.1, s1.getMinY(), EPSILON);

    s1.addOrUpdate(new Year(2002), null);
    assertEquals(1.1, s1.getMinY(), EPSILON);
}

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

@Test
public void testGetMinY2() {
    TimeSeries ts = new TimeSeries("Time Series");
    assertTrue(Double.isNaN(ts.getMinY()));

    ts.add(new Year(2014), 1.0);
    assertEquals(1.0, ts.getMinY(), EPSILON);

    ts.addOrUpdate(new Year(2014), null);
    assertTrue(Double.isNaN(ts.getMinY()));

    ts.addOrUpdate(new Year(2014), 1.0);
    assertEquals(1.0, ts.getMinY(), EPSILON);

    ts.clear();/* w w w .  ja  v a 2  s .  c  o  m*/
    assertTrue(Double.isNaN(ts.getMinY()));
}

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

/**
 * Checks that the min and max y values are updated correctly when copying
 * a subset./*  w  w w  .  java 2  s  .  co m*/
 *
 * @throws java.lang.CloneNotSupportedException
 */
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

/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count and a new value is added.
 *///from   w  ww  .j  a va2 s  . c o  m
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.junit.TimeSeriesTest.java

/**
 * A test for the clear method./*www.j a va  2  s.  co m*/
 */
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

/**
 * Checks that the min and max y values are updated correctly when copying
 * a subset.//ww w . j  a va  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  v  a2s . c om*/
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);
}