Search in sources :

Example 1 with MultiplePiePlot

use of org.jfree.chart.plot.pie.MultiplePiePlot in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

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} permitted).
 * @param dataset  the dataset ({@code null} permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               ({@code null} 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) {
    Args.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.pie.MultiplePiePlot) MultiplePiePlot(org.jfree.chart.plot.pie.MultiplePiePlot) PiePlot(org.jfree.chart.plot.pie.PiePlot)

Aggregations

PieToolTipGenerator (org.jfree.chart.labels.PieToolTipGenerator)1 StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)1 MultiplePiePlot (org.jfree.chart.plot.pie.MultiplePiePlot)1 PiePlot (org.jfree.chart.plot.pie.PiePlot)1 PieURLGenerator (org.jfree.chart.urls.PieURLGenerator)1 StandardPieURLGenerator (org.jfree.chart.urls.StandardPieURLGenerator)1