Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

  

Inhalt:

    • Optimale Datenstruktur
    • Beispiel: Füllen der Daten

Anchor
Data
Data
Optimale Datenstruktur (Datenbank)

KategoryWert
Bverages393
Condiments507
Confections386

Optimale Objektstruktur (Java)

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
public class PieChartObject {
	private String category;
	private Integer value;

	public String getCategory() {
		return this.category;
	}

	public void setCategory(final String category) {
		this.category = category;
	}

	public Integer getValue() {
		return this.value;
	}

	public void setValue(final Integer value) {
		this.value = value;
	}
}

Anchor
Fill
Fill
Beispiel: Füllen der Daten

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
final ChartModel model = ChartModel.New()
	.addColumn(Column.New(Type.STRING))
	.addColumn(Column.New(Type.NUMBER));

model.addRow("Katze", 50);
model.addRow("Hund", 25);
model.addRow("Schlange", 25);

this.pieChart.setModel(model);

...

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
final ChartModel model = ChartModel.New()
	.addColumn(Column.New(Type.STRING))
	.addColumn(Column.New(Type.NUMBER));

new ProductDAO().getProductsByCategoryForChart().forEach(p -> {
       model.addRow(p.getCategory().getCategoryname(), (int)p.getAmount());
});

chart.setModel(model);

API und Methoden:

Anchor
SizingSizing
Positionierung und Größe des Pie innerhalb des Chartbereichs
Common
Common
Konfiguration "XdevPieChartConfig" allgemein:

Properties
PieHole

If between 0 and 1, displays a donut chart. The hole with have a radius equal to number times the radius of the chart.

Code Block
languagejava
themeEclipse

...

XdevPieChartConfig config = new XdevPieChartConfig();

final ChartArea area = new ChartArea();

area.setHeigth("100"); //Höhe des Pie
area.setWidth("100"); //Breite des Pie
area.setLeft("100"); //Abstand des Pie von Links in Pixel
area.setRight("100"); //Abstand des Pie von Links in Pixel
area.setTop("100"); //Abstand des Pie von Links in Pixel

config.setChartArea(area);

...

pieChart.setPieHole(0.5);


PieStartAngle

The angle, in degrees, to rotate the chart by. The default of 0 will orient the leftmost edge of the first slice directly up.

Code Block
languagejava
themeEclipse

...

config.setIs3D(false); //3D Darstellung ein- oder ausschalten
config.setPieHole(0.4); //Darstellung als Donut-Chart ein- oder ausschalten. Wert zwischen 0 und 1 in Abhängigkeit des Pie Radius
config.setPieStartAngle(3); //Drehung des PieCharts in Grad

...

pieChart.setPieStartAngle(60);


PieSliceBorderColor

The color of the slice borders. Only applicable when the chart is two-dimensional.

Code Block
languagejava
themeEclipse

...

pieChart.setPieSliceBorderColor("

...

red");

...


PieSliceText

The content of the text displayed on the slice. Can be one of the following:

  • 'percentage' - The percentage of the slice size out of the total.
  • 'value' - The quantitative value of the slice.
  • 'label' - The name of the slice.

'none' - No text is displayed

Code Block
languagejava
themeEclipse

...

...

pieChart.setPieSliceText(PieSliceText.

...

PERCENTAGE);


SliceVisibilityThreshold

The fractional value of the pie, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single "Other" slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree.

Code Block
languagejava
themeEclipse

...

//Grenze für die Zusammenfassung mehrerer Slices. Kategorien welche einen bestimmte prozentuellen Wert nicht Überschreiten
//werden zu einem Slice zusammengefasst und als "Other" aufgeführt. Mögliche Werte 0 und 1 bezogen auf den prozentuellen Anteil.
config.setSliceVisibilityThreshold(0.15);
config.setPieResidueSliceLabel("Sonstige"); //Setzen des Titels für die zusammengefassten Kategorien Default: "Others"

...

pieChart.setSliceVisibilityThreshold(25);


Is3D

If true, displays a three-dimensional chart.

Code Block
languagejava
themeEclipse

...

pieChart.setIs3D(true);