GDDM-PGF V2R1.3 Application Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF | BOOK


Surface chart example

GDDM-PGF V2R1.3 Application Programming Guide
SC33-0913-01



The next example produces the surface chart shown in Figure 18:


     SURFC: PROC OPTIONS(MAIN);
     DCL H_ATTRS(4) FIXED BIN(31) INIT(2,3,193,240);/*Heading attribs*/
     DCL N_ATTRS(3) FIXED BIN(31) INIT(7,2,194);    /* Note attribs  */
     DCL T_ATTRS(4) FIXED BIN(31) INIT(5,3,0,130);  /* Title attribs */
     DCL (TYPE,MOD,COUNT) FIXED BIN(31,0);    /* ASREAD parameters   */
     CALL FSINIT;                             /* Initialize GDDM     */
     CALL GSLSS(2,'ADMUVCIP',193);            /* Load Complex Italic */
                                              /* Principal font      */
     CALL GSLSS(1,'IBM     ',194);            /* Load company-logo   */
                                              /* Image symbol set    */


     /****************************************************************/
     /*           Define chart margins                               */
     /****************************************************************/
     CALL CHHMAR(5,7);             /* 5 rows (bottom), 7 rows (top)  */
     CALL CHVMAR(8,20);            /* 8 cols (left), 20 col (right)  */


     /****************************************************************/
     /*           Define chart heading                               */
     /****************************************************************/
     CALL CHHATT(4,H_ATTRS);       /* Set heading attributes         */
     CALL CHHEAD(30,'OIL MANUFACTURING;LAST 3 YEARS');/*Chart heading*/


     /****************************************************************/
     /*           Define chart legend                                */
     /****************************************************************/
     CALL CHSET('KBOX');                 /* Legend is boxed          */
     CALL CHKEY(6,13,'Africa       Far East     North America'
                   ||'USSR         Middle East  Europe       ');


     /****************************************************************/
     /*           Define axis options                                */
     /****************************************************************/
     CALL CHXTIC(1.0,3.0);       /* Major ticks every 1 (year) apart */
                                 /* 3 minor ticks per interval to    */
                                 /* mark the quarters of the years   */


     CALL CHXLAB(4,4,'****199019911992');  /* x-axis user labels     */


                                           /*  (See notes 1 and 2)   */
     CALL CHXSET('LABMIDDLE');         /* Labels between major ticks */
     CALL CHXSET('GRID');              /* Grid lines on major ticks  */
     CALL CHXTTL(4,'YEAR');                      /* x-axis title     */
     CALL CHYTTL(24,'Million Barrels per Year'); /* y-axis title     */
     CALL CHTATT(4,T_ATTRS);                     /* Title attributes */


     /****************************************************************/
     /*           Declare chart data                                 */
     /****************************************************************/
     DCL X_DATA(7)  FLOAT DEC(6) INIT(


           1989,1989.5,1990,1990.5,1991,1991.5,1992);


     DCL Y_DATA(42) FLOAT DEC(6) INIT(
            450, 467, 490, 513, 623, 714, 820,    /* 1st y component */
            200, 200, 189, 178, 298, 280, 312,    /* 2nd y component */
            987,1100, 800,1300,1320,1456,1290,    /* 3rd y component */
           1180, 800, 670, 820, 970, 880,1020,    /* 4th y component */
           1400,1450,1500,1780,2000,1800,1820,    /* 5th y component */
            560, 570, 640, 600, 870, 910,1004);   /* 6th y component */
     CALL CHSET('RELATIVE');       /* Stacked-chart type, so data is */
                                   /* plotted relative to the        */
                                   /* previously plotted component   */
     CALL CHXSET('NOFORCEZERO');   /* so x range is 1989-1992        */
                                   /* and not 0-1992                 */


     /****************************************************************/
     /*           Plotting call                                      */
     /****************************************************************/
     CALL CHSURF(6,7,X_DATA,Y_DATA);/* Plot the surface chart, with 6*/
                                    /* components each of 7 elements */


     /****************************************************************/
     /*           Add chart notes                                    */
     /****************************************************************/
     CALL CHNOFF(18.0,0.0);        /* Set note position              */
     CALL CHNOTE('C7',43,'(ALL DATA IN THIS SAMPLE CHART IS SPURIOUS)');
     CALL CHNATT(3,N_ATTRS);       /* Set note attributes: white,    */
                                   /* image symbols, IBM-logo s-set  */
     CALL CHNOFF(65.0,5.0);        /* Set note position              */
     CALL CHNOTE('C7',1,'A');      /* Character code 'A' has the     */
                                   /* IBM logo   (See note 3)        */


     /****************************************************************/
     /*           Send chart to terminal                             */
     /****************************************************************/
     CALL CHTERM;                  /* Terminate PGF, free storage    */
     CALL ASREAD(TYPE,MOD,COUNT);  /* Send chart to terminal         */
     CALL FSTERM;                  /* Terminate GDDM, free storage   */
     %INCLUDE(ADMUPINA);           /* Include GDDM and PGF entries   */
     %INCLUDE(ADMUPINC);
     %INCLUDE(ADMUPINF);
     %INCLUDE(ADMUPING);
     END SURFC;


    ________________________________________________________________________ 
   |                                                                        |
   |                                                                        |
   |                                                                        |
   |                                                                        |
   |                                                                        |
   | PICTURE 16                                                                       |
   |                                                                        |
   |                                                                        |
   |                                                                        |
   |________________________________________________________________________|
   Figure 18. Surface chart


Three points of interest are discussed in the following notes:

   Notes:

1. Commas in numeric labels. If numeric labels are used, they appear as 1,980, 1,981 and 1,982. In other words, the year-numbers are shown in the same notation as any other four-digit number. To circumvent this problem, alphanumeric "user" labels are employed.

Or, instead, CHSET('PGFS') could be used to suppress the commas (see description in "Axis label and tick-mark calls" in topic 4.5).

2. User labels with LABMIDDLE. The LABMIDDLE option shifts all labels half a major-tick position to the left. When the labels are numeric, this gives the desired effect, for example, 1 appears between the major ticks for 0 and 1.

When alphanumeric labels are in use, the label for the first major tick mark is lost. So, if three user labels are required (using LABMIDDLE), four labels must be supplied. The first is not used.

If just three labels were supplied (1990, 1991, 1992), they would appear apparently in the wrong order: 1991 1992 1990. This is because the label list is reused in cyclic fashion.

3. Company logos on charts. Company logos can be added to charts, using the note facility. In GDDM terminology, this is equivalent to a GSCHAR using a special symbol set containing the company logo. In this example, the mode-2 (image) symbol set called "IBM" has just one symbol in it, at character code 'A'.

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012