18.2. Charting
Charting support is also provided with
jboss-seam-pdf.jar
. Charts can be used in PDF documents, or as images in an HTML page. To use charting, you will need to add the JFreeChart library (jfreechart.jar
and jcommon.jar
) to the WEB-INF/lib
directory. Three types of charts are currently supported: pie charts, bar charts and line charts.
<p:chart>
|
Description
Displays a chart already created in Java by a Seam component.
Attributes
Usage
<p:chart chart="#{mycomponent.chart}" width="500" height="500" /> |
<p:barchart>
|
Description
Displays a bar chart.
Attributes
Usage
<p:barchart title="Bar Chart" legend="true" width="500" height="500"> <p:series key="Last Year"> <p:data columnKey="Joe" value="100" /> <p:data columnKey="Bob" value="120" /> </p:series> <p:series key="This Year"> <p:data columnKey="Joe" value="125" /> <p:data columnKey="Bob" value="115" /> </p:series> </p:barchart> |
<p:linechart>
|
Description
Displays a line chart.
Attributes
Usage
<p:linechart title="Line Chart" width="500" height="500"> <p:series key="Prices"> <p:data columnKey="2003" value="7.36" /> <p:data columnKey="2004" value="11.50" /> <p:data columnKey="2005" value="34.625" /> <p:data columnKey="2006" value="76.30" /> <p:data columnKey="2007" value="85.05" /> </p:series> </p:linechart> |
<p:piechart>
|
Description
Displays a pie chart.
Attributes
Usage
<p:piechart title="Pie Chart" circular="false" direction="anticlockwise" startAngle="30" labelGap="0.1" labelLinkPaint="red"> <p:series key="Prices"> <p:data key="2003" columnKey="2003" value="7.36" /> <p:data key="2004" columnKey="2004" value="11.50" /> <p:data key="2005" columnKey="2005" value="34.625" /> <p:data key="2006" columnKey="2006" value="76.30" /> <p:data key="2007" columnKey="2007" value="85.05" /> </p:series> </p:piechart> |
<p:series>
|
Description
Category data can be broken down into series. The series tag is used to categorize a data set with a series and apply styling to the entire series.
Attributes
Usage
<p:series key="data1"> <ui:repeat value="#{data.pieData1}" var="item"> <p:data columnKey="#{item.name}" value="#{item.value}" /> </ui:repeat> </p:series> |
<p:data>
|
Description
The data tag describes each data point to be displayed in the graph.
Attributes
Usage
<p:data key="foo" value="20" sectionPaint="#111111" explodedPercent=".2" /> <p:data key="bar" value="30" sectionPaint="#333333" /> <p:data key="baz" value="40" sectionPaint="#555555" sectionOutlineStroke="my-dot-style" /> |
<p:color>
|
Description
The color component declares a color or gradient for filled shapes.
Attributes
Usage
<p:color id="foo" color="#0ff00f"/> <p:color id="bar" color="#ff00ff" color2="#00ff00" point="50 50" point2="300 300"/> |
<p:stroke>
|
Description
Describes a stroke used to draw lines in a chart.
Attributes
Usage
<p:stroke id="dot2" width="2" cap="round" join="bevel" dash="2 3" /> |