Chart Design Overview
This page describes the basic steps and related subroutine calls for creating a simple chart.
Description:
Designing a chart can be as simple as calling two subroutines - one to initialize a new chart specification (.CHART INITIALIZE) and one to render the chart (.CHART RENDER). The following example illustrates the ILF statements needed to initialize and render a default pie chart (/tmp/piechart.png) using a previously defined dataset consisting of seven data values.
* Initialize Pie Chart
PASS PIE CHART FIELD SHARE? N
GOSUB 0CD .CHART INITIALIZE
* Note: We aren't showing the steps to supply the data,
* see the next example
* Render chart
SET --- TEMP 256 = /tmp/piechart.png
PASS --- TEMP 256 FIELD SHARE? Y
GOSUB 0CD .CHART RENDER
By adding a few additional subroutine calls to set a title, seven data values with sector labels, and a 3D view, a more useful chart can be rendered.
* ================================================================
* Create Pie Chart
* ================================================================
* Initialize a Pie Chart
PASS PIE CHART FIELD SHARE? N
GOSUB 0CD .CHART INITIALIZE
* Set a title
PASS Sales % By Day of Week FIELD SHARE? N
GOSUB 0CD .CHART SET TITLE
* Set 3D view
PASS 3D FIELD SHARE? N
GOSUB 0CD .PIE SET VIEW
* Add pie sectors with day of week labels and data values
PASS 25 FIELD SHARE? N
PASS Monday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
PASS 14 FIELD SHARE? N
PASS Tuesday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
PASS 36 FIELD SHARE? N
PASS Wednesday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
PASS 2 FIELD SHARE? N
PASS Thursday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
PASS 12 FIELD SHARE? N
PASS Friday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
PASS 33 FIELD SHARE? N
PASS Saturday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
PASS 5 FIELD SHARE? N
PASS Sunday FIELD SHARE? N
GOSUB 0CD .PIE SECT ADD NEXT
* ================================================================
* Render chart
* ================================================================
SET --- TEMP 256 = /tmp/piechart.png
PASS --- TEMP 256 FIELD SHARE? Y
GOSUB 0CD .CHART RENDER
Comments
Read what other users have said about this page or add your own comments.
--
SteveFrizzell - 2010-04-01