use of org.jfree.data.statistics.BoxAndWhiskerItem in project SIMVA-SoS by SESoS.
the class BoxAndWhiskerRendererTest method testDrawWithNullMean.
/**
* 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);
}
use of org.jfree.data.statistics.BoxAndWhiskerItem in project SIMVA-SoS by SESoS.
the class XYBoxAndWhiskerRendererTest method test2909215.
/**
* 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.");
}
}
use of org.jfree.data.statistics.BoxAndWhiskerItem in project SIMVA-SoS by SESoS.
the class DatasetUtilitiesTest method testIterateToFindRangeBounds_BoxAndWhiskerXYDataset.
/**
* 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));
}
Aggregations