use of org.jfree.chart.LegendItem in project SIMVA-SoS by SESoS.
the class XYBubbleRendererTest method testGetLegendItemSeriesIndex.
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
@Test
public void testGetLegendItemSeriesIndex() {
DefaultXYZDataset d1 = new DefaultXYZDataset();
double[] x = { 2.1, 2.3, 2.3, 2.2, 2.2, 1.8, 1.8, 1.9, 2.3, 3.8 };
double[] y = { 14.1, 11.1, 10.0, 8.8, 8.7, 8.4, 5.4, 4.1, 4.1, 25 };
double[] z = { 2.4, 2.7, 2.7, 2.2, 2.2, 2.2, 2.1, 2.2, 1.6, 4 };
double[][] s1 = new double[][] { x, y, z };
d1.addSeries("S1", s1);
x = new double[] { 2.1 };
y = new double[] { 14.1 };
z = new double[] { 2.4 };
double[][] s2 = new double[][] { x, y, z };
d1.addSeries("S2", s2);
DefaultXYZDataset d2 = new DefaultXYZDataset();
x = new double[] { 2.1 };
y = new double[] { 14.1 };
z = new double[] { 2.4 };
double[][] s3 = new double[][] { x, y, z };
d2.addSeries("S3", s3);
x = new double[] { 2.1 };
y = new double[] { 14.1 };
z = new double[] { 2.4 };
double[][] s4 = new double[][] { x, y, z };
d2.addSeries("S4", s4);
x = new double[] { 2.1 };
y = new double[] { 14.1 };
z = new double[] { 2.4 };
double[][] s5 = new double[][] { x, y, z };
d2.addSeries("S5", s5);
XYBubbleRenderer r = new XYBubbleRenderer();
XYPlot plot = new XYPlot(d1, new NumberAxis("x"), new NumberAxis("y"), r);
plot.setDataset(1, d2);
/*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.chart.LegendItem in project SIMVA-SoS by SESoS.
the class BarRendererTest method testGetLegendItem.
/**
* Some checks for the getLegendItem() method.
*/
@Test
public void testGetLegendItem() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(21.0, "R1", "C1");
BarRenderer r = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"), new NumberAxis("y"), r);
/*JFreeChart chart =*/
new JFreeChart(plot);
LegendItem li = r.getLegendItem(0, 0);
assertNotNull(li);
r.setSeriesVisibleInLegend(0, Boolean.FALSE);
li = r.getLegendItem(0, 0);
assertNull(li);
}
use of org.jfree.chart.LegendItem in project SIMVA-SoS by SESoS.
the class BarRendererTest method testGetLegendItemSeriesIndex.
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
@Test
public void testGetLegendItemSeriesIndex() {
DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
dataset0.addValue(21.0, "R1", "C1");
dataset0.addValue(22.0, "R2", "C1");
DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
dataset1.addValue(23.0, "R3", "C1");
dataset1.addValue(24.0, "R4", "C1");
dataset1.addValue(25.0, "R5", "C1");
BarRenderer r = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataset0, new CategoryAxis("x"), new NumberAxis("y"), r);
plot.setDataset(1, dataset1);
/*JFreeChart chart =*/
new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("R5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
use of org.jfree.chart.LegendItem in project SIMVA-SoS by SESoS.
the class CategoryStepRendererTest method testGetLegendItemSeriesIndex.
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
@Test
public void testGetLegendItemSeriesIndex() {
DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
dataset0.addValue(21.0, "R1", "C1");
dataset0.addValue(22.0, "R2", "C1");
DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
dataset1.addValue(23.0, "R3", "C1");
dataset1.addValue(24.0, "R4", "C1");
dataset1.addValue(25.0, "R5", "C1");
CategoryStepRenderer r = new CategoryStepRenderer();
CategoryPlot plot = new CategoryPlot(dataset0, new CategoryAxis("x"), new NumberAxis("y"), r);
plot.setDataset(1, dataset1);
/*JFreeChart chart =*/
new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("R5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
use of org.jfree.chart.LegendItem in project SIMVA-SoS by SESoS.
the class LineAndShapeRendererTest method testGetLegendItemSeriesIndex.
/**
* A check for the datasetIndex and seriesIndex fields in the LegendItem
* returned by the getLegendItem() method.
*/
@Test
public void testGetLegendItemSeriesIndex() {
DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
dataset0.addValue(21.0, "R1", "C1");
dataset0.addValue(22.0, "R2", "C1");
DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
dataset1.addValue(23.0, "R3", "C1");
dataset1.addValue(24.0, "R4", "C1");
dataset1.addValue(25.0, "R5", "C1");
LineAndShapeRenderer r = new LineAndShapeRenderer();
CategoryPlot plot = new CategoryPlot(dataset0, new CategoryAxis("x"), new NumberAxis("y"), r);
plot.setDataset(1, dataset1);
/*JFreeChart chart =*/
new JFreeChart(plot);
LegendItem li = r.getLegendItem(1, 2);
assertEquals("R5", li.getLabel());
assertEquals(1, li.getDatasetIndex());
assertEquals(2, li.getSeriesIndex());
}
Aggregations