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

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

Introduction

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

Prototype

public Range findValueRange() 

Source Link

Document

Returns the range of y-values in the time series.

Usage

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

@Test
public void testFindValueRange() {
    TimeSeries ts = new TimeSeries("Time Series");
    assertNull(ts.findValueRange());

    ts.add(new Year(2014), 1.0);
    assertEquals(new Range(1.0, 1.0), ts.findValueRange());

    ts.add(new Year(2015), 2.0);
    assertEquals(new Range(1.0, 2.0), ts.findValueRange());

    // null items are ignored
    ts.add(new Year(2016), null);
    assertEquals(new Range(1.0, 2.0), ts.findValueRange());

    ts.clear();/*from   ww  w  .  j a va2 s  .  c om*/
    assertNull(ts.findValueRange());

    // if there are only null items, we get a NaNRange
    ts.add(new Year(2014), null);
    assertTrue(ts.findValueRange().isNaNRange());
}