Sprache: Deutsch · English
Kreisdiagramme in JasperReports – Datenbindung (Value/Label/Key) und drei Wege der Formatierung inkl. Customizer-Klasse.
HOW-TO ANWENDUNGSENTWICKLER STAND: JUL 2026 GILT FUER NUCLOS 4.2026.X
Auf dieser Seite
Pie-Chart-Auswahl im Wizard.
| Feld | Bedeutung |
|---|---|
| Value | numerischer Wert des Segments (z.B. Bestellsumme). |
| Label | Beschriftung der Anteile (Wert oder Schlüssel). |
| Key | Schlüssel/Gruppierung (entspricht GROUP BY) – erscheint in der Legende. |
| Reset on | im Normalfall Report. |
{0} nur Text
{1} mit Number
{2} Prozentangabe
Gilt für pie3DPlot und piePlot:
<pie3DPlot depthFactor="0.1" isCircular="true" labelFormat="{0} {2}" legendLabelFormat="">
<plot/>
<itemLabel>
<font fontName="Calibri" size="8"/>
</itemLabel>
</pie3DPlot>
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);
}
}