Pie ChartThe following figure is an example of a standard pie chart generated by Xchart.
Figure 1: Pie Chart Example 1. Defining the chart type Setting the chart type requires setting the “type” attribute in the “xchart” element. In the following code example, the type is set to “piechart”. For line chart and bar chart, the type should be set to “linechart” and “barchart” respectively. <xchart type="piechart" id="mychart1" title="Time Report" 2. Defining the chart data The “segment” child element is the basic unit of Xchart and represents each slice of a pie chart. The “value” attribute is used to set the value of a segment. Labeling the xchart segment uses the “text” attribute. The value of each segment is displayed as a percentage of total values. The proportions of each segment are also shown compared to the whole. <xchart type="piechart" id="mychart1" title="Time Report" In the code example above, the pie chart is composed of six (6) different components that represent “Design”, “Analysis”, “Development”, “testing”, “Deployment”, and “Administrative Task”. 3. Setting the Title and Styles To set the title of a chart, the “title” attribute of Xchart is used. To set the size of the pie, the “radius” attribute, set in pixels, needs to be defined. <xchart type="piechart" id="mychart1" title="Time Report" radius=”100"
Back to: Application Guide |
|
|
COPYRIGHT © 1997–2006
JWAY GROUP, Inc. |
|