_chartenv Structures

A structure of type _chartenv defines the chart environment. The following listing shows that a _chartenv type structure consists almost entirely of structures of the four types described above.

The PGCHART.H file defines the _chartenv structure type as the following:

typedef struct

{

short charttype; /* Chart type */

short chartstyle; /* Chart style */

_windowtype chartwindow; /* Window definition for

overall chart */

_windowtype datawindow; /* Window definition for data

part of chart */

_titletype maintitle; /* Main chart title */

_titletype subtitle; /* Chart subtitle */

_axistype xaxis; /* Definition for x axis */

_axistype yaxis; /* Definition for y axis */

_legendtype legend; /* Definition for legend */

} _chartenv;

Summary: Initialize the chart environment with the _pg_defaultchart function.

The data in a _chartenv type structure is initialized by calling the function _pg_defaultchart. If your program does not call _pg_defaultchart, it must explicitly define every variable in the chart environment—a tedious procedure. The recommended method for adjusting the appearance of your chart is to initialize variables for the proper chart type by calling the _pg_defaultchart function, and then to reassign selected environment variables such as titles.

The following list describes _chartenv member variables:

chartstyle

An integer that determines the style of the chart (see Table 10.2). Legal values for chartstyle are _PG_PERCENT and _PG_NOPERCENT for pie charts; _PG_PLAINBARS and _PG_STACKEDBARS for bar and column charts; and _PG_POINTONLY and _PG_POINTANDLINE for line graphs and scatter diagrams. This variable corresponds to the third argument for the _pg_defaultchart function.

charttype

An integer that determines the type of chart displayed. The value of charttype is _PG_BARCHART, _PG_COLUMNCHART, _PG_LINECHART, _PG_SCATTERCHART, or _PG_PIECHART. This variable corresponds to the second argument for the _pg_defaultchart function.

chartwindow

A _windowtype structure that defines the appearance of the chart window.

datawindow

A _windowtype structure that defines the appearance of the data window.

legend

A _legendtype structure that defines the appearance of the legend window.

maintitle

A _titletype structure that defines the appearance of the main title of the chart.

subtitle

A _titletype structure that defines the appearance of the chart's subtitle.

xaxis

An _axistype structure that defines the appearance of the x axis. (This variable is not applicable for pie charts.)

yaxis

An _axistype structure that defines the appearance of the y axis. (This variable is not applicable for pie charts.)