concept chart in category seam

This is an excerpt from Manning's book Seam in Action.
Seam gives you tools to build rich, Web 2.0 applications or to gently weave this richness into an existing page-oriented application. Lately, the term “rich” has become synonymous with a desktop-like experience in the web browser driven by Ajax. There are two approaches you can take to incorporate Ajax into a Seam application. You can use Ajax-enabled JSF components, such as RichFaces or ICEfaces, or you can invoke server-side components directly from the browser using JavaScript remoting. Seam extends the meaning of rich to incorporate media such as PDFs, charts, and graphics.
To add a chart to your Facelets template, you first register the UI component library in the root element of the template using the same namespace as for the PDF component tags:
xmlns:p="http://jboss.com/products/seam/pdf"The charts that Seam supports, along with the corresponding component tag, are as follow:
Taking an example from the Open 18 application, we look at the average score (average number of strokes taken) versus par (the number of expected strokes for a given hole) for a round. We group all of the holes with the same par together and look at what the golfer scored on average. The title of the chart is “Average Score vs. Par.” In this case, the bucket is the par value and how much the bucket is filled is the average score. A very basic version of this chart is shown here:
<p:barchart title="Average Score vs. Par" rangeAxisLabel="Avg Score"> <p:series key="#{round.date}"> <p:data key="Par 3" value="#{roundHome.getAverageScore(3)}"/> <p:data key="Par 4" value="#{roundHome.getAverageScore(4)}"/> <p:data key="Par 5" value="#{roundHome.getAverageScore(5)}"/> </p:series> </p:barchart>The default size of the chart in pixels is 400x300, which can be overridden using the width and height attributes. Don’t worry right now how the average scores are calculated because that’s tangential to how the bar chart works. This chart has one series, named after the date that the round was played. You must always provide at least one series. If you have only one series, and the name isn’t relevant, you can hide its presence by keeping the legend disabled. If you have more than one series, the legend is used for the purpose of identifying each series according to its color.