use of org.jfree.chart.renderer.DefaultPolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlotTest method testGetLegendItems.
/**
* 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());
}
use of org.jfree.chart.renderer.DefaultPolarItemRenderer in project SIMVA-SoS by SESoS.
the class ChartFactory method createPolarChart.
/**
* Creates a polar plot for the specified dataset (x-values interpreted as
* angles in degrees). The chart object returned by this method uses a
* {@link PolarPlot} instance as the plot, with a {@link NumberAxis} for
* the radial axis.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset (<code>null</code> permitted).
* @param legend legend required?
* @param tooltips tooltips required?
* @param urls URLs required?
*
* @return A chart.
*/
public static JFreeChart createPolarChart(String title, XYDataset dataset, boolean legend, boolean tooltips, boolean urls) {
PolarPlot plot = new PolarPlot();
plot.setDataset(dataset);
NumberAxis rangeAxis = new NumberAxis();
rangeAxis.setAxisLineVisible(false);
rangeAxis.setTickMarksVisible(false);
rangeAxis.setTickLabelInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
plot.setAxis(rangeAxis);
plot.setRenderer(new DefaultPolarItemRenderer());
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
currentTheme.apply(chart);
return chart;
}
use of org.jfree.chart.renderer.DefaultPolarItemRenderer in project SIMVA-SoS by SESoS.
the class PolarPlotTest method testGetLegendItems2.
/**
* 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());
}
Aggregations