Hi there,
I need to create charts inline in the document (not as separate
documents). I've looked at the JFreeCharts example, and it won't work for
me for two reasons. First off, it creates a separate document. Secondly,
it seems specific to the PdfWriter, and I need a solution that will also
work for RTF (and HTML.)
I've tried creating an image using JFreeChart directly and inserting it,
but it look cruddy, with fuzzy fonts. Here's the code I'm using:
JFreeChart chart = ChartFactory.createPieChart(element.getElementTitle(),
pieDataset,
false, true, false);
Font legendFont = new Font("Dialog", Font.PLAIN, 8);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setLabelFont(legendFont);
chart.getTitle().setFont(legendFont);
BufferedImage ch = chart.createBufferedImage(400, 400);
Graphics2D twod = ch.createGraphics();
Image image = Image.getInstance(EncoderUtil.encode(ch, ImageFormat.PNG));
image.setAlignment(Element.ALIGN_CENTER);
document.add(image);
Can someone help me out? I need to be able to stick charts in the middle
of the page, and have them look good, for RTF and PDF and HTML (or at least
RTF and PDF)
James Turner
[EMAIL PROTECTED]
603-552-2020
Freelance Technology Journalist
Senior Contributing Editor, Linux Planet
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions