use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class BarChart3DTest method createBarChart3D.
/**
* Create a bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createBarChart3D() {
Number[][] data = new Integer[][] { { new Integer(-3), new Integer(-2) }, { new Integer(-1), new Integer(1) }, { new Integer(2), new Integer(3) } };
CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", "C", data);
return ChartFactory.createBarChart3D("Bar Chart 3D", "Domain", "Range", dataset, PlotOrientation.HORIZONTAL, true, true, true);
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class LineChart3DTest method testReplaceDataset.
/**
* Replaces the chart's dataset and then checks that the new dataset is OK.
*/
@Test
public void testReplaceDataset() {
// create a dataset...
Number[][] data = new Integer[][] { { new Integer(-30), new Integer(-20) }, { new Integer(-10), new Integer(10) }, { new Integer(20), new Integer(30) } };
CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);
LocalListener l = new LocalListener();
this.chart.addChangeListener(l);
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
plot.setDataset(newData);
assertEquals(true, l.flag);
ValueAxis axis = plot.getRangeAxis();
Range range = axis.getRange();
assertTrue("Expecting the lower bound of the range to be around -30: " + range.getLowerBound(), range.getLowerBound() <= -30);
assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class LineChartTest method testReplaceDataset.
/**
* Replaces the chart's dataset and then checks that the new dataset is OK.
*/
@Test
public void testReplaceDataset() {
// create a dataset...
Number[][] data = new Integer[][] { { new Integer(-30), new Integer(-20) }, { new Integer(-10), new Integer(10) }, { new Integer(20), new Integer(30) } };
CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);
LocalListener l = new LocalListener();
this.chart.addChangeListener(l);
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
plot.setDataset(newData);
assertEquals(true, l.flag);
ValueAxis axis = plot.getRangeAxis();
Range range = axis.getRange();
assertTrue("Expecting the lower bound of the range to be around -30: " + range.getLowerBound(), range.getLowerBound() <= -30);
assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class BarChartTest method createBarChart.
/**
* Create a bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createBarChart() {
// create a dataset...
Number[][] data = new Integer[][] { { new Integer(-3), new Integer(-2) }, { new Integer(-1), new Integer(1) }, { new Integer(2), new Integer(3) } };
CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", "C", data);
// create the chart...
return ChartFactory.createBarChart("Bar Chart", "Domain", "Range", dataset, PlotOrientation.HORIZONTAL, // include legend
true, true, true);
}
use of org.jfree.data.category.CategoryDataset in project SIMVA-SoS by SESoS.
the class StackedAreaChartTest method createChart.
/**
* Create a stacked bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
Number[][] data = new Integer[][] { { new Integer(-3), new Integer(-2) }, { new Integer(-1), new Integer(1) }, { new Integer(2), new Integer(3) } };
CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", "C", data);
return ChartFactory.createStackedAreaChart(// chart title
"Stacked Area Chart", "Domain", "Range", // data
dataset, PlotOrientation.HORIZONTAL, // include legend
true, true, true);
}
Aggregations