piePlot.setCircular(true); piePlot.setLabelGenerator(null); piePlot.setShadowXOffset(0); piePlot.setShadowYOffset(0);
public static ChartHelper generatePieChart(PieDataset dataset, String chartTitle, Color[][] colorScheme) { boolean legend = false; boolean tooltips = false; boolean urls = false; JFreeChart chart = ChartFactory.createPieChart(chartTitle, dataset, legend, tooltips, urls); chart.setBackgroundPaint(Color.white); chart.setBorderVisible(false); PiePlot plot = (PiePlot) chart.getPlot(); // Make section labels in the format "<Key>" plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}")); plot.setBackgroundPaint(Color.white); plot.setOutlinePaint(null); for(int i = 0; i < colorScheme.length; i++) { setSectionColor(dataset, plot, i, colorScheme[i][0], colorScheme[i][1]); } plot.setShadowXOffset(0); plot.setShadowYOffset(0); return new ChartHelper(chart); }
plot.setIgnoreZeroValues(true); plot.setStartAngle(290); plot.setShadowXOffset(0.0); plot.setShadowYOffset(0.0);
plot.setIgnoreZeroValues(true); plot.setStartAngle(290); plot.setShadowXOffset(0.0); plot.setShadowYOffset(0.0);
private JFreeChart getMultiplePieChart( BaseChart chart, CategoryDataset[] dataSets ) { JFreeChart multiplePieChart = ChartFactory.createMultiplePieChart( chart.getName(), dataSets[0], TableOrder.BY_ROW, !chart.isHideLegend(), false, false ); setBasicConfig( multiplePieChart, chart ); if ( multiplePieChart.getLegend() != null ) { multiplePieChart.getLegend().setItemFont( SUB_TITLE_FONT ); } MultiplePiePlot multiplePiePlot = (MultiplePiePlot) multiplePieChart.getPlot(); JFreeChart pieChart = multiplePiePlot.getPieChart(); pieChart.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR ); pieChart.getTitle().setFont( SUB_TITLE_FONT ); PiePlot piePlot = (PiePlot) pieChart.getPlot(); piePlot.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR ); piePlot.setOutlinePaint( DEFAULT_BACKGROUND_COLOR ); piePlot.setLabelFont( LABEL_FONT ); piePlot.setLabelGenerator( new StandardPieSectionLabelGenerator( "{2}" ) ); piePlot.setSimpleLabels( true ); piePlot.setIgnoreZeroValues( true ); piePlot.setIgnoreNullValues( true ); piePlot.setShadowXOffset( 0d ); piePlot.setShadowYOffset( 0d ); for ( int i = 0; i < dataSets[0].getColumnCount(); i++ ) { piePlot.setSectionPaint( dataSets[0].getColumnKey( i ), COLORS[(i % COLORS.length)] ); } return multiplePieChart; }
((PiePlot) plot).setCircular(true); ((PiePlot) plot).setLabelGenerator(null); ((PiePlot) plot).setShadowXOffset(0); ((PiePlot) plot).setShadowYOffset(0); ((PiePlot) plot).setSectionOutlinesVisible(false);