use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class RendererXYPackageUtils method createTestTableXYDataset.
/**
* Creates and returns a sample dataset for testing purposes.
*
* @return A sample dataset.
*/
public static TableXYDataset createTestTableXYDataset() {
DefaultTableXYDataset result = new DefaultTableXYDataset();
XYSeries series1 = new XYSeries("Series 1", false, false);
series1.add(1.0, 2.0);
series1.add(2.0, 5.0);
XYSeries series2 = new XYSeries("Series 2", false, false);
series2.add(1.0, 4.0);
series2.add(2.0, 3.0);
result.addSeries(series1);
result.addSeries(series2);
return result;
}
use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class StackedXYAreaRenderer2Test method testDrawWithEmptyDataset.
/**
* Test chart drawing with an empty dataset to ensure that this special
* case doesn't cause any exceptions.
*/
@Test
public void testDrawWithEmptyDataset() {
boolean success = false;
JFreeChart chart = ChartFactory.createStackedXYAreaChart("title", "x", "y", new DefaultTableXYDataset(), PlotOrientation.VERTICAL, true, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(new StackedXYAreaRenderer2());
try {
BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
g2.dispose();
success = true;
} catch (Exception e) {
success = false;
}
assertTrue(success);
}
use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class XYStepRendererTest 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 XYStepRenderer());
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 DatasetUtilitiesTest method testFindStackedRangeBoundsForTableXYDataset2.
/**
* Some checks for the findStackedRangeBounds() method.
*/
@Test
public void testFindStackedRangeBoundsForTableXYDataset2() {
DefaultTableXYDataset d = new DefaultTableXYDataset();
Range r = DatasetUtilities.findStackedRangeBounds(d);
assertEquals(r, new Range(0.0, 0.0));
}
use of org.jfree.data.xy.DefaultTableXYDataset in project SIMVA-SoS by SESoS.
the class DatasetUtilitiesTest method createTableXYDataset1.
/**
* Creates a sample dataset for testing purposes.
*
* @return A sample dataset.
*/
private TableXYDataset createTableXYDataset1() {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(1.0, 1.0);
s1.add(2.0, 2.0);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(1.0, -2.0);
s2.add(2.0, -1.0);
dataset.addSeries(s2);
return dataset;
}
Aggregations