You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Sa...@commerzbank.com on 2004/07/12 15:49:01 UTC
how to generating charts in PDF ?
hi,
i'm using FOP for our reporting tools, thanks to FOP we can make a nice
looking PDF-File.
great job people !
recently we need to generate not only tables or text, but also some
charts/diagramms ( like pie chart, gantt , etc)
and this charts should be embeded in the pdf, as a graphic format ( like SVG
or JPEG )
Does anyone have any idea how to do these things ? somekind of library maybe
?
thanks in advance
sandy
"Die vorstehend geäußerte Meinung gibt nur die Auffassung des Autors wieder
und darf nicht als Hinweis auf die Meinung der Commerzbank AG oder einer
ihrer Tochtergesellschaften verstanden oder ausgelegt werden."
"those managing expressed opinion shows only the view of the author
and may not not as reference to the opinion of the Commerzbank AG or
one of their subsidiaries be understood or laid out."
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: how to generating charts in PDF ?
Posted by Derrick Shoemake <ds...@protocolinc.com>.
We use SVG to generate our Pie Charts and our bar charts. It's not too
hard to create. I looked at the code from this site and started
creating my own variations for testing.
http://www.svgopen.org/2003/papers/CreatingSVGPieChartsThroughWebService
Here is a Pie Chart that I tested with:
<fo:table-cell xsl:use-attribute-sets="table-piechart-style">
<xsl:variable name="number"
select="operatingaverages/monthly/efficiency" />
<xsl:variable name="difference" select="100 - $number" />
<xsl:variable name="currentAngle" select="math:toRadians(($number div
100) * 360.0)" />
<xsl:variable name="halfAngle" select="math:toRadians((($number div 2)
div $total) * 360.0)" />
<xsl:variable name="rotation" select="270 + (360.0 * ($number div
100))" />
<xsl:variable name="x1" select="math:cos($halfAngle) * 70" />
<xsl:variable name="y1" select="math:sin($halfAngle) * 70" />
<xsl:variable name="cosTheta"
select="math:cos(math:toRadians($rotation))" />
<xsl:variable name="sinTheta"
select="math:sin(math:toRadians($rotation))" />
<fo:instream-foreign-object>
<svg height="100" viewBox="0 0 200 100" width="200"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<path
style="fill:{$color1};stroke:black;stroke-width:1;fillrule:evenodd;
stroke-linejoin:bevel;">
<xsl:attribute name="transform">
<xsl:text>translate(100,50)</xsl:text>
<xsl:text>rotate(</xsl:text>
<xsl:value-of select="$rotation" />
<xsl:text>)</xsl:text>
</xsl:attribute>
<xsl:attribute name="d">
<xsl:text>M 50 0 A 50 50 0 </xsl:text>
<xsl:choose>
<xsl:when test="$currentAngle > 3.14">
<xsl:text>1 </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0 </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>1 </xsl:text>
<xsl:value-of select="math:cos($currentAngle) * 50" />
<xsl:text> </xsl:text>
<xsl:value-of select="math:sin($currentAngle) * 50" />
<xsl:text> L 0 0 Z</xsl:text>
</xsl:attribute>
</path>
</g>
</svg>
</fo:instream-foreign-object>
</fo:table-cell>
Derrick Shoemake
On Jul 12, 2004, at 8:49 AM, Sandy.Soesilo@commerzbank.com wrote:
>
>
> hi,
>
> i'm using FOP for our reporting tools, thanks to FOP we can make a nice
> looking PDF-File.
> great job people !
>
> recently we need to generate not only tables or text, but also some
> charts/diagramms ( like pie chart, gantt , etc)
> and this charts should be embeded in the pdf, as a graphic format (
> like SVG
> or JPEG )
>
> Does anyone have any idea how to do these things ? somekind of library
> maybe
> ?
>
> thanks in advance
>
> sandy
>
>
>
> "Die vorstehend geäußerte Meinung gibt nur die Auffassung des Autors
> wieder
> und darf nicht als Hinweis auf die Meinung der Commerzbank AG oder
> einer
> ihrer Tochtergesellschaften verstanden oder ausgelegt werden."
>
> "those managing expressed opinion shows only the view of the author
> and may not not as reference to the opinion of the Commerzbank AG or
> one of their subsidiaries be understood or laid out."
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org