Creating chart objects and setting chart types and stylesTo create a chart in accordance with the specified chart type and style, use the following code: create(chartType, chartStyle, startCell, columnSize, rowSize) |
Where the parameters are: - chartType: case-sensitive type of the created chart with one of the following options:
- "Line"
- "Column"
- "Pie"
- "Bar"
- "Area"
- "Surface"
- "Radar"
- Line
- "Line" (the default style)
- "Staked Line"
- "100% Stacked Line"
- "Line with Markers"
- "Stacked Line with Markers"
- "100% Stacked Line with Markers"
- "3-D Line"
- Column
- "Clustered Column" (the default style)
- "Stacked Column"
- "100% Stacked Column"
- "3-D Clustered Column"
- "3-D Stacked Column"
- "3-D 100% Stacked Column"
- "3-D Column"
- Pie
- "Pie" (the default style)
- "3-D Pie"
- "Doughnut"
If you do not specify the chart style, the default style of the chosen chart type is used. |
- startCell: the first cell of the data table used for the chart.
- columnSize and rowSize: numeric values that determine the size of the data table.
An example of the code for a 3x5 size data table starting at cell A4: #set($linechart = $chart.create("Column", "3-D Column", "A4", 3, 5)) |
Setting chart titlesTo set a chart title, use the following code: For example: $linechart.setTitle("Line Chart") |
If you do not enter the chart title, the default title “Sample” is used. |
Printing a chart to a reportTo print a chart to a report, use the following code: For example:
A full sample of the Chart tool code is shown below: #import('chart', 'com.nomagic.reportwizard.tools.ChartTool')
#set($linechart = $chart.create("Column", "3-D Column", "A4", 3, 5))
$linechart.setTitle("Sample")
$linechart.buildChart() |
 A chart printed to a report after applying the full sample code using the Chart tool.
|