use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class XYTitleAnnotationTest method testDrawWithNullInfo.
/**
* Draws the chart with a <code>null</code> info object to make sure that
* no exceptions are thrown.
*/
@Test
public void testDrawWithNullInfo() {
try {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(5.0, 5.0);
s1.add(10.0, 15.5);
s1.add(15.0, 9.5);
s1.add(20.0, 7.5);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(5.0, 5.0);
s2.add(10.0, 15.5);
s2.add(15.0, 9.5);
s2.add(20.0, 3.5);
dataset.addSeries(s2);
XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYLineAndShapeRenderer());
plot.addAnnotation(new XYTitleAnnotation(5.0, 6.0, new TextTitle("Hello World!")));
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */
chart.createBufferedImage(300, 200, null);
} catch (NullPointerException e) {
fail("There should be no exception.");
}
}
use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class XYAreaRenderer2Test 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 {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(5.0, 5.0);
s1.add(10.0, 15.5);
s1.add(15.0, 9.5);
s1.add(20.0, 7.5);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(5.0, 5.0);
s2.add(10.0, 15.5);
s2.add(15.0, 9.5);
s2.add(20.0, 3.5);
dataset.addSeries(s2);
XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYAreaRenderer2());
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.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class StackedXYAreaRenderer2Test method testFindRangeBounds.
/**
* Check that the renderer is calculating the range bounds correctly.
*/
@Test
public void testFindRangeBounds() {
TableXYDataset dataset = RendererXYPackageUtils.createTestTableXYDataset();
JFreeChart chart = ChartFactory.createStackedXYAreaChart("Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
plot.setRenderer(renderer);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
Range bounds = rangeAxis.getRange();
assertTrue(bounds.contains(6.0));
assertTrue(bounds.contains(8.0));
// try null argument
assertNull(renderer.findRangeBounds(null));
// try empty dataset
assertNull(renderer.findRangeBounds(new DefaultTableXYDataset()));
}
use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class XYAreaRendererTest 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 {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(5.0, 5.0);
s1.add(10.0, 15.5);
s1.add(15.0, 9.5);
s1.add(20.0, 7.5);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(5.0, 5.0);
s2.add(10.0, 15.5);
s2.add(15.0, 9.5);
s2.add(20.0, 3.5);
dataset.addSeries(s2);
XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYAreaRenderer());
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.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class XYStepRendererTest method testDrawWithNullValue.
/**
* Draws the chart with a <code>null</code> value in the dataset to make
* sure that no exceptions are thrown.
*/
@Test
public void testDrawWithNullValue() {
try {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(5.0, 5.0);
s1.add(10.0, null);
s1.add(15.0, 9.5);
s1.add(20.0, 7.5);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(5.0, 5.0);
s2.add(10.0, 15.5);
s2.add(15.0, null);
s2.add(20.0, null);
dataset.addSeries(s2);
XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYStepRenderer());
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */
chart.createBufferedImage(300, 200, null);
} catch (NullPointerException e) {
fail("No exception should be thrown.");
}
}
Aggregations