Adding Charts

The procedure for adding a chart is the same for all types; the code itself varies depending on the type of chart.

  1. In Workbench, open the script for the central or overview page. For example, chart.divetab.
  2. Within an hsplit or vsplit block, add the chart tag, including an open brace, {, to indicate the start of the block.
  3. Add a dimension and at least one column. You can include a title and a cplan, but they are not required.

    NOTE: The chart can be included within an elements block inside a definitions block or data page, and referenced using the id tag, or the full code can be included in the data page layout itself.

  4. Add a closing brace, }, to indicate the end of the block.
  5. Save the script.

Here is an example of a bar-chart:

  bar-chart id = "br-yearmo" { 
    cplan "/cplans/basic_101.cplan" 
    title "Bar YearMo" 
    dimension "Posting Period" 
    bar column = "Cases" 
  } 

Here is an example of an hbar-chart:

  hbar-chart id = "hbr-yearmo" { 
    cplan "/cplans/basic_101.cplan" 
    dimension "Posting Period" 
    bar column = "Cases" 
  } 

Notice that there is no title for an hbar-chart. This can be resolved by containing the hbar-chart within a box element.

Here is an example of a line-chart:

  line-chart id = "ln-yearmo" { 
    cplan "/cplans/basic_101.cplan" 
    title "YearMo" 
    dimension "Posting Period" 
    line column = "Cases" 
  } 

Here is an example of a pie-chart:

  pie-chart id = "pc-yearmo" { 
    cplan "/cplans/basic_101.cplan" 
    title "YearMo" 
    dimension "Posting Period" 
    column column = "Cases" 
  } 

NOTE: A pie-chart can have only one column.

You can include a link to another page for the column attribute. If a parameter is included on the target page, the value selected is passed to the target page.

For bar, h-bar, and line charts the links are accessible through the chart values. For pie charts, the links can be accessible through the legend and chart values.

See also: