/** * Creates a chart. * * @param dataset the dataset. * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart( "Pie Chart Demo 1", // chart title dataset, // data true, // include legend true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionOutlinesVisible(false); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); plot.setNoDataMessage("No data available"); plot.setSimpleLabels(true); return chart; }
/** Style the plot of a pie chart. */ public static void stylePiePlot(PiePlot plot) { plot.setLabelFont(EHtmlPresentationFont.SANS_CONDENSED.getFont()); plot.setSectionOutlinesVisible(false); plot.setLabelGap(0.02); plot.setBackgroundPaint(Color.WHITE); }