use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class LineChart3DTest method testSetSeriesToolTipGenerator.
/**
* Check that setting a tool tip generator for a series does override the
* default generator.
*/
@Test
public void testSetSeriesToolTipGenerator() {
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
CategoryItemRenderer renderer = plot.getRenderer();
StandardCategoryToolTipGenerator tt = new StandardCategoryToolTipGenerator();
renderer.setSeriesToolTipGenerator(0, tt);
CategoryToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);
assertSame(tt2, tt);
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class SubCategoryAxisTest method test2275695.
/**
* A check for the NullPointerException in bug 2275695.
*/
@Test
public void test2275695() {
JFreeChart chart = ChartFactory.createStackedBarChart("Test", "Category", "Value", null, PlotOrientation.VERTICAL, true, false, false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setDomainAxis(new SubCategoryAxis("SubCategoryAxis"));
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("There should be no exception.");
}
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class LogAxisTest method testAutoRange3.
/**
* A simple test for the auto-range calculation looking at a
* NumberAxis used as the range axis for a CategoryPlot. In this
* case, the original dataset is replaced with a new dataset.
*/
@Test
public void testAutoRange3() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createLineChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON);
// now replacing the dataset should update the axis range...
DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
dataset2.setValue(900.0, "Row 1", "Column 1");
dataset2.setValue(1000.0, "Row 1", "Column 2");
plot.setDataset(dataset2);
assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class LogAxisTest method testAutoRange1.
/**
* A simple test for the auto-range calculation looking at a
* LogAxis used as the range axis for a CategoryPlot.
*/
@Test
public void testAutoRange1() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createBarChart("Test", "Categories", "Value", dataset);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
LogAxis axis = new LogAxis("Log(Y)");
plot.setRangeAxis(axis);
assertEquals(0.0, axis.getLowerBound(), EPSILON);
assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
}
use of org.jfree.chart.plot.CategoryPlot in project SIMVA-SoS by SESoS.
the class NumberAxisTest method testAutoRange1.
/**
* A simple test for the auto-range calculation looking at a
* NumberAxis used as the range axis for a CategoryPlot.
*/
@Test
public void testAutoRange1() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createBarChart("Test", "Categories", "Value", dataset);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
assertEquals(axis.getLowerBound(), 0.0, EPSILON);
assertEquals(axis.getUpperBound(), 210.0, EPSILON);
}
Aggregations