The presentation graphics functions are designed to be flexible. You can use the system of default values to produce professional-looking charts with a minimum of programming effort. Or you can fine-tune the appearance of your charts by overriding default values and initializing variables explicitly in your program.
The header file PGCHART.H defines a structure type _chartenv, which organizes the chart environment variables. The chart environment describes everything about a chart except the plots themselves. It is the blank page, in other words, ready for plotting data. The environment determines the appearance of text, axes, grid lines, and legends.
Colors and line styles in the chart environment are taken from palettes. In this way, the appearance of titles and axis lines matches the colors and line styles of plotted data series.
Summary: You can reset any variable in the environment.
Calling the _pg_defaultchart function fills the chart environment with default values. Presentation graphics allows you to reset any variable in the environment before displaying a chart. Except for adjusting the palette values, all initialization of data is done through a _chartenv type structure.
The sample chart programs provided in “Writing a Presentation Graphics Program,” illustrate how to adjust variables in the chart environment. These programs create a structure env of type _chartenv. The structure env contains the chart environment variables, initialized by the call to the _pg_defaultchart function. Environment variables such as the chart title are then given specific values, as in
strcpy( env.maintitle.title, “Good Neighbor Grocery” );
Environment variables that determine colors and line styles deserve special mention. The chart environment holds several such variables, which can be recognized by their names. For example, the variable titlecolor specifies the color of title text. Similarly, the variable gridstyle specifies the line style used to draw the chart grid.
These variables are index numbers, but do not refer directly to the color pool or line pool. They correspond instead to palette numbers. If you set titlecolor to 2, presentation graphics uses the color code in the second palette to determine the title's color. Thus, the title in this case would be the same color as the chart's second data series. If you change the color code in the palette, you'll also change the title's color.
A structure of type _chartenv consists of four types of secondary structures. The file PGCHART.H type-defines these secondary structures: _titletype, _axistype, _windowtype, and _legendtype.
The remainder of this section describes the chart environment of presentation graphics. It first examines structures of the four secondary structures that make up the chart environment structure. The section concludes with a description of the _chartenv structure type. Each section begins with a brief explanation of the structure's purpose, followed by a listing of the structure type definition as it appears in the PGCHART.H file. All symbolic constants are defined in the file PGCHART.H.