use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.
the class ChartPanelTest method test2502355_restoreAutoBounds.
/**
* Checks that a call to the restoreAutoBounds() method generates just one
* ChartChangeEvent.
*/
@Test
public void test2502355_restoreAutoBounds() {
DefaultXYDataset dataset = new DefaultXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
ChartPanel panel = new ChartPanel(chart);
chart.addChangeListener(this);
this.chartChangeEvents.clear();
panel.restoreAutoBounds();
assertEquals(1, this.chartChangeEvents.size());
}
use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.
the class ChartPanelTest method test2502355_zoomOutDomain.
/**
* Checks that a call to the zoomOutDomain() method, for a plot with more
* than one domain axis, generates just one ChartChangeEvent.
*/
@Test
public void test2502355_zoomOutDomain() {
DefaultXYDataset dataset = new DefaultXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainAxis(1, new NumberAxis("X2"));
ChartPanel panel = new ChartPanel(chart);
chart.addChangeListener(this);
this.chartChangeEvents.clear();
panel.zoomOutDomain(1.0, 2.0);
assertEquals(1, this.chartChangeEvents.size());
}
use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.
the class ChartPanelTest method test2502355_zoomInDomain.
/**
* Checks that a call to the zoomInDomain() method, for a plot with more
* than one domain axis, generates just one ChartChangeEvent.
*/
@Test
public void test2502355_zoomInDomain() {
DefaultXYDataset dataset = new DefaultXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainAxis(1, new NumberAxis("X2"));
ChartPanel panel = new ChartPanel(chart);
chart.addChangeListener(this);
this.chartChangeEvents.clear();
panel.zoomInDomain(1.0, 2.0);
assertEquals(1, this.chartChangeEvents.size());
}
use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.
the class ChartPanelTest method test2502355_zoomOutBoth.
/**
* Checks that a call to the zoomOutBoth() method generates just one
* ChartChangeEvent.
*/
@Test
public void test2502355_zoomOutBoth() {
DefaultXYDataset dataset = new DefaultXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
ChartPanel panel = new ChartPanel(chart);
chart.addChangeListener(this);
this.chartChangeEvents.clear();
panel.zoomOutBoth(1.0, 2.0);
assertEquals(1, this.chartChangeEvents.size());
}
use of org.jfree.data.xy.DefaultXYDataset in project SIMVA-SoS by SESoS.
the class XYPlotTest method testDrawSeriesWithZeroItems.
/**
* A test for drawing a plot where a series has zero items. With
* JFreeChart 1.0.5+cvs this was throwing an exception at one point.
*/
@Test
public void testDrawSeriesWithZeroItems() {
DefaultXYDataset dataset = new DefaultXYDataset();
dataset.addSeries("Series 1", new double[][] { { 1.0, 2.0 }, { 3.0, 4.0 } });
dataset.addSeries("Series 2", new double[][] { {}, {} });
JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false);
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();
} catch (Exception e) {
fail("No exception should be thrown.");
}
}
Aggregations