Java Code Examples for org.jfree.chart.LegendItemCollection#get()
The following examples show how to use
org.jfree.chart.LegendItemCollection#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolarPlotTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Some checks for the getLegendItems() method with multiple datasets. */ @Test public void testGetLegendItems2() { XYSeriesCollection d1 = new XYSeriesCollection(); d1.addSeries(new XYSeries("A")); d1.addSeries(new XYSeries("B")); XYSeriesCollection d2 = new XYSeriesCollection(); d2.addSeries(new XYSeries("C")); d2.addSeries(new XYSeries("D")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d1); plot.setDataset(1, d2); plot.setRenderer(r); plot.setRenderer(1, new DefaultPolarItemRenderer()); LegendItemCollection items = plot.getLegendItems(); assertEquals(4, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); LegendItem item3 = items.get(2); assertEquals("C", item3.getLabel()); LegendItem item4 = items.get(3); assertEquals("D", item4.getLabel()); }
Example 2
Source File: LegendTitle.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Fetches the latest legend items. */ protected void fetchLegendItems() { this.items.clear(); RectangleEdge p = getPosition(); if (RectangleEdge.isTopOrBottom(p)) { this.items.setArrangement(this.hLayout); } else { this.items.setArrangement(this.vLayout); } for (int s = 0; s < this.sources.length; s++) { LegendItemCollection legendItems = this.sources[s].getLegendItems(); if (legendItems != null) { for (int i = 0; i < legendItems.getItemCount(); i++) { LegendItem item = legendItems.get(i); Block block = createLegendItemBlock(item); this.items.add(block); } } } }
Example 3
Source File: LegendTitle.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Fetches the latest legend items. */ protected void fetchLegendItems() { this.items.clear(); RectangleEdge p = getPosition(); if (RectangleEdge.isTopOrBottom(p)) { this.items.setArrangement(this.hLayout); } else { this.items.setArrangement(this.vLayout); } for (int s = 0; s < this.sources.length; s++) { LegendItemCollection legendItems = this.sources[s].getLegendItems(); if (legendItems != null) { for (int i = 0; i < legendItems.getItemCount(); i++) { LegendItem item = legendItems.get(i); Block block = createLegendItemBlock(item); this.items.add(block); } } } }
Example 4
Source File: PolarPlotTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Some checks for the getLegendItems() method with multiple datasets. */ @Test public void testGetLegendItems2() { XYSeriesCollection d1 = new XYSeriesCollection(); d1.addSeries(new XYSeries("A")); d1.addSeries(new XYSeries("B")); XYSeriesCollection d2 = new XYSeriesCollection(); d2.addSeries(new XYSeries("C")); d2.addSeries(new XYSeries("D")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d1); plot.setDataset(1, d2); plot.setRenderer(r); plot.setRenderer(1, new DefaultPolarItemRenderer()); LegendItemCollection items = plot.getLegendItems(); assertEquals(4, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); LegendItem item3 = items.get(2); assertEquals("C", item3.getLabel()); LegendItem item4 = items.get(3); assertEquals("D", item4.getLabel()); }
Example 5
Source File: MultiplePiePlotTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); MultiplePiePlot plot = new MultiplePiePlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 6
Source File: SpiderWebPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 7
Source File: PolarPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the getLegendItems() method with multiple datasets. */ @Test public void testGetLegendItems2() { XYSeriesCollection d1 = new XYSeriesCollection(); d1.addSeries(new XYSeries("A")); d1.addSeries(new XYSeries("B")); XYSeriesCollection d2 = new XYSeriesCollection(); d2.addSeries(new XYSeries("C")); d2.addSeries(new XYSeries("D")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d1); plot.setDataset(1, d2); plot.setRenderer(r); plot.setRenderer(1, new DefaultPolarItemRenderer()); LegendItemCollection items = plot.getLegendItems(); assertEquals(4, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); LegendItem item3 = items.get(2); assertEquals("C", item3.getLabel()); LegendItem item4 = items.get(3); assertEquals("D", item4.getLabel()); }
Example 8
Source File: SpiderWebPlotTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 9
Source File: MultiplePiePlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); MultiplePiePlot plot = new MultiplePiePlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 10
Source File: SpiderWebPlotTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 11
Source File: MultiplePiePlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); MultiplePiePlot plot = new MultiplePiePlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 12
Source File: PolarPlotTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Some checks for the getLegendItems() method. */ @Test public void testGetLegendItems() { XYSeriesCollection d = new XYSeriesCollection(); d.addSeries(new XYSeries("A")); d.addSeries(new XYSeries("B")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d); plot.setRenderer(r); LegendItemCollection items = plot.getLegendItems(); assertEquals(2, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); }
Example 13
Source File: MultiplePiePlotTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); MultiplePiePlot plot = new MultiplePiePlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 14
Source File: SpiderWebPlotTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 15
Source File: PolarPlotTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Some checks for the getLegendItems() method. */ @Test public void testGetLegendItems() { XYSeriesCollection d = new XYSeriesCollection(); d.addSeries(new XYSeries("A")); d.addSeries(new XYSeries("B")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d); plot.setRenderer(r); LegendItemCollection items = plot.getLegendItems(); assertEquals(2, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); }
Example 16
Source File: PolarPlotTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Some checks for the getLegendItems() method. */ @Test public void testGetLegendItems() { XYSeriesCollection d = new XYSeriesCollection(); d.addSeries(new XYSeries("A")); d.addSeries(new XYSeries("B")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d); plot.setRenderer(r); LegendItemCollection items = plot.getLegendItems(); assertEquals(2, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); }
Example 17
Source File: MultiplePiePlotTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); MultiplePiePlot plot = new MultiplePiePlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 18
Source File: SpiderWebPlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Fetches the legend items and checks the values. */ @Test public void testGetLegendItems() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S2", "C1"); dataset.addValue(15.0, "S2", "C2"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); LegendItemCollection legendItems = plot.getLegendItems(); assertEquals(2, legendItems.getItemCount()); LegendItem item1 = legendItems.get(0); assertEquals("S1", item1.getLabel()); assertEquals("S1", item1.getSeriesKey()); assertEquals(0, item1.getSeriesIndex()); assertEquals(dataset, item1.getDataset()); assertEquals(0, item1.getDatasetIndex()); LegendItem item2 = legendItems.get(1); assertEquals("S2", item2.getLabel()); assertEquals("S2", item2.getSeriesKey()); assertEquals(1, item2.getSeriesIndex()); assertEquals(dataset, item2.getDataset()); assertEquals(0, item2.getDatasetIndex()); }
Example 19
Source File: PolarPlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Some checks for the getLegendItems() method with multiple datasets. */ @Test public void testGetLegendItems2() { XYSeriesCollection d1 = new XYSeriesCollection(); d1.addSeries(new XYSeries("A")); d1.addSeries(new XYSeries("B")); XYSeriesCollection d2 = new XYSeriesCollection(); d2.addSeries(new XYSeries("C")); d2.addSeries(new XYSeries("D")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d1); plot.setDataset(1, d2); plot.setRenderer(r); plot.setRenderer(1, new DefaultPolarItemRenderer()); LegendItemCollection items = plot.getLegendItems(); assertEquals(4, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); LegendItem item3 = items.get(2); assertEquals("C", item3.getLabel()); LegendItem item4 = items.get(3); assertEquals("D", item4.getLabel()); }
Example 20
Source File: PolarPlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Some checks for the getLegendItems() method. */ @Test public void testGetLegendItems() { XYSeriesCollection d = new XYSeriesCollection(); d.addSeries(new XYSeries("A")); d.addSeries(new XYSeries("B")); DefaultPolarItemRenderer r = new DefaultPolarItemRenderer(); PolarPlot plot = new PolarPlot(); plot.setDataset(d); plot.setRenderer(r); LegendItemCollection items = plot.getLegendItems(); assertEquals(2, items.getItemCount()); LegendItem item1 = items.get(0); assertEquals("A", item1.getLabel()); LegendItem item2 = items.get(1); assertEquals("B", item2.getLabel()); }