use of org.jfree.chart.renderer.category.DefaultCategoryItemRenderer in project SIMVA-SoS by SESoS.
the class CategoryPlotTest method testGetRangeAxisForDataset.
/**
* Some tests for the getRangeAxisForDataset() method.
*/
@Test
public void testGetRangeAxisForDataset() {
CategoryDataset dataset = new DefaultCategoryDataset();
CategoryAxis xAxis = new CategoryAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
CategoryItemRenderer renderer = new DefaultCategoryItemRenderer();
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
assertEquals(yAxis, plot.getRangeAxisForDataset(0));
// should get IllegalArgumentException for negative index
boolean pass = false;
try {
plot.getRangeAxisForDataset(-1);
} catch (IllegalArgumentException e) {
pass = true;
}
assertTrue(pass);
// if multiple axes are mapped, the first in the list should be
// returned...
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setRangeAxis(1, yAxis2);
assertEquals(yAxis, plot.getRangeAxisForDataset(0));
plot.mapDatasetToRangeAxis(0, 1);
assertEquals(yAxis2, plot.getRangeAxisForDataset(0));
List axisIndices = Arrays.asList(new Integer[] { new Integer(0), new Integer(1) });
plot.mapDatasetToRangeAxes(0, axisIndices);
assertEquals(yAxis, plot.getRangeAxisForDataset(0));
axisIndices = Arrays.asList(new Integer[] { new Integer(1), new Integer(2) });
plot.mapDatasetToRangeAxes(0, axisIndices);
assertEquals(yAxis2, plot.getRangeAxisForDataset(0));
}
Aggregations