Search in sources :

Example 1 with XYIntervalSeries

use of org.jfree.data.xy.XYIntervalSeries in project SIMVA-SoS by SESoS.

the class XYBarRendererTest method testFindDomainBounds2.

/**
 * A test for the findDomainBounds method to ensure it correctly accounts
 * for the series visibility.
 */
@Test
public void testFindDomainBounds2() {
    XYIntervalSeries s1 = new XYIntervalSeries("S1");
    s1.add(1.0, 0.5, 1.5, 10.0, 9.5, 10.5);
    s1.add(2.0, 1.9, 2.1, 20.0, 19.8, 20.3);
    XYIntervalSeries s2 = new XYIntervalSeries("S2");
    s2.add(3.0, 2.5, 3.5, 30.0, 29.5, 30.5);
    s2.add(4.0, 3.9, 4.1, 9.0, 9.0, 9.0);
    XYIntervalSeriesCollection dataset = new XYIntervalSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);
    XYBarRenderer renderer = new XYBarRenderer();
    Range r = renderer.findDomainBounds(dataset);
    assertEquals(0.5, r.getLowerBound(), EPSILON);
    assertEquals(4.1, r.getUpperBound(), EPSILON);
    renderer.setSeriesVisible(1, Boolean.FALSE);
    r = renderer.findDomainBounds(dataset);
    assertEquals(0.5, r.getLowerBound(), EPSILON);
    assertEquals(2.1, r.getUpperBound(), EPSILON);
}
Also used : XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) Range(org.jfree.data.Range) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) Test(org.junit.Test)

Example 2 with XYIntervalSeries

use of org.jfree.data.xy.XYIntervalSeries in project SIMVA-SoS by SESoS.

the class XYBarRendererTest method testFindRangeBounds2.

/**
 * A test for the findRangeBounds method to ensure it correctly accounts
 * for the series visibility.
 */
@Test
public void testFindRangeBounds2() {
    XYIntervalSeries s1 = new XYIntervalSeries("S1");
    s1.add(1.0, 0.5, 1.5, 10.0, 9.5, 10.5);
    s1.add(2.0, 1.9, 2.1, 20.0, 19.8, 20.3);
    XYIntervalSeries s2 = new XYIntervalSeries("S2");
    s2.add(3.0, 2.5, 3.5, 30.0, 29.5, 30.5);
    s2.add(4.0, 3.9, 4.1, 9.0, 9.0, 9.0);
    XYIntervalSeriesCollection dataset = new XYIntervalSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(false);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(9.0, r.getLowerBound(), EPSILON);
    assertEquals(30.0, r.getUpperBound(), EPSILON);
    renderer.setSeriesVisible(1, Boolean.FALSE);
    r = renderer.findRangeBounds(dataset);
    assertEquals(10.0, r.getLowerBound(), EPSILON);
    assertEquals(20.0, r.getUpperBound(), EPSILON);
}
Also used : XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) Range(org.jfree.data.Range) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) Test(org.junit.Test)

Example 3 with XYIntervalSeries

use of org.jfree.data.xy.XYIntervalSeries in project SIMVA-SoS by SESoS.

the class DatasetUtilitiesTest method testBug2849731_2.

/**
 * Another test for bug 2849731.
 */
@Test
public void testBug2849731_2() {
    XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
    XYIntervalSeries s = new XYIntervalSeries("S1");
    s.add(1.0, Double.NaN, Double.NaN, Double.NaN, 1.5, Double.NaN);
    d.addSeries(s);
    Range r = DatasetUtilities.iterateDomainBounds(d);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(1.0, r.getUpperBound(), EPSILON);
    s.add(1.0, 1.5, Double.NaN, Double.NaN, 1.5, Double.NaN);
    r = DatasetUtilities.iterateDomainBounds(d);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(1.5, r.getUpperBound(), EPSILON);
    s.add(1.0, Double.NaN, 0.5, Double.NaN, 1.5, Double.NaN);
    r = DatasetUtilities.iterateDomainBounds(d);
    assertEquals(0.5, r.getLowerBound(), EPSILON);
    assertEquals(1.5, r.getUpperBound(), EPSILON);
}
Also used : XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) Range(org.jfree.data.Range) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) Test(org.junit.Test)

Example 4 with XYIntervalSeries

use of org.jfree.data.xy.XYIntervalSeries in project SIMVA-SoS by SESoS.

the class DatasetUtilitiesTest method testBug2849731_3.

/**
 * Yet another test for bug 2849731.
 */
@Test
public void testBug2849731_3() {
    XYIntervalSeriesCollection d = new XYIntervalSeriesCollection();
    XYIntervalSeries s = new XYIntervalSeries("S1");
    s.add(1.0, Double.NaN, Double.NaN, 1.5, Double.NaN, Double.NaN);
    d.addSeries(s);
    Range r = DatasetUtilities.iterateRangeBounds(d);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(1.5, r.getUpperBound(), EPSILON);
    s.add(1.0, 1.5, Double.NaN, Double.NaN, Double.NaN, 2.5);
    r = DatasetUtilities.iterateRangeBounds(d);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);
    s.add(1.0, Double.NaN, 0.5, Double.NaN, 3.5, Double.NaN);
    r = DatasetUtilities.iterateRangeBounds(d);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(3.5, r.getUpperBound(), EPSILON);
}
Also used : XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) Range(org.jfree.data.Range) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) Test(org.junit.Test)

Aggregations

Range (org.jfree.data.Range)4 XYIntervalSeries (org.jfree.data.xy.XYIntervalSeries)4 XYIntervalSeriesCollection (org.jfree.data.xy.XYIntervalSeriesCollection)4 Test (org.junit.Test)4