A Java-based library that draws sector charts (like Pie Charts) inside SVG images.
Sometimes, it is interesting to generate sector charts inside images. This approach can convey a different result than traditional pie charts and aggregate value to a report. As an example, a report with the profile of a person could be presented with a chart with a person filled with sections that represents the intensity of different characteristics that form the person's profile (Figure 1).
Sometimes, it is interesting to generate sector charts inside images. This approach can convey a different result than traditional pie charts and aggregate value to a report. As an example, a report with the profile of a person could be presented with a chart with a person filled with sections that represents the intensity of different characteristics that form the person's profile (Figure 1).
final DataSet dataSet = new DataSet();
dataSet.createEntry("Dominant", 5.10, new Color(236, 107, 86));
dataSet.createEntry("Extrovert", 5.05, new Color(255, 193, 84));
dataSet.createEntry("Planner", 2.15, new Color(71, 179, 156));
dataSet.createEntry("Analytic", 1.97, Color.WHITE);
final SVGPainter painter = new SVGSalamanderPainter(Paths.get("trophy.svg").toUri());
final SVGChart chart = new SVGChart(painter, dataSet, SVGChart.Directions.VERTICAL, SVGChart.SortOrders.REVERSE);
final BufferedImage image = chart.generateImage(200, 200);
After generating an image, it can be easily export to a file or PDF.
ImageIO.write(image, "PNG", new File("trophy.png"));
// OR
com.itextpdf.text.Image pdfImage = com.itextpdf.text.Image.getInstance(image, null);
pdfImage.setAbsolutePosition((float) ((pageSize.getWidth() - image.getWidth()) / 2), (float) ((pageSize.getHeight() - image.getHeight()) / 2) - 50f);
pdfImage.setDpi(300, 300);
document.add(pdfImage);