use of org.activityinfo.server.report.renderer.image.ItextGraphic in project activityinfo by bedatadriven.
the class ItextChartRenderer method renderImage.
protected void renderImage(DocWriter writer, Document doc, PivotChartReportElement element, float width, float height) throws BadElementException, DocumentException {
ItextGraphic image = imageCreator.create((int) width, (int) height);
chartRenderer.render(element, false, image.getGraphics(), (int) width, (int) height, 72);
doc.add(image.toItextImage());
}
use of org.activityinfo.server.report.renderer.image.ItextGraphic in project activityinfo by bedatadriven.
the class ItextMapRenderer method addPieChartDescription.
private void addPieChartDescription(MapReportElement element, Cell descriptionCell, PiechartMapLayer layer) throws BadElementException, IOException {
for (Slice slice : layer.getSlices()) {
IndicatorDTO indicator = element.getContent().getIndicatorById(slice.getIndicatorId());
Color color = ColorUtil.colorFromString(slice.getColor());
ItextGraphic sliceImage = renderSlice(imageCreator, color, 10);
Chunk box = new Chunk(sliceImage.toItextImage(), 0, 0);
Chunk description = new Chunk(indicator.getName());
Phrase phrase = new Phrase();
phrase.add(box);
phrase.add(description);
Paragraph paragraph = new Paragraph(phrase);
descriptionCell.add(paragraph);
}
}
Aggregations