Cheers, i finally figured out what the relationship between them was with a
lot of trial and error.  I ended up using Arc2D, PdfTemplate and Graphics2D
objects to draw a pie chart.  I didn't want to use .arc() as I wanted to
draw pies not arcs.

Ruskin


On 5/16/07, Paulo Soares <[EMAIL PROTECTED]> wrote:

You have a drawing area of 200x200 and an y of 600. That's a bit off
mark, isn't it? In any case you should use PdfContentByte.arc()
otherwise your question belong in a java.awt forum.

Paulo

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Ruskin Dantra
> Sent: Tuesday, May 15, 2007 9:33 PM
> To: Post all your questions about iText here
> Subject: [iText-questions] drawing a pie chart using itext
>
> hi all,
> I have been struggling with this and I cannot figure out the
> reference between these objects.  I have the following code:
>
> --------------------------------------------------------------
> ----------------------------------------------
>
> Document document = new Document();
>    PdfWriter writer = PdfWriter.getInstance(document, new
> FileStream("C:\\test.pdf", FileMode.Create));
>
>    document.open();
>
>    int x = 0;
>    int y = 600;
>    int w = 200;
>    int h = 200;
>
>    PdfContentByte cb = writer.getDirectContent();
>    Graphics2D g2 = cb.createGraphics(w, h);
>
>    Arc2D.Float arc  = new Arc2D.Float(x, y, w, h, 0, -109, Arc2D.PIE);
>    Arc2D.Float arc2 = new Arc2D.Float(x, y, w, h, -109, -81,
> Arc2D.PIE);
>    Arc2D.Float arc3 = new Arc2D.Float(x, y, w, h, -109 - 81,
> -132, Arc2D.PIE);
>    Arc2D.Float arc4 = new Arc2D.Float(x, y, w, h, -109 - 81 -
> 132, -35, Arc2D.PIE);
>
>    arc.setFrame(x, y, 150.0, 100.0);
>    arc2.setFrame(x, y, 150.0, 100.0 );
>    arc3.setFrame(x, y, 150.0, 100.0);
>    arc4.setFrame(x, y, 150.0, 100.0);
>
>    g2.setColor(Color.red);
>    g2.fill(arc);
>
>    g2.setColor(Color.blue);
>    g2.fill(arc2);
>
>    g2.setColor (Color.yellow);
>    g2.fill(arc3);
>
>    g2.setColor(Color.green);
>    g2.fill(arc4);
>
>    g2.dispose();
>
>    document.close();
>
>    Process.Start("C:\\test.pdf");
>
> --------------------------------------------------------------
> ----------------------------------------------
>
>
>
> Nothing seems to get printed onto the pdf, although when I
> tweak the values of x, y, width, height i get some sort of
> graph but nowhere where it would make sense to me.  All i
> really want to do is to draw a pie graph in a given
> rectangle, given its x, y position on the page.  How can i
> make that possible?  Any help would be appreciated.
>
>
> Thanks
>
> Ruskin
>
>
>


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão
desta mensagem não significa a perca de confidencialidade. Se esta mensagem
for recebida por engano, por favor envie-a de volta para o remetente e
apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o
destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may
contain confidential or legally protected information. The incorrect
transmission of this message does not mean the loss of its confidentiality.
If this message is received by mistake, please send it back to the sender
and delete it from your system immediately. It is forbidden to any person
who is not the intended receiver to use, distribute or copy any part of this
message.



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to