Java Code Examples for org.jfree.data.statistics.DefaultBoxAndWhiskerXYDataset#add()

The following examples show how to use org.jfree.data.statistics.DefaultBoxAndWhiskerXYDataset#add() . 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: XYBoxAndWhiskerRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A test for bug report 2909215.
 */
@Test
public void test2909215() {
    DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    d1.add(new Date(1L), 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, null, null));
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X",
            "Y", d1, true);
    try {
        BufferedImage image = new BufferedImage(400, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null);
        g2.dispose();
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
Example 2
Source File: DatasetUtilitiesTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the iterateToFindRangeBounds() method when applied to
 * a BoxAndWhiskerXYDataset.
 */
@Test
public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("Series 1");
    List visibleSeriesKeys = new ArrayList();
    visibleSeriesKeys.add("Series 1");
    Range xRange = new Range(Double.NEGATIVE_INFINITY,
            Double.POSITIVE_INFINITY);
    assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));

    dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0,
            1.0, 9.0, 0.0, 10.0, new ArrayList()));
    assertEquals(new Range(5.0, 5.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));
    assertEquals(new Range(1.0, 9.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, true));
}
 
Example 3
Source File: XYBoxAndWhiskerRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A test for bug report 2909215.
 */
@Test
public void test2909215() {
    DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    d1.add(new Date(1L), 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, null, null));
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X",
            "Y", d1, true);
    try {
        BufferedImage image = new BufferedImage(400, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null);
        g2.dispose();
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
Example 4
Source File: DatasetUtilitiesTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the iterateToFindRangeBounds() method when applied to
 * a BoxAndWhiskerXYDataset.
 */
@Test
public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("Series 1");
    List visibleSeriesKeys = new ArrayList();
    visibleSeriesKeys.add("Series 1");
    Range xRange = new Range(Double.NEGATIVE_INFINITY,
            Double.POSITIVE_INFINITY);
    assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));

    dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0,
            1.0, 9.0, 0.0, 10.0, new ArrayList()));
    assertEquals(new Range(5.0, 5.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));
    assertEquals(new Range(1.0, 9.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, true));
}
 
Example 5
Source File: XYBoxAndWhiskerRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * A test for bug report 2909215.
 */
@Test
public void test2909215() {
    DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    d1.add(new Date(1L), 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, null, null));
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X",
            "Y", d1, true);
    try {
        BufferedImage image = new BufferedImage(400, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null);
        g2.dispose();
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
Example 6
Source File: DatasetUtilitiesTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Some checks for the iterateToFindRangeBounds() method when applied to
 * a BoxAndWhiskerXYDataset.
 */
@Test
public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("Series 1");
    List visibleSeriesKeys = new ArrayList();
    visibleSeriesKeys.add("Series 1");
    Range xRange = new Range(Double.NEGATIVE_INFINITY,
            Double.POSITIVE_INFINITY);
    assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));

    dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0,
            1.0, 9.0, 0.0, 10.0, new ArrayList()));
    assertEquals(new Range(5.0, 5.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));
    assertEquals(new Range(1.0, 9.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, true));
}
 
Example 7
Source File: XYBoxAndWhiskerRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A test for bug report 2909215.
 */
@Test
public void test2909215() {
    DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    d1.add(new Date(1L), 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, null, null));
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X",
            "Y", d1, true);
    try {
        BufferedImage image = new BufferedImage(400, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null);
        g2.dispose();
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
Example 8
Source File: DatasetUtilitiesTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the iterateToFindRangeBounds() method when applied to
 * a BoxAndWhiskerXYDataset.
 */
@Test
public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("Series 1");
    List visibleSeriesKeys = new ArrayList();
    visibleSeriesKeys.add("Series 1");
    Range xRange = new Range(Double.NEGATIVE_INFINITY,
            Double.POSITIVE_INFINITY);
    assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));

    dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0,
            1.0, 9.0, 0.0, 10.0, new ArrayList()));
    assertEquals(new Range(5.0, 5.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));
    assertEquals(new Range(1.0, 9.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, true));
}
 
Example 9
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the iterateToFindRangeBounds() method when applied to
 * a BoxAndWhiskerXYDataset.
 */
public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("Series 1");
    List visibleSeriesKeys = new ArrayList();
    visibleSeriesKeys.add("Series 1");
    Range xRange = new Range(Double.NEGATIVE_INFINITY,
            Double.POSITIVE_INFINITY);
    assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));

    dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0,
            1.0, 9.0, 0.0, 10.0, new ArrayList()));
    assertEquals(new Range(5.0, 5.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));
    assertEquals(new Range(1.0, 9.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, true));
}
 
Example 10
Source File: DefaultBoxAndWhiskerXYDatasetTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the add() method.
 */
public void testAdd() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("S1");
    BoxAndWhiskerItem item1 = new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0,
            5.0, 6.0, 7.0, 8.0, new ArrayList());
    dataset.add(new Date(33L), item1);

    assertEquals(1.0, dataset.getY(0, 0).doubleValue(), EPSILON);
    assertEquals(1.0, dataset.getMeanValue(0, 0).doubleValue(), EPSILON);
    assertEquals(2.0, dataset.getMedianValue(0, 0).doubleValue(), EPSILON);
    assertEquals(3.0, dataset.getQ1Value(0, 0).doubleValue(), EPSILON);
    assertEquals(4.0, dataset.getQ3Value(0, 0).doubleValue(), EPSILON);
    assertEquals(5.0, dataset.getMinRegularValue(0, 0).doubleValue(),
            EPSILON);
    assertEquals(6.0, dataset.getMaxRegularValue(0, 0).doubleValue(),
            EPSILON);
    assertEquals(7.0, dataset.getMinOutlier(0, 0).doubleValue(), EPSILON);
    assertEquals(8.0, dataset.getMaxOutlier(0, 0).doubleValue(), EPSILON);
    assertEquals(new Range(5.0, 6.0), dataset.getRangeBounds(false));
}
 
Example 11
Source File: DefaultBoxAndWhiskerXYDatasetTests.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() {
    DefaultBoxAndWhiskerXYDataset d1
            = new DefaultBoxAndWhiskerXYDataset("S");
    d1.add(new Date(1L), new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0,
            6.0, 7.0, 8.0, new ArrayList()));
    assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(false));
    assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(true));

    d1.add(new Date(1L), new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5,
            6.5, 7.5, 8.5, new ArrayList()));
    assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(false));
    assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(true));

    d1.add(new Date(2L), new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5,
            7.5, 8.5, 9.5, new ArrayList()));
    assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(false));
    assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(true));
}
 
Example 12
Source File: XYBoxAndWhiskerRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A test for bug report 2909215.
 */
@Test
public void test2909215() {
    DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    d1.add(new Date(1L), 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, null, null));
    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X",
            "Y", d1, true);
    try {
        BufferedImage image = new BufferedImage(400, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null);
        g2.dispose();
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
Example 13
Source File: DatasetUtilitiesTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the iterateToFindRangeBounds() method when applied to
 * a BoxAndWhiskerXYDataset.
 */
@Test
public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() {
    DefaultBoxAndWhiskerXYDataset dataset
            = new DefaultBoxAndWhiskerXYDataset("Series 1");
    List visibleSeriesKeys = new ArrayList();
    visibleSeriesKeys.add("Series 1");
    Range xRange = new Range(Double.NEGATIVE_INFINITY,
            Double.POSITIVE_INFINITY);
    assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));

    dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0,
            1.0, 9.0, 0.0, 10.0, new ArrayList()));
    assertEquals(new Range(5.0, 5.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, false));
    assertEquals(new Range(1.0, 9.0),
            DatasetUtilities.iterateToFindRangeBounds(dataset,
            visibleSeriesKeys, xRange, true));
}
 
Example 14
Source File: DefaultBoxAndWhiskerXYDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    DefaultBoxAndWhiskerXYDataset d2 = new DefaultBoxAndWhiskerXYDataset(
            "Series");
    assertTrue(d1.equals(d2));

    d1.add(new Date(1L), new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0,
            6.0, 7.0, 8.0, new ArrayList()));
    assertFalse(d1.equals(d2));
    d2.add(new Date(1L), new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0,
            6.0, 7.0, 8.0, new ArrayList()));
    assertTrue(d1.equals(d2));
}