Search in sources :

Example 6 with MultiplePiePlot

use of org.jfree.chart.plot.MultiplePiePlot in project SIMVA-SoS by SESoS.

the class ChartFactory method createMultiplePieChart.

/**
 * Creates a chart that displays multiple pie plots.  The chart object
 * returned by this method uses a {@link MultiplePiePlot} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               (<code>null</code> not permitted).
 * @param legend  include a legend?
 * @param tooltips  generate tooltips?
 * @param urls  generate URLs?
 *
 * @return A chart.
 */
public static JFreeChart createMultiplePieChart(String title, CategoryDataset dataset, TableOrder order, boolean legend, boolean tooltips, boolean urls) {
    ParamChecks.nullNotPermitted(order, "order");
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);
    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }
    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieURLGenerator(org.jfree.chart.urls.PieURLGenerator) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) PieToolTipGenerator(org.jfree.chart.labels.PieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot) PiePlot(org.jfree.chart.plot.PiePlot) MultiplePiePlot(org.jfree.chart.plot.MultiplePiePlot)

Aggregations

MultiplePiePlot (org.jfree.chart.plot.MultiplePiePlot)6 PiePlot (org.jfree.chart.plot.PiePlot)5 JFreeChart (org.jfree.chart.JFreeChart)3 Font (java.awt.Font)2 PieToolTipGenerator (org.jfree.chart.labels.PieToolTipGenerator)2 StandardPieSectionLabelGenerator (org.jfree.chart.labels.StandardPieSectionLabelGenerator)2 StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)2 TextTitle (org.jfree.chart.title.TextTitle)2 PieURLGenerator (org.jfree.chart.urls.PieURLGenerator)2 StandardPieURLGenerator (org.jfree.chart.urls.StandardPieURLGenerator)2 Iterator (java.util.Iterator)1 List (java.util.List)1 CategoryAxis (org.jfree.chart.axis.CategoryAxis)1 DateAxis (org.jfree.chart.axis.DateAxis)1 NumberAxis (org.jfree.chart.axis.NumberAxis)1 NumberTickUnit (org.jfree.chart.axis.NumberTickUnit)1 ValueAxis (org.jfree.chart.axis.ValueAxis)1 CategoryPlot (org.jfree.chart.plot.CategoryPlot)1 DefaultDrawingSupplier (org.jfree.chart.plot.DefaultDrawingSupplier)1 MeterInterval (org.jfree.chart.plot.MeterInterval)1