org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset Java Examples

The following examples show how to use org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset. 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: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null Q3 value.
 */
public void testDrawWithNullQ3() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), null, new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #2
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null Q1 value.
 */
public void testDrawWithNullQ1() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                null, new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #3
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null median value.
 */
public void testDrawWithNullMedian() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), null,
                new Double(0.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #4
Source File: BoxAndWhiskerRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null min outlier value.
 */
@Test
public void testDrawWithNullMinOutlier() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                new Double(4.5), null, new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #5
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A simple test for bug report 1701822.
 */
public void test1701822() {
    DefaultBoxAndWhiskerCategoryDataset dataset 
            = new DefaultBoxAndWhiskerCategoryDataset();
    try {
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), 
                new Double(3.0), new Double(4.0), new Double(5.0), 
                new Double(6.0), null, new Double(8.0),
                new ArrayList()), "ROW1", "COLUMN1");
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), 
                new Double(3.0), new Double(4.0), new Double(5.0), 
                new Double(6.0), new Double(7.0), null,
                new ArrayList()), "ROW1", "COLUMN2");
    }
    catch (NullPointerException e) {
        assertTrue(false);
    }
    
}
 
Example #6
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null max outlier value.
 */
@Test
public void testDrawWithNullMaxOutlier() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), null,
                new java.util.ArrayList()), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #7
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null min outlier value.
 */
@Test
public void testDrawWithNullMinOutlier() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                new Double(4.5), null, new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #8
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DefaultBoxAndWhiskerCategoryDataset d1 
            = new DefaultBoxAndWhiskerCategoryDataset();
    d1.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), 
            new Double(3.0), new Double(4.0), new Double(5.0), 
            new Double(6.0), new Double(7.0), new Double(8.0), 
            new ArrayList()), "ROW1", "COLUMN1");
    DefaultBoxAndWhiskerCategoryDataset d2 
            = new DefaultBoxAndWhiskerCategoryDataset();
    d2.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), 
            new Double(3.0), new Double(4.0), new Double(5.0), 
            new Double(6.0), new Double(7.0), new Double(8.0),
            new ArrayList()), "ROW1", "COLUMN1");
    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));
}
 
Example #9
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null min regular value.
 */
public void testDrawWithNullMinRegular() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), null,
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #10
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null max regular value.
 */
public void testDrawWithNullMaxRegular() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                null, new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #11
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null max outlier value.
 */
public void testDrawWithNullMaxOutlier() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), null,
                new java.util.ArrayList()), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #12
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DefaultBoxAndWhiskerCategoryDataset d1
            = new DefaultBoxAndWhiskerCategoryDataset();
    d1.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
            new Double(3.0), new Double(4.0), new Double(5.0),
            new Double(6.0), new Double(7.0), new Double(8.0),
            new ArrayList()), "ROW1", "COLUMN1");
    DefaultBoxAndWhiskerCategoryDataset d2
            = new DefaultBoxAndWhiskerCategoryDataset();
    d2.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
            new Double(3.0), new Double(4.0), new Double(5.0),
            new Double(6.0), new Double(7.0), new Double(8.0),
            new ArrayList()), "ROW1", "COLUMN1");
    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));
}
 
Example #13
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A simple test for bug report 1701822.
 */
public void test1701822() {
    DefaultBoxAndWhiskerCategoryDataset dataset
            = new DefaultBoxAndWhiskerCategoryDataset();
    try {
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(5.0),
                new Double(6.0), null, new Double(8.0),
                new ArrayList()), "ROW1", "COLUMN1");
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(5.0),
                new Double(6.0), new Double(7.0), null,
                new ArrayList()), "ROW1", "COLUMN2");
    }
    catch (NullPointerException e) {
        assertTrue(false);
    }

}
 
Example #14
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getRangeBounds() method.
 */
public void testGetRangeBounds() {
    DefaultBoxAndWhiskerCategoryDataset d1
            = new DefaultBoxAndWhiskerCategoryDataset();
    d1.add(new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
            new ArrayList()), "R1", "C1");
    assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(false));
    assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(true));

    d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5,
            new ArrayList()), "R1", "C1");
    assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(false));
    assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(true));

    d1.add(new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
            new ArrayList()), "R2", "C1");
    assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(false));
    assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(true));

    // this replaces the entry with the current minimum value, but the new
    // minimum value is now in a different item
    d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 8.6, 9.6,
            new ArrayList()), "R1", "C1");
    assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(false));
    assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(true));
}
 
Example #15
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset 
            = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(0.0), new Double(4.0), new Double(0.5), 
                new Double(4.5), new Double(-0.5), new Double(5.5), 
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                new BoxAndWhiskerRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #16
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null max regular value.
 */
@Test
public void testDrawWithNullMaxRegular() {
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                null, new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
Example #17
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null min regular value.
 */
@Test
public void testDrawWithNullMinRegular() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), null,
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #18
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null Q1 value.
 */
@Test
public void testDrawWithNullQ1() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                null, new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #19
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null median value.
 */
@Test
public void testDrawWithNullMedian() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), null,
                new Double(0.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #20
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null mean value.
 */
@Test
public void testDrawWithNullMean() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(null, new Double(2.0),
                new Double(0.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #21
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLegendItem() method.
 */
@Test
public void testGetLegendItem() {
    DefaultBoxAndWhiskerCategoryDataset dataset
            = new DefaultBoxAndWhiskerCategoryDataset();
    List values = new ArrayList();
    values.add(new Double(1.10));
    values.add(new Double(1.45));
    values.add(new Double(1.33));
    values.add(new Double(1.23));
    dataset.add(values, "R1", "C1");
    BoxAndWhiskerRenderer r = new BoxAndWhiskerRenderer();
    CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"),
            new NumberAxis("y"), r);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(0, 0);
    assertNotNull(li);
    r.setSeriesVisibleInLegend(0, Boolean.FALSE);
    li = r.getLegendItem(0, 0);
    assertNull(li);
}
 
Example #22
Source File: BoxAndWhiskerRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
            = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(0.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #23
Source File: BoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
            = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(0.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #24
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null max outlier value.
 */
public void testDrawWithNullMaxOutlier() {
    boolean success = false;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset 
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5), 
                new Double(4.5), new Double(-0.5), null, 
                new java.util.ArrayList()), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #25
Source File: BoxAndWhiskerRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLegendItem() method.
 */
public void testGetLegendItem() {
    DefaultBoxAndWhiskerCategoryDataset dataset 
            = new DefaultBoxAndWhiskerCategoryDataset();
    List values = new ArrayList();
    values.add(new Double(1.10));
    values.add(new Double(1.45));
    values.add(new Double(1.33));
    values.add(new Double(1.23));
    dataset.add(values, "R1", "C1");
    BoxAndWhiskerRenderer r = new BoxAndWhiskerRenderer();
    CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"),
            new NumberAxis("y"), r);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(0, 0);
    assertNotNull(li);
    r.setSeriesVisibleInLegend(0, Boolean.FALSE);
    li = r.getLegendItem(0, 0);
    assertNull(li);
}
 
Example #26
Source File: BoxAndWhiskerRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null max outlier value.
 */
@Test
public void testDrawWithNullMaxOutlier() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), null,
                new java.util.ArrayList()), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #27
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getRangeBounds() method.
 */
public void testGetRangeBounds() {
    DefaultBoxAndWhiskerCategoryDataset d1 
            = new DefaultBoxAndWhiskerCategoryDataset();
    d1.add(new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 
            new ArrayList()), "R1", "C1");
    assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(false));
    assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(true));
    
    d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 
            new ArrayList()), "R1", "C1");
    assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(false));
    assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(true));
    
    d1.add(new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 
            new ArrayList()), "R2", "C1");
    assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(false));
    assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(true));
    
    // this replaces the entry with the current minimum value, but the new
    // minimum value is now in a different item
    d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 8.6, 9.6, 
            new ArrayList()), "R1", "C1");
    assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(false));
    assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(true));
}
 
Example #28
Source File: BoxAndWhiskerRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null Q3 value.
 */
@Test
public void testDrawWithNullQ3() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                new Double(3.0), null, new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #29
Source File: BoxAndWhiskerRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null Q1 value.
 */
@Test
public void testDrawWithNullQ1() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0),
                null, new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
Example #30
Source File: BoxAndWhiskerRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws a chart where the dataset contains a null median value.
 */
@Test
public void testDrawWithNullMedian() {
    boolean success;
    try {
        DefaultBoxAndWhiskerCategoryDataset dataset
                = new DefaultBoxAndWhiskerCategoryDataset();
        dataset.add(new BoxAndWhiskerItem(new Double(1.0), null,
                new Double(0.0), new Double(4.0), new Double(0.5),
                new Double(4.5), new Double(-0.5), new Double(5.5),
                null), "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new BoxAndWhiskerRenderer());
        ChartRenderingInfo info = new ChartRenderingInfo();
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                info);
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}