Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

« Vorherige Version anzeigen Version 5 Aktuelle »

globe with meridians Language: Deutsch · English

hammer and wrench Pie chart

Pie charts in JasperReports – data binding (value/label/key) and three ways of formatting including a customizer class.

HOW-TO APPLICATION DEVELOPER UPDATED: JUL 2026 APPLIES TO NUCLOS 4.2026.X

On this page

Create a pie chart

  1. Drag the chart element from the palette onto the canvas – the selection dialog opens.
  2. Choose Pie Chart or Pie3D Chart and configure via Next or create immediately with Finish.

Pie chart selection in the wizard.

Data binding

FieldMeaning
Valuenumeric value of the segment (e.g. order total).
Labellabel of the shares (value or key).
Keykey/grouping (equals GROUP BY) – shown in the legend.
Reset onusually Report.

Formatting

1. Label format (property Label Format)

{0}  text only
{1}  with number
{2}  percentage

2. Font & size in the XML

Applies to pie3DPlot and piePlot:

<pie3DPlot depthFactor="0.1" isCircular="true" labelFormat="{0} {2}" legendLabelFormat="">
  <plot/>
  <itemLabel>
    
  </itemLabel>
</pie3DPlot>

3. Custom customizer class

package org.axismanipulation;
import java.awt.Color;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot;
import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
import net.sf.jasperreports.engine.JRChart;
import java.awt.Font;

 public class PieManipulation extends JRAbstractChartCustomizer{
    @Override
    public void customize(JFreeChart chart, JRChart jasperChart) {
        PiePlot plot = (PiePlot)chart.getPlot();
        plot.setInteriorGap(0.02);
        plot.setMaximumLabelWidth(0.20);
        plot.setBackgroundPaint(Color.white);
		Font font = new Font("Calibri", Font.PLAIN, 7);
        plot.setLabelFont(font);
		plot.setCircular(true);
                 
    }
}

Related pages

bar chart Charts in the designer


Charts.

Open →

bar chart Multi axis


Multi axis.

Open →

  • Keine Stichwörter