cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Zirl" <>
Subject AW: Link: Project:PDF Report with Pie chart
Date Sat, 08 Jan 2005 17:05:08 GMT
Sure there’s a way to do so, but it’s a bit complex. 
I just played around a bit with SVG, and the fo2pdf Serializer available
with cocoon.

Ok, here’s a short recipe >>

1. SVG
If you generate the pie chart at runtime, I suggest using SVG graphics. For
a pie chart, simply draw as many circles as pie pieces available, and clip
their regions out (i.e. only the clipping part will be drawn, the rest will
have an alpha value of 0).

Here's a short example of how this could work. Simply save this xml-code as
a *.svg file and load it into your browser. (Use , et. al. as references.) You can
generate this portion of XML via your cocoon setup (and also make the
necessary calculations for the angles, if calculated at runtime). The tricky
part will be to compute the exact locations of the polygons that clip the
regions (i.e. the pieces) of the circle (i.e. the entire pie). This works
fine for smaller pie pieces, but might not be an elegant solution for rather
large pieces. Especially for pieces >=180 degrees, this fails. Think about
it and you'll see why.... If there's a more elegant solution, let me know,
I'm always interested :) 

<svg xmlns="" width="1000" height="1000">
<ellipse rx="100" ry="100" style="fill:red" transform="translate(500,500)"
<ellipse rx="100" ry="100" style="fill:blue" transform="translate(500,500)"
<ellipse rx="100" ry="100" style="fill:green" transform="translate(500,500)"

<clipPath id="pie1">
   <polygon points="0,0 -50,-100 50,-100" />
<clipPath id="pie2">
   <polygon points="0,0 -500,-1000 0,10000" />
<clipPath id="pie3">
   <polygon points="0,0 0,10000 500,-1000" />


Once you have generated the SVG, you can incorporate it into your PDF as
follows (See

<fo:instream-foreign-object width="1000pt" height="1000pt"
content-width="500pt" content-height="500pt">
   <!-- svg code goes here -->


I hope this serves as a first hint for your "urgent requirement" :)


--- Original Message ---
Link: Project:PDF Report with Pie chart

I didn't find any sample project for PDF Report generation with Pie charts.
Please help me in this Regard.
I have an urgent requirement.
With Regards,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message