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


Bar charts

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



In a bar chart, all the bars have equal width. They can be drawn on either a logical x axis or a numeric one.

The calls and options that affect bar charts are listed below. The default options are shown first:


     CHBAR or CHBARX           Plots the bar chart
     CHSET
      'ABSOLUTE'|'RELATIVE'    Absolute or relative data
      'CVALUES'|'NOVALUES'     Format/position of values ...
      'VSCIENTI'|'VFIXED'      ... format (scientific or fixed-point)
      'VINSIDE'|'VONTOP'       ... position (inside/on top of bars)
      'FILL'|'INFILL'|'NOFILL' Shading method
      'MBAR'|'CBAR'|'FBAR'     Multiple, composite(stacked), or floating
      'NNOTES'|'INOTES'        Notes to be repositioned or clipped
      'YVERTICAL'|'XVERTICAL'  Vertical or horizontal bars
     CHPAT                     Specify shading-pattern table values
     CHCOL                     Specify basic color table for shading
     CHVCHR                    Number of characters in values on bars
     CHVATT                    Attributes of values on bars
     CHVDIG                    Decimal digits after decimal point
     CHLC                      Specify line-color table
     CHLT                      Specify line-type table
     CHLW                      Specify line-width table
     CHGAP                     Distance between bars
     CHGGAP                    Distance between groups of bars

With a logical x axis, each bar represents a logical x entity, usually indicated by a label. The bars are always spaced out evenly along the x axis. So, the x data of this type of bar chart is not a set of numbers, it is a set of labels. Nevertheless, these labels are specified in the normal way (using CHXLAB, CHXDAY, or CHXMTH).

The logical x axis has a nominal numeric scale: 1 for the first bar, 2 for the second, and so on, and a range of 0.5 to N + 0.5 (where N is the number of bars). Tick marks (and therefore labels) appear under each bar or group of bars; any CHXTIC specification is ignored.

This is a typical specification for a bar chart with a logical x axis:


     DCL X_LABS CHAR(32) INIT('ITALY FRANCE SPAIN GREECE SWEDEN');
     DCL Y_DATA(15) FLOAT DEC(6) INIT(
                      27, 32, 36, 47, 52,  /* Data for 1st component */
                      12, 18, 27, 23, 31,  /* Data for 2nd component */
                      31, 23, 18, 29, 45); /* Data for 3rd component */

CALL CHXLAB(5,6,X_LABS); /* Specify x-axis data labels */ CALL CHBAR(3,5,Y_DATA); /* Plot chart, 3 components of 5 bars */

A numeric x axis differs from a logical one in that you supply a set of x values at which the bars are to be drawn. The call that plots this type of chart is exactly similar to the CHPLOT call that plots line graphs:


     DCL X_DATA(5)  FLOAT DEC(6) INIT
                  (8.1, 3.0, 3.9, 4.8, 6.5);  /* x values            */
     DCL Y_DATA(15) FLOAT DEC(6) INIT
                 ( 27,  32,  36,  47,  52, /*Y data for 1st component*/
                   12,  18,  27,  23,  31, /*Y data for 2nd component*/
                   31,  23,  18,  29,  45);/*Y data for 3rd component*/

CALL CHBARX(3,5,X_DATA,Y_DATA); /* Plot chart, 3 */ /* Components of 5 bars */

Both of these examples specify bar charts with three components, each component having five data values. There are three different ways of displaying multicomponent bar charts:

  • Multiple bar charts have their components placed side by side in a group. So, in these examples there would be a cluster of three bars at each major tick mark (in the CHBAR case) or each x value (in the CHBARX case).
    
    
  • Composite bar charts have their components stacked one above the other. So, there would be a stack of three bars at each major x-axis tick mark or x value.
    
    
  • Floating-bar charts are identical to composite bar charts except that the first component is not displayed. In this case there would be a stack of two bars floating somewhere above each major x-axis tick mark or x value.
    
    

These three types of bar chart are shown on logical x axes in Figure 20 in topic 5.4.3.

An example of a bar chart on a numeric x axis is shown in Figure 21 in topic 5.4.3. It was drawn by the program that drew the line graph in Figure 4 in topic 3.2, amended by replacing the CHPLOT call with a CHBARX. Notice that PG routines extend the x axis beyond the highest x value, to accommodate the width of the last pair of bars.

Subtopics:

Go to the previous page Go to the next page



Copyright IBM Corporation 1990, 2012