public JFreeChart createPieChart(String title, PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage("No data to display"); StandardPieSectionLabelGenerator labelGenerator = new StandardPieSectionLabelGenerator("{0} {1} ({2})"); plot.setLabelGenerator(labelGenerator); plot.setInteriorGap(0.01); plot.setMaximumLabelWidth(0.32); Font font = new Font(chart.getLegend().getItemFont().getFamily(), Font.PLAIN, 12); plot.setLabelFont(font); plot.setLabelBackgroundPaint(new Color(220, 220, 220)); font = new Font(chart.getLegend().getItemFont().getFamily(), Font.PLAIN, 12); chart.getLegend().setItemFont(font); return chart; }