use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class CombinedDomainCategoryPlotTest method testNotification.
/**
* Check that only one chart change event is generated by a change to a
* subplot.
*/
@Test
public void testNotification() {
CombinedDomainCategoryPlot plot = createPlot();
JFreeChart chart = new JFreeChart(plot);
chart.addChangeListener(this);
CategoryPlot subplot1 = (CategoryPlot) plot.getSubplots().get(0);
NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();
yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());
assertEquals(1, this.events.size());
// a redraw should NOT trigger another change event
BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
this.events.clear();
chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));
assertTrue(this.events.isEmpty());
}
use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class CombinedRangeCategoryPlotTest method testNotification.
/**
* Check that only one chart change event is generated by a change to a
* subplot.
*/
@Test
public void testNotification() {
CombinedRangeCategoryPlot plot = createPlot();
JFreeChart chart = new JFreeChart(plot);
chart.addChangeListener(this);
CategoryPlot subplot1 = (CategoryPlot) plot.getSubplots().get(0);
NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();
yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());
assertEquals(1, this.events.size());
// a redraw should NOT trigger another change event
BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
this.events.clear();
chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));
assertTrue(this.events.isEmpty());
}
use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class FastScatterPlotTest method testSerialization.
/**
* Serialize an instance, restore it, and check for equality.
*/
@Test
public void testSerialization() {
float[][] data = createData();
ValueAxis domainAxis = new NumberAxis("X");
ValueAxis rangeAxis = new NumberAxis("Y");
FastScatterPlot p1 = new FastScatterPlot(data, domainAxis, rangeAxis);
FastScatterPlot p2 = (FastScatterPlot) TestUtilities.serialised(p1);
assertEquals(p1, p2);
}
use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class FastScatterPlotTest 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 {
float[][] data = createData();
ValueAxis domainAxis = new NumberAxis("X");
ValueAxis rangeAxis = new NumberAxis("Y");
FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis);
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.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class CombinedDomainXYPlotTest method testNotification.
/**
* Check that only one chart change event is generated by a change to a
* subplot.
*/
@Test
public void testNotification() {
CombinedDomainXYPlot plot = createPlot();
JFreeChart chart = new JFreeChart(plot);
chart.addChangeListener(this);
XYPlot subplot1 = (XYPlot) plot.getSubplots().get(0);
NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();
yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());
assertEquals(1, this.events.size());
// a redraw should NOT trigger another change event
BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
this.events.clear();
chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));
assertTrue(this.events.isEmpty());
}
Aggregations