use of org.activityinfo.shared.report.content.DimensionCategory in project activityinfo by bedatadriven.
the class PiechartLayerGenerator method sumSlices.
private void sumSlices(PieMapMarker marker, List<PointValue> pvs) {
Map<DimensionCategory, PieMapMarker.SliceValue> slices = new HashMap<DimensionCategory, PieMapMarker.SliceValue>();
for (PointValue pv : pvs) {
for (PieMapMarker.SliceValue slice : pv.getSlices()) {
PieMapMarker.SliceValue summedSlice = slices.get(slice.getCategory());
if (summedSlice == null) {
summedSlice = new PieMapMarker.SliceValue(slice);
summedSlice.setIndicatorId(slice.getIndicatorId());
slices.put(slice.getCategory(), summedSlice);
} else {
summedSlice.setValue(summedSlice.getValue() + slice.getValue());
}
}
}
marker.setSlices(new ArrayList<PieMapMarker.SliceValue>(slices.values()));
}
Aggregations