use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class ChartPanelTest method test2502355_zoomOutRange.
/**
* Checks that a call to the zoomOutRange() method, for a plot with more
* than one range axis, generates just one ChartChangeEvent.
*/
@Test
public void test2502355_zoomOutRange() {
DefaultXYDataset dataset = new DefaultXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeAxis(1, new NumberAxis("X2"));
ChartPanel panel = new ChartPanel(chart);
chart.addChangeListener(this);
this.chartChangeEvents.clear();
panel.zoomOutRange(1.0, 2.0);
assertEquals(1, this.chartChangeEvents.size());
}
use of org.jfree.chart.axis.NumberAxis 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.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class XYPlotTest method testCloning3.
/**
* Tests cloning for a plot where the fixed legend items have been
* specified.
*/
@Test
public void testCloning3() throws CloneNotSupportedException {
XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"), new NumberAxis("Range Axis"), new StandardXYItemRenderer());
LegendItemCollection c1 = new LegendItemCollection();
p1.setFixedLegendItems(c1);
XYPlot p2 = (XYPlot) p1.clone();
assertTrue(p1 != p2);
assertTrue(p1.getClass() == p2.getClass());
assertTrue(p1.equals(p2));
// verify independence of fixed legend item collection
c1.add(new LegendItem("X"));
assertFalse(p1.equals(p2));
}
use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class XYPlotTest method testEquals_ObjectList.
/**
* This test covers a flaw in the ObjectList equals() method.
*/
@Test
public void testEquals_ObjectList() {
XYPlot p1 = new XYPlot();
p1.setDomainAxis(new NumberAxis("A"));
XYPlot p2 = new XYPlot();
p2.setDomainAxis(new NumberAxis("A"));
assertEquals(p1, p2);
p2.setDomainAxis(1, new NumberAxis("B"));
assertNotEquals(p1, p2);
}
use of org.jfree.chart.axis.NumberAxis in project SIMVA-SoS by SESoS.
the class XYPlotTest method testSetNullRenderer.
/**
* Setting a null renderer should be allowed, but is generating a null
* pointer exception in 0.9.7.
*/
@Test
public void testSetNullRenderer() {
boolean failed = false;
try {
XYPlot plot = new XYPlot(null, new NumberAxis("X"), new NumberAxis("Y"), null);
plot.setRenderer(null);
} catch (Exception e) {
failed = true;
}
assertTrue(!failed);
}
Aggregations