The following example program draws the pie charts shown in Figure 27 in
topic 5.7.4
PIE: PROC OPTIONS(MAIN);
DCL H_ATTRS(4) FIXED BIN(31) INIT(5,3,193,200);
DCL L_ATTRS(4) FIXED BIN(31) INIT(5,3,193,160);
DCL K_ATTRS(2) FIXED BIN(31) INIT(0,2);
DCL N_ATTRS(4) FIXED BIN(31) INIT(6,3,0,130);
DCL B_ATTRS(1) FIXED BIN(31) INIT(4);
DCL COLORS(6) FIXED BIN(31) INIT(6,2,3,4,5,1);
DCL EXPLIST(6) FIXED BIN(31) INIT(0,0,1,0,0,0);
DCL THREE_D_LIST(3) FLOAT DEC(6) INIT(0.5,0.4,0.3);
CALL FSINIT;
CALL GSFLD(1,1,32,79);
CALL GSLSS(2,'ADMUVDRP',193);/*Load duplex Roman Principal s-set*/
/****************************************************************/
/* Define chart heading */
/****************************************************************/
CALL CHHATT(4,H_ATTRS); /* Set heading attributes */
CALL CHHEAD(36,'Total Sales Figures;Last Three Years');
/****************************************************************/
/* Define chart margins, framing box and text attributes */
/****************************************************************/
CALL CHHMAR(0,5);
CALL CHCOL(6,COLORS);
CALL CHSET('CBOX');
CALL CHBATT(1,B_ATTRS);
CALL CHLATT(4,L_ATTRS); /* Attributes for pie title text */
CALL CHKATT(2,K_ATTRS); /* Attributes for pie label text */
/****************************************************************/
/* Define pie chart options */
/****************************************************************/
CALL CHSET('ABPIE'); /* Data is absolute, not percentage*/
CALL CHSET('PROPIE'); /* Total size of each pie varies */
CALL CHSET('XVERTICAL'); /* Pies on top of one another */
CALL CHPEXP(6,EXPLIST); /* Exploded sector(s) */
CALL CHPCTL(3,THREE_D_LIST); /* 3-d control parameters */
CALL CHSET('VALUES'); /* Values on spider tags */
CALL CHSET('SPIDER'); /* Labels on spider tags */
CALL CHXLAB(3,4,'199019911992'); /* Pie chart titles */
CALL CHKEY(6,8,'S-East S-West London MidlandsNorth Scotland');
/****************************************************************/
/* Declare chart data */
/****************************************************************/
DCL Y_DATA(18) FLOAT DEC(6) INIT(5, 5, 5, 11, 4, 2, /*1st pie*/
9, 6, 8, 12, 7, 5, /*2nd pie*/
13, 8, 14, 17, 12, 8); /*3rd pie*/
/****************************************************************/
/* Plotting call */
/****************************************************************/
CALL CHPIE(3,6,Y_DATA); /* Plot the pie chart */
/***************************************************************/
/* Add chart notes */
/****************************************************************/
CALL CHNATT(4,N_ATTRS); /* Note attributes: yellow,mode-3*/
CALL CHNOFF(67,24.5); /* Set note position */
CALL CHNOTE('C7',15,' Gross;Turnover');
CALL CHSET('NBOX'); /* Subsequent notes to be boxed */
CALL CHNOFF(68,22); /* Set note position */
CALL CHNOTE('C7',6,'$35.2M');
CALL CHNOFF(68,13); /* Set note position */
CALL CHNOTE('C7',6,'$47.3M');
CALL CHNOFF(68,4); /* Set note position */
CALL CHNOTE('C7',6,'$72.9M');
/****************************************************************/
/* Send chart to terminal */
/****************************************************************/
CALL CHTERM; /* Terminate PGF */
CALL ASREAD(TYPE,MODE,COUNT); /* Send chart to terminal */
CALL FSTERM; /* Terminate GDDM */
%INCLUDE(ADMUPINA); /* Include GDDM and PGF entries */
%INCLUDE(ADMUPINC);
%INCLUDE(ADMUPINF);
%INCLUDE(ADMUPING);
END PIE;
Note: The program is intended to execute on a 3279 display unit, of which
the bottom right-hand cell is used as an attribute byte, and is therefore
not available for graphics. If the graphics field were allowed to default
to the complete screen, the bottom right-hand corner of the chart framing
box would be missing. To prevent this, the graphics field has been set to
omit the right-hand column of the screen.
|