use of org.jfree.data.xy.XYBarDataset in project SIMVA-SoS by SESoS.
the class XYBarRendererTest method testGetLegendItemSeriesIndex.
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
@Test
public void testGetLegendItemSeriesIndex() {
XYSeriesCollection d1 = new XYSeriesCollection();
XYSeries s1 = new XYSeries("S1");
s1.add(1.0, 1.1);
XYSeries s2 = new XYSeries("S2");
s2.add(1.0, 1.1);
d1.addSeries(s1);
d1.addSeries(s2);
XYSeriesCollection d2 = new XYSeriesCollection();
XYSeries s3 = new XYSeries("S3");
s3.add(1.0, 1.1);
XYSeries s4 = new XYSeries("S4");
s4.add(1.0, 1.1);
XYSeries s5 = new XYSeries("S5");
s5.add(1.0, 1.1);
d2.addSeries(s3);
d2.addSeries(s4);
d2.addSeries(s5);
XYBarRenderer r = new XYBarRenderer();
XYPlot plot = new XYPlot(new XYBarDataset(d1, 1.0), new NumberAxis("x"), new NumberAxis("y"), r);
plot.setDataset(1, new XYBarDataset(d2, 2.0));
/*JFreeChart chart =*/
new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("S5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
use of org.jfree.data.xy.XYBarDataset in project SIMVA-SoS by SESoS.
the class XYBarChartTest method createChart.
/**
* Create a horizontal bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 1.0);
series1.add(2.0, 2.0);
series1.add(3.0, 3.0);
IntervalXYDataset dataset = new XYBarDataset(new XYSeriesCollection(series1), 1.0);
return ChartFactory.createXYBarChart("XY Bar Chart", "Domain", false, "Range", dataset);
}
Aggregations