Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Auszug
hiddentrue

Nuclos Jasper pie chart: value label key, label format, pie3DPlot, piePlot, customizer, PiePlot, setLabelFont.

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.

Status
colourPurple
titleHow-to
Status
colourBlue
titleApplication developer
Status
colourGreen
titleUpdated: Jul 2026
Status
colourGrey
titleapplies to Nuclos 4.2026.x

Panel
bgColor#F4F5F7

On this page

Inhalt
maxLevel2
minLevel2

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)

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

2. Font & size in the XML

Applies to pie3DPlot and piePlot:

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

3. Custom customizer class

Codeblock
languagejava
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 →