Insert a Chart in a PdfPTable cell

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

Insert a Chart in a PdfPTable cell

Postby validName » Mon Nov 06, 2017 7:10 am

Hello all,

I am a beginner working for the first time with JFreeChart, I have to modify an application using a PDF export by adding Charts and tables....and charts into tables.

I have tried to find answer but solutions seem to be quite ancient and nothing worked. Can anyone help please ?

this is the code of the cell:
Code: Select all
PdfPCell cell = new PdfPCell(new Phrase());
p = new Paragraph();
p.add(new Chunk("I'd like to put my chart here", myFont));
cell = new PdfPCell();

and here the code to display the Chart I have to insert in the cell :
Code: Select all
JFreeChart Chart = myChart(0, 10, 20 , 30);
BufferedImage ChartBufferedImage = myChart.createBufferedImage(200, 200);
Image ChartImage = Image.getInstance(writer,ChartBufferedImage, 1.0f);

It seems easy because the chart is already in a table but I can't find how to manage to copy it in another cell of another table. Should I use another PDF writer and/or ByteArrayOutputStream ?
I have tried to be as specific as i could.
Posts: 1
Joined: Mon Nov 06, 2017 6:56 am

Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests