Java Code Examples for org.jfree.data.xy.DefaultTableXYDataset#removeSeries()

The following examples show how to use org.jfree.data.xy.DefaultTableXYDataset#removeSeries() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableXYDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests the auto-pruning feature.
 */
public void testAutoPrune() {

    // WITH AUTOPRUNING
    DefaultTableXYDataset dataset = new DefaultTableXYDataset(true);
    dataset.addSeries(createSeriesA());
    assertEquals(2, dataset.getItemCount());  // should be 2 items
    dataset.addSeries(createSeriesB());
    assertEquals(2, dataset.getItemCount());  // still 2
    dataset.removeSeries(1);
    assertEquals(1, dataset.getItemCount());  // 1 value pruned.

    // WITHOUT AUTOPRUNING
    DefaultTableXYDataset dataset2 = new DefaultTableXYDataset(true);
    dataset2.addSeries(createSeriesA());
    assertEquals(2, dataset2.getItemCount());  // should be 2 items
    dataset2.addSeries(createSeriesB());
    assertEquals(2, dataset2.getItemCount());  // still 2
    dataset2.removeSeries(1);
    assertEquals(1, dataset2.getItemCount());  // still 2.

}
 
Example 2
Source File: TableXYDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests the auto-pruning feature.
 */
public void testAutoPrune() {
    
    // WITH AUTOPRUNING
    DefaultTableXYDataset dataset = new DefaultTableXYDataset(true);
    dataset.addSeries(createSeriesA());
    assertEquals(2, dataset.getItemCount());  // should be 2 items
    dataset.addSeries(createSeriesB());
    assertEquals(2, dataset.getItemCount());  // still 2
    dataset.removeSeries(1);
    assertEquals(1, dataset.getItemCount());  // 1 value pruned.

    // WITHOUT AUTOPRUNING
    DefaultTableXYDataset dataset2 = new DefaultTableXYDataset(true);
    dataset2.addSeries(createSeriesA());
    assertEquals(2, dataset2.getItemCount());  // should be 2 items
    dataset2.addSeries(createSeriesB());
    assertEquals(2, dataset2.getItemCount());  // still 2
    dataset2.removeSeries(1);
    assertEquals(1, dataset2.getItemCount());  // still 2.
    
}
 
Example 3
Source File: TableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Assorted tests.
 */
public void testTableXYDataset() {

    XYSeries series1 = createSeries1();
    XYSeries series2 = createSeries2();

    DefaultTableXYDataset dataset = new DefaultTableXYDataset();
    dataset.addSeries(series1);
    dataset.addSeries(series2);

    //  Test that there are 6 X points and some specific values
    assertEquals(6, dataset.getItemCount());
    assertEquals(6, dataset.getX(0, 5).intValue());
    assertEquals(null, dataset.getY(0, 5));
    assertEquals(6, dataset.getX(1, 5).intValue());
    assertEquals(2, dataset.getY(1, 5).intValue());

    // after adding a point to a series, check that there are now 7
    // items in each series
    series2.add(7, 2);
    assertEquals(7, dataset.getItemCount());
    assertEquals(null, dataset.getY(0, 6));
    assertEquals(2, dataset.getY(1, 6).intValue());

    //  Remove series 1
    dataset.removeSeries(series1);
    //  Test that there are still 7 X points
    assertEquals(7, dataset.getItemCount());

    //  Remove series 2 and add new series
    dataset.removeSeries(series2);
    series1 = createSeries1();
    dataset.addSeries(series1);

    //  Test that there are now 4 X points
    assertEquals(4, dataset.getItemCount());

}
 
Example 4
Source File: TableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests to see that pruning removes unwanted x values.
 */
public void testPrune() {
    DefaultTableXYDataset dataset = new DefaultTableXYDataset();
    dataset.addSeries(createSeries1());
    dataset.addSeries(createSeries2());
    dataset.removeSeries(1);
    dataset.prune();
    assertEquals(4, dataset.getItemCount());
}
 
Example 5
Source File: TableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Assorted tests.
 */
public void testTableXYDataset() {
    
    XYSeries series1 = createSeries1();
    XYSeries series2 = createSeries2();
    
    DefaultTableXYDataset dataset = new DefaultTableXYDataset();
    dataset.addSeries(series1);
    dataset.addSeries(series2);

    //  Test that there are 6 X points and some specific values
    assertEquals(6, dataset.getItemCount());
    assertEquals(6, dataset.getX(0, 5).intValue());
    assertEquals(null, dataset.getY(0, 5));
    assertEquals(6, dataset.getX(1, 5).intValue());
    assertEquals(2, dataset.getY(1, 5).intValue());

    // after adding a point to a series, check that there are now 7 
    // items in each series
    series2.add(7, 2);
    assertEquals(7, dataset.getItemCount());
    assertEquals(null, dataset.getY(0, 6));
    assertEquals(2, dataset.getY(1, 6).intValue());

    //  Remove series 1
    dataset.removeSeries(series1);
    //  Test that there are still 7 X points
    assertEquals(7, dataset.getItemCount());

    //  Remove series 2 and add new series
    dataset.removeSeries(series2);
    series1 = createSeries1();
    dataset.addSeries(series1);

    //  Test that there are now 4 X points
    assertEquals(4, dataset.getItemCount());

}
 
Example 6
Source File: TableXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests to see that pruning removes unwanted x values.
 */
public void testPrune() {
    DefaultTableXYDataset dataset = new DefaultTableXYDataset();
    dataset.addSeries(createSeries1());
    dataset.addSeries(createSeries2());
    dataset.removeSeries(1);
    dataset.prune();
    assertEquals(4, dataset.getItemCount());
}