Example usage for org.jfree.data.xy VectorSeriesCollection removeSeries

List of usage examples for org.jfree.data.xy VectorSeriesCollection removeSeries

Introduction

In this page you can find the example usage for org.jfree.data.xy VectorSeriesCollection removeSeries.

Prototype

public boolean removeSeries(VectorSeries series) 

Source Link

Document

Removes the specified series from the collection and sends a DatasetChangeEvent to all registered listeners.

Usage

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

/**
 * Some checks for the removeSeries() method.
 *//* ww  w .j a  v  a2s. c  o m*/
@Test
public void testRemoveSeries() {
    VectorSeries s1 = new VectorSeries("S1");
    VectorSeries s2 = new VectorSeries("S2");
    VectorSeriesCollection vsc = new VectorSeriesCollection();
    vsc.addSeries(s1);
    vsc.addSeries(s2);
    assertEquals(2, vsc.getSeriesCount());
    boolean b = vsc.removeSeries(s1);
    assertTrue(b);
    assertEquals(1, vsc.getSeriesCount());
    assertEquals("S2", vsc.getSeriesKey(0));
    b = vsc.removeSeries(new VectorSeries("NotInDataset"));
    assertFalse(b);
    assertEquals(1, vsc.getSeriesCount());
    b = vsc.removeSeries(s2);
    assertTrue(b);
    assertEquals(0, vsc.getSeriesCount());
}

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

/**
 * Some checks for the removeSeries() method.
 *///from ww w  .ja  v a 2  s  . c o  m
public void testRemoveSeries() {
    VectorSeries s1 = new VectorSeries("S1");
    VectorSeries s2 = new VectorSeries("S2");
    VectorSeriesCollection vsc = new VectorSeriesCollection();
    vsc.addSeries(s1);
    vsc.addSeries(s2);
    assertEquals(2, vsc.getSeriesCount());
    boolean b = vsc.removeSeries(s1);
    assertTrue(b);
    assertEquals(1, vsc.getSeriesCount());
    assertEquals("S2", vsc.getSeriesKey(0));
    b = vsc.removeSeries(new VectorSeries("NotInDataset"));
    assertFalse(b);
    assertEquals(1, vsc.getSeriesCount());
    b = vsc.removeSeries(s2);
    assertTrue(b);
    assertEquals(0, vsc.getSeriesCount());
}