PieChart
Optimal object structure (Java)
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;
}
}
Example: Filling the data
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);
or by looping from query method:
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 and methods:
Configuration "XdevPieChartConfig" general:
Properties |
|
PieHole |
If the value is between 0 and 1, a donut diagram is displayed. The hole has a radius equal to
|
PieStartAngle |
The angle in degrees by which the graph should be rotated. The default value "0" aligns the left edge of the first slice directly upwards.
|
PieSliceBorderColor |
The color of the slice borders. Only applicable if the diagram is two-dimensional.
|
PieSliceText |
The content of the text that will be displayed on the slice. Can be one of the following values:
|
SliceVisibilityThreshold |
The partial value of the pie below which a slice is not displayed individually. All slices that have not exceeded this threshold are combined into a single "Other" slice whose size is equal to the sum of all its sizes. By default, all slices smaller than half a degree are not displayed individually.
|
Is3D |
If true, a three-dimensional diagram is displayed.
|