Search in sources :

Example 1 with ItextGraphic

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());
}
Also used : ItextGraphic(org.activityinfo.server.report.renderer.image.ItextGraphic)

Example 2 with ItextGraphic

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);
    }
}
Also used : IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) Slice(org.activityinfo.shared.report.model.layers.PiechartMapLayer.Slice) Color(com.google.code.appengine.awt.Color) Phrase(com.lowagie.text.Phrase) Chunk(com.lowagie.text.Chunk) ItextGraphic(org.activityinfo.server.report.renderer.image.ItextGraphic) Paragraph(com.lowagie.text.Paragraph)

Aggregations

ItextGraphic (org.activityinfo.server.report.renderer.image.ItextGraphic)2 Color (com.google.code.appengine.awt.Color)1 Chunk (com.lowagie.text.Chunk)1 Paragraph (com.lowagie.text.Paragraph)1 Phrase (com.lowagie.text.Phrase)1 IndicatorDTO (org.activityinfo.shared.dto.IndicatorDTO)1 Slice (org.activityinfo.shared.report.model.layers.PiechartMapLayer.Slice)1