use of org.jfree.data.category.DefaultIntervalCategoryDataset in project SIMVA-SoS by SESoS.
the class IntervalBarRendererTest method testDrawWithNullInfo.
/**
* 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 {
double[][] starts = new double[][] { { 0.1, 0.2, 0.3 }, { 0.3, 0.4, 0.5 } };
double[][] ends = new double[][] { { 0.5, 0.6, 0.7 }, { 0.7, 0.8, 0.9 } };
DefaultIntervalCategoryDataset dataset = new DefaultIntervalCategoryDataset(starts, ends);
IntervalBarRenderer renderer = new IntervalBarRenderer();
CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), renderer);
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */
chart.createBufferedImage(300, 200, null);
} catch (NullPointerException e) {
fail("No exception should be thrown.");
}
}
use of org.jfree.data.category.DefaultIntervalCategoryDataset in project SIMVA-SoS by SESoS.
the class IntervalBarRendererTest method testFindRangeBounds.
/**
* Some checks for the findRangeBounds() method.
*/
@Test
public void testFindRangeBounds() {
IntervalBarRenderer r = new IntervalBarRenderer();
assertNull(r.findRangeBounds(null));
// an empty dataset should return a null range
DefaultIntervalCategoryDataset dataset = new DefaultIntervalCategoryDataset(new double[0][0], new double[0][0]);
assertNull(r.findRangeBounds(dataset));
double[][] starts = new double[][] { { 0.1, 0.2, 0.3 }, { 0.3, 0.4, 0.5 } };
double[][] ends = new double[][] { { 0.5, 0.6, 0.7 }, { 0.7, 0.8, 0.9 } };
dataset = new DefaultIntervalCategoryDataset(starts, ends);
assertEquals(new Range(0.0, 0.9), r.findRangeBounds(dataset));
r.setIncludeBaseInRange(false);
assertEquals(new Range(0.1, 0.9), r.findRangeBounds(dataset));
r.setIncludeBaseInRange(true);
r.setSeriesVisible(1, Boolean.FALSE);
assertEquals(new Range(0.0, 0.7), r.findRangeBounds(dataset));
}
use of org.jfree.data.category.DefaultIntervalCategoryDataset in project SIMVA-SoS by SESoS.
the class DatasetUtilitiesTest method testIterateRangeBounds3_CategoryDataset.
/**
* Some checks for the iterateRangeBounds() method using an
* IntervalCategoryDataset.
*/
@Test
public void testIterateRangeBounds3_CategoryDataset() {
Number[][] starts = new Double[2][3];
Number[][] ends = new Double[2][3];
starts[0][0] = new Double(1.0);
starts[0][1] = new Double(2.0);
starts[0][2] = new Double(3.0);
starts[1][0] = new Double(11.0);
starts[1][1] = new Double(12.0);
starts[1][2] = new Double(13.0);
ends[0][0] = new Double(4.0);
ends[0][1] = new Double(5.0);
ends[0][2] = new Double(6.0);
ends[1][0] = new Double(16.0);
ends[1][1] = new Double(15.0);
ends[1][2] = new Double(14.0);
DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(starts, ends);
Range r = DatasetUtilities.iterateRangeBounds(d, false);
assertEquals(4.0, r.getLowerBound(), EPSILON);
assertEquals(16.0, r.getUpperBound(), EPSILON);
r = DatasetUtilities.iterateRangeBounds(d, true);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(16.0, r.getUpperBound(), EPSILON);
}
Aggregations