Example usage for org.jfree.data.xy XIntervalSeriesCollection addSeries

List of usage examples for org.jfree.data.xy XIntervalSeriesCollection addSeries

Introduction

In this page you can find the example usage for org.jfree.data.xy XIntervalSeriesCollection addSeries.

Prototype

public void addSeries(XIntervalSeries series) 

Source Link

Document

Adds a series to the collection and sends a DatasetChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.XIntervalSeriesCollectionDemo1.java

private static IntervalXYDataset createDataset() {
    XIntervalSeriesCollection xintervalseriescollection = new XIntervalSeriesCollection();
    XIntervalSeries xintervalseries = new XIntervalSeries("S1");
    xintervalseriescollection.addSeries(xintervalseries);
    return xintervalseriescollection;
}

From source file:org.esa.snap.rcp.statistics.StatisticsPanel.java

private static ChartPanel createChartPanel(XIntervalSeries percentileSeries, String xAxisLabel,
        String yAxisLabel, Color color) {
    XIntervalSeriesCollection percentileDataset = new XIntervalSeriesCollection();
    percentileDataset.addSeries(percentileSeries);
    return getHistogramPlotPanel(percentileDataset, xAxisLabel, yAxisLabel, color);
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * A test for bug report 1170825 (originally affected XYSeriesCollection,
 * this test is just copied over)./*  www  .j a v a 2 s.  c  om*/
 */
@Test
public void test1170825() {
    XIntervalSeries s1 = new XIntervalSeries("Series1");
    XIntervalSeriesCollection dataset = new XIntervalSeriesCollection();
    dataset.addSeries(s1);
    try {
        /* XYSeries s = */ dataset.getSeries(1);
    } catch (IllegalArgumentException e) {
        // correct outcome
    } catch (IndexOutOfBoundsException e) {
        assertTrue(false); // wrong outcome
    }
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * A test for bug report 1170825 (originally affected XYSeriesCollection,
 * this test is just copied over).//w  ww  . ja  v  a  2 s .  c  o  m
 */
public void test1170825() {
    XIntervalSeries s1 = new XIntervalSeries("Series1");
    XIntervalSeriesCollection dataset = new XIntervalSeriesCollection();
    dataset.addSeries(s1);
    try {
        /* XYSeries s = */ dataset.getSeries(1);
    } catch (IllegalArgumentException e) {
        // correct outcome
    } catch (IndexOutOfBoundsException e) {
        assertTrue(false); // wrong outcome
    }
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Some basic checks for the removeSeries() method.
 *///from   w  w w. j  a  va2 s.c o  m
@Test
public void testRemoveSeries() {
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("s1");
    c.addSeries(s1);
    c.removeSeries(0);
    assertEquals(0, c.getSeriesCount());
    c.addSeries(s1);

    boolean pass = false;
    try {
        c.removeSeries(-1);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);

    pass = false;
    try {
        c.removeSeries(1);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Confirm that cloning works.//from  w ww.  ja  v  a 2 s . com
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    XIntervalSeriesCollection c2 = (XIntervalSeriesCollection) c1.clone();
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    s1.setDescription("XYZ");
    assertFalse(c1.equals(c2));
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Some basic checks for the removeSeries() method.
 *//*from w w  w.  j  a  v  a2  s .  c om*/
public void testRemoveSeries() {
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("s1");
    c.addSeries(s1);
    c.removeSeries(0);
    assertEquals(0, c.getSeriesCount());
    c.addSeries(s1);

    boolean pass = false;
    try {
        c.removeSeries(-1);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);

    pass = false;
    try {
        c.removeSeries(1);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Confirm that cloning works./* www .ja  v a  2  s.com*/
 */
public void testCloning() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    XIntervalSeriesCollection c2 = null;
    try {
        c2 = (XIntervalSeriesCollection) c1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    s1.setDescription("XYZ");
    assertFalse(c1.equals(c2));
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*from w  w  w .j  ava 2 s .c  o m*/
@Test
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///from   w  w w.  j  a va 2s . co m
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}