private void initPlot(PiePlot plot, int chartType) { switch (chartType) { case TYPE_FISHEYE_PIE: //orient chart so labels will align nicely even if small slices of pie are present plot.setStartAngle(180); plot.setDirection(Rotation.ANTICLOCKWISE); break; case TYPE_CRUCIBLE_PIE: plot.setStartAngle(160); plot.setDirection(Rotation.CLOCKWISE); plot.setExplodePercent("Unreviewed", .25); plot.setLabelGenerator(null); break; default: } }
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; }
plot.setOutlinePaint(Color.WHITE); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true);
plot.setOutlinePaint(ChartDefaults.transparent); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true);
pieplot.setDirection(rotationValue(direction));