Example usage for org.jfree.data Range combineIgnoringNaN

List of usage examples for org.jfree.data Range combineIgnoringNaN

Introduction

In this page you can find the example usage for org.jfree.data Range combineIgnoringNaN.

Prototype

public static Range combineIgnoringNaN(Range range1, Range range2) 

Source Link

Document

Returns a new range that spans both range1 and range2.

Usage

From source file:org.jfree.data.RangeTest.java

/**
 * Some checks for the combineIgnoringNaN() method.
 *//*  ww w  .  j av a2  s.co m*/
@Test
public void testCombineIgnoringNaN() {
    Range r1 = new Range(1.0, 2.0);
    Range r2 = new Range(1.5, 2.5);

    assertNull(Range.combineIgnoringNaN(null, null));
    assertEquals(r1, Range.combineIgnoringNaN(r1, null));
    assertEquals(r2, Range.combineIgnoringNaN(null, r2));
    assertEquals(new Range(1.0, 2.5), Range.combineIgnoringNaN(r1, r2));

    Range r3 = new Range(Double.NaN, 1.3);
    Range rr = Range.combineIgnoringNaN(r1, r3);
    assertEquals(1.0, rr.getLowerBound(), EPSILON);
    assertEquals(2.0, rr.getUpperBound(), EPSILON);

    Range r4 = new Range(1.7, Double.NaN);
    rr = Range.combineIgnoringNaN(r4, r1);
    assertEquals(1.0, rr.getLowerBound(), EPSILON);
    assertEquals(2.0, rr.getUpperBound(), EPSILON);
}

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

/**
 * Returns the bounds for the y-values in the dataset.
 * //from   w  ww . j  a v  a  2  s  .c o m
 * @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.TimeSeriesCollection.java

/**
 * Returns the bounds for the y-values in the dataset.
 *
 * @param visibleSeriesKeys  the visible series keys.
 * @param xRange  the x-range (<code>null</code> not permitted).
 * @param includeInterval  ignored./*  ww w  .ja va 2 s .  co  m*/
 *
 * @return The bounds.
 *
 * @since 1.0.14
 */
@Override
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 = series.findValueRange(xRange, this.xPosition, this.workingCalendar.getTimeZone());
        result = Range.combineIgnoringNaN(result, r);
    }
    return result;
}