use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class CategoryPlotTest method testMapDatasetToDomainAxis.
@Test
public void testMapDatasetToDomainAxis() {
CategoryDataset dataset = new DefaultCategoryDataset();
CategoryAxis xAxis = new CategoryAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
CategoryItemRenderer renderer = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
CategoryAxis xAxis2 = new CategoryAxis("X2");
plot.setDomainAxis(11, xAxis2);
// add a second dataset
DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
dataset2.setValue(1, "R1", "C1");
plot.setDataset(99, dataset);
assertEquals(xAxis, plot.getDomainAxisForDataset(99));
// now map the dataset to the second xAxis
plot.mapDatasetToDomainAxis(99, 11);
assertEquals(xAxis2, plot.getDomainAxisForDataset(99));
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class CategoryPlotTest method testMapDatasetToRangeAxis.
@Test
public void testMapDatasetToRangeAxis() {
CategoryDataset dataset = new DefaultCategoryDataset();
CategoryAxis xAxis = new CategoryAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
CategoryItemRenderer renderer = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setRangeAxis(22, yAxis2);
// add a second dataset
DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
dataset2.setValue(1, "R1", "C1");
plot.setDataset(99, dataset);
assertEquals(yAxis, plot.getRangeAxisForDataset(99));
// now map the dataset to the second xAxis
plot.mapDatasetToRangeAxis(99, 22);
assertEquals(yAxis2, plot.getRangeAxisForDataset(99));
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class CategoryPlotTest method testAxisIndices.
@Test
public void testAxisIndices() {
CategoryDataset dataset = new DefaultCategoryDataset();
CategoryAxis xAxis = new CategoryAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
CategoryItemRenderer renderer = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
assertEquals(xAxis, plot.getDomainAxis(0));
assertEquals(yAxis, plot.getRangeAxis(0));
CategoryAxis xAxis2 = new CategoryAxis("X2");
plot.setDomainAxis(99, xAxis2);
assertEquals(xAxis2, plot.getDomainAxis(99));
NumberAxis yAxis2 = new NumberAxis("Y2");
plot.setRangeAxis(99, yAxis2);
assertEquals(yAxis2, plot.getRangeAxis(99));
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class CategoryPlotTest method testRendererIndices.
@Test
public void testRendererIndices() {
CategoryDataset dataset = new DefaultCategoryDataset();
CategoryAxis xAxis = new CategoryAxis("X");
NumberAxis yAxis = new NumberAxis("Y");
CategoryItemRenderer renderer = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
assertEquals(renderer, plot.getRenderer(0));
// we should be able to give a renderer an arbitrary index
CategoryItemRenderer renderer2 = new LineAndShapeRenderer();
plot.setRenderer(20, renderer2);
assertEquals(2, plot.getRendererCount());
assertEquals(renderer2, plot.getRenderer(20));
assertEquals(20, plot.getIndexOf(renderer2));
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class CombinedRangeCategoryPlotTest method createPlot.
/**
* Creates a sample plot.
*
* @return A plot.
*/
private CombinedRangeCategoryPlot createPlot() {
CategoryDataset dataset1 = createDataset1();
CategoryAxis catAxis1 = new CategoryAxis("Category");
LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
renderer1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1);
subplot1.setDomainGridlinesVisible(true);
CategoryDataset dataset2 = createDataset2();
CategoryAxis catAxis2 = new CategoryAxis("Category");
BarRenderer renderer2 = new BarRenderer();
renderer2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2);
subplot2.setDomainGridlinesVisible(true);
NumberAxis rangeAxis = new NumberAxis("Value");
CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot(rangeAxis);
plot.add(subplot1, 2);
plot.add(subplot2, 1);
return plot;
}
Aggregations