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;
}
Aggregations