Example usage for org.jfree.data.time.ohlc OHLCSeriesCollection getSeries

List of usage examples for org.jfree.data.time.ohlc OHLCSeriesCollection getSeries

Introduction

In this page you can find the example usage for org.jfree.data.time.ohlc OHLCSeriesCollection getSeries.

Prototype

public OHLCSeries getSeries(int series) 

Source Link

Document

Returns a series from the collection.

Usage

From source file:org.jfree.data.time.ohlc.OHLCSeriesCollectionTest.java

/**
 * A test for bug report 1170825 (originally affected XYSeriesCollection,
 * this test is just copied over).//from   w ww.  j  av  a 2s. c  o  m
 */
@Test
public void test1170825() {
    OHLCSeries s1 = new OHLCSeries("Series1");
    OHLCSeriesCollection dataset = new OHLCSeriesCollection();
    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.time.ohlc.OHLCSeriesCollectionTest.java

/**
 * Some checks for the {@link OHLCSeriesCollection#removeSeries(int)}
 * method./*w w w .ja v a 2  s  .  co m*/
 */
@Test
public void testRemoveSeries_int() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeries s1 = new OHLCSeries("Series 1");
    OHLCSeries s2 = new OHLCSeries("Series 2");
    OHLCSeries s3 = new OHLCSeries("Series 3");
    OHLCSeries s4 = new OHLCSeries("Series 4");
    c1.addSeries(s1);
    c1.addSeries(s2);
    c1.addSeries(s3);
    c1.addSeries(s4);
    c1.removeSeries(2);
    assertTrue(c1.getSeries(2).equals(s4));
    c1.removeSeries(0);
    assertTrue(c1.getSeries(0).equals(s2));
    assertEquals(2, c1.getSeriesCount());
}

From source file:org.jfree.data.time.ohlc.OHLCSeriesCollectionTest.java

/**
 * Some checks for the/*w w  w . jav a2 s. c o m*/
 * {@link OHLCSeriesCollection#removeSeries(OHLCSeries)} method.
 */
@Test
public void testRemoveSeries() {
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    OHLCSeries s1 = new OHLCSeries("Series 1");
    OHLCSeries s2 = new OHLCSeries("Series 2");
    OHLCSeries s3 = new OHLCSeries("Series 3");
    OHLCSeries s4 = new OHLCSeries("Series 4");
    c1.addSeries(s1);
    c1.addSeries(s2);
    c1.addSeries(s3);
    c1.addSeries(s4);
    c1.removeSeries(s3);
    assertTrue(c1.getSeries(2).equals(s4));
    c1.removeSeries(s1);
    assertTrue(c1.getSeries(0).equals(s2));
    assertEquals(2, c1.getSeriesCount());
}