Java Code Examples for org.jfree.chart.plot.PiePlot#setLabelOutlinePaint()

The following examples show how to use org.jfree.chart.plot.PiePlot#setLabelOutlinePaint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Crée le graphe JFreeChart.
 *
 * @param piedataset
 *          : la source de données à afficher
 * @return le diagramme
 */
private JFreeChart createChart(GraphPieDataset piedataset) {
  JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false);
  jfreechart.setAntiAlias(true);
  jfreechart.setTextAntiAlias(true);

  PiePlot pieplot3d = (PiePlot) jfreechart.getPlot();
  pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0));
  final double angle = 290D;
  pieplot3d.setStartAngle(angle);
  pieplot3d.setDirection(Rotation.CLOCKWISE);
  final float foreground = 0.5F;
  pieplot3d.setForegroundAlpha(foreground);
  pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay);
  pieplot3d.setCircular(true);

  pieplot3d.setOutlinePaint(null);
  pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10));
  pieplot3d.setLabelGap(0.02);
  pieplot3d.setLabelOutlinePaint(null);
  pieplot3d.setLabelShadowPaint(null);
  pieplot3d.setLabelBackgroundPaint(Color.WHITE);
  pieplot3d.setBackgroundPaint(Color.WHITE);
  // avoid showing the percentage as an absolute number in the tooltip
  pieplot3d.setToolTipGenerator(new StandardPieToolTipGenerator("{0}: {2}"));
  pieplot3d.setInteriorGap(0.02);
  pieplot3d.setMaximumLabelWidth(0.20);

  return jfreechart;
}
 
Example 2
Source File: EyeCandySixtiesChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected JFreeChart createPieChart() throws JRException
{
	JFreeChart jfreeChart = super.createPieChart();
	PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
	JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
	boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();

	if (isShowLabels && piePlot.getLabelGenerator() != null)
	{
		piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
		piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
		piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
	}
	piePlot.setShadowXOffset(5);
	piePlot.setShadowYOffset(10);
	piePlot.setShadowPaint(new GradientPaint(0, getChart().getHeight() / 2, new Color(41, 120, 162), 0, getChart().getHeight(), Color.white));
	PieDataset pieDataset = piePlot.getDataset();
	if (pieDataset != null)
	{
		for (int i = 0; i < pieDataset.getItemCount(); i++)
		{
			piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
			//makes pie colors darker
			//piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
		}
	}
	
	piePlot.setCircular(true);
	return jfreeChart;
}
 
Example 3
Source File: AegeanChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected JFreeChart createPieChart() throws JRException
{
	JFreeChart jfreeChart = super.createPieChart();

	PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
	JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
	boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();

	if(isShowLabels && piePlot.getLabelGenerator() != null)
	{
		piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
		piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
		piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
	}
	piePlot.setShadowXOffset(0);
	piePlot.setShadowYOffset(0);
	PieDataset pieDataset = piePlot.getDataset();
	if(pieDataset != null)
	{
		for(int i = 0; i < pieDataset.getItemCount(); i++)
		{
			piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
			
			//makes pie colors darker
			//piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
		}
	}
	piePlot.setCircular(true);
	return jfreeChart;
}