Chart

Types of Charts

  • Pie
  • Bar
  • Line
  • Area
  • XY Plots
  • Gantt

Chart Options

Specifying the Chart Type

  • Specify which type of chart you want with the type option
  • The type attribute can have the following values:
    • Standard:
      • pie (default)
      • bar
      • line
      • area
    • XY Plots:
      • xyArea
      • xyBar
      • xyLine
      • xyStep
      • xyStepArea
      • scatter
      • timeSeries
    • Other:
      • gantt

For example, to create a simple line chart, you type the following while editing the page in Wiki Markup:

{chart:type=line}
...

Customizing the Display of the Chart

The following attributes can also be supplied to the chart macro is change its display:

  • orientation - to display the chart horizontally (where the y-axis is horizontal) type 'orientation=horizontal' (default is vertical)
  • showShapes - to not display the data points on a line chart type 'showShapes=false' (the data points are shown by default)
  • stacked - instead of comparing bar charts side by side or area charts on top of each other, you can stack the charts vertically by specifying 'stacked=true
  • opacity - change the opacity of the chart graphics by specifying 'opacity=(a # between 0 and 100)' with 0 being not visible and 100 being non-transparent (default is usually 100)
  • width/height - specify the width or height of the chart in pixels (e.g. ...height=500|width=400... )
  • dataDisplay - you can display the data for the chart in a table by typing 'dataDisplay=true' (default is false, also you can specify where you want the data table to be placed by either 'dataDisplay=before' or 'dataDisplay=after' - the default is after)
  • imageFormat - specify the image format you want the chart to be in (valid values are png and jpg - default is png)
  • title - specify the title of the chart (e.g. chart:type=bar|title=My Bar Chart... )
  • subTitle - supply more information about the chart in a smaller font
  • xLabel/yLabel - specify the label for the x or y axis (e.g. ...xLabel=Year|yLabel=Profit...)
  • legend - you can turn off the legend with 'legend=false' (default is 'legend=true')

Extra:

  • You can make a pie, bar, or line chart 3D by typing '3D=true' (e.g. chart:type=pie|3D=true|title=My 3D Pie Chart...)

Chart Macro Examples

  • Here are a few examples of what can be done with the chart macro

Simple Pie Chart

{chart:type=pie}
|| || Democrat || Republican || Independent ||
|| Mascots | 40 | 40 | 20 |
{chart}

Simple Bar Chart

{chart:title=Temperatures in Brisbane|type=bar|width=400|height=350|legend=true}
|| || January || February || March || April ||
|| Max | 37.5 | 32.7 | 28.0 | 25.3 |
|| Min | 31.3 | 26.8 | 25.1 | 18.7 |
{chart}

Simple Bar Chart STACKED

{chart:title=Temperatures in Brisbane|type=bar|width=400|height=350|legend=true|stacked=true}
|| || January || February || March || April ||
|| Max | 37.5 | 32.7 | 28.0 | 25.3 |
|| Min | 31.3 | 26.8 | 25.1 | 18.7 |
{chart}

Simple Line Chart

{chart:title=Temperatures in Brisbane|type=line|width=500|height=300|legend=true|showShapes=false}
|| || January || February || March || April ||
|| Max | 37.5 | 32.7 | 28.0 | 25.3 |
|| Min | 31.3 | 26.8 | 25.1 | 18.7 |
{chart}

Simple Area Chart


Satisfaction 2002 2003 2004
Very satisfied 20 23 34
Satisfied 40 34 23
Disatisfied 25 26 25
Very disatisfied 15 17 18
{chart:type=area|dataDisplay=true|legend=true|width=500|height=500|opacity=50}
|| Satisfaction   || 2002 || 2003 || 2004 ||
| Very satisfied   | 20    |   23 |   34  |
| Satisfied        | 40    |   34 |   23  |
| Disatisfied      | 25    |   26 |   25  |
| Very disatisfied | 15    |   17 |   18  |
{chart}

Advanced 3D Bar Chart


Month Max
Temperature
Min
Temperature
Average
Temperature
January 25.5 6.3 15.9
February 32.4 12.8 22.6
March 44.6 24.5 34.6
April 59.7 37.1 48.4
May 72.5 48.7 60.6
June 81.3 57.9 69.6
July 85.2 62.8 74
August 82.5 60.7 71.6
September 73.7 51.7 62.7
October 61.1 40.1 50.6
November 43.6 27.4 35.5
December 29.9 13.6 21.8
{chart:type=bar|3D=true|title=Temperatures in Rochester \\
 Minnesota|dataDisplay=true|width=1000|height=500|legend=true
|yLabel=Fahrenheit|dataOrientation=vertical}
|| Month || Max\\Temperature || Min\\Temperature || Average\\Temperature ||
| January   | 25.5 |        6.3     | 15.9 |
| February  | 32.4 |        12.8    | 22.6 |
| March     | 44.6 |        24.5    | 34.6 |
| April     | 59.7 |        37.1    | 48.4 |
| May       | 72.5 |        48.7    | 60.6 |
| June      | 81.3 |        57.9    | 69.6 |
| July      | 85.2 |        62.8    | 74   |
| August    | 82.5 |        60.7    | 71.6 |
| September | 73.7 |        51.7    | 62.7 |
| October   | 61.1 |        40.1    | 50.6 |
| November  | 43.6 |        27.4    | 35.5 |
| December  | 29.9 |        13.6    | 21.8 |
{chart}

Labels

macro macro Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact