_axistype Structures

Structures of type _axistype contain variables for the axes such as color, scale, grid style, and tick marks. The PGCHART.H file defines the structure type as the following:

typedef struct

{

short grid; /* TRUE=grid lines drawn;

FALSE=no lines */

short gridstyle; /* Style bytes for grid */

_titletype axistitle; /* Title definition

for axis */

short axiscolor; /* Color for axis */

short labeled; /* TRUE=ticks marks and titles

drawn */

short rangetype; /* _PG_LINEARAXIS,

_PG_LOGAXIS */

float logbase; /* Base used if log axis */

short autoscale; /* TRUE=next 7 values

calculated by system */

float scalemin; /* Minimum value of scale */

float scalemax; /* Maximum value of scale */

float scalefactor; /* Scale factor for data on

this axis */

_titletype scaletitle; /* Title definition for

scaling factor */

float ticinterval; /* Distance between tick marks

(world coord.) */

short ticformat; /* _PG_EXPFORMAT or

_PG_DECFORMAT */

short ticdecimals; /* Number of decimals for tick

labels (max=9) */

} _axistype;

The following list describes _axistype member variables:

autoscale

A Boolean variable. If autoscale is set to TRUE, presentation graphics automatically determines values for scalefactor, scalemax, scalemin, scaletitle, ticdecimals, ticformat, and ticinterval (see below). If autoscale equals FALSE, these seven variables must be specified in your program.

axiscolor

An integer between 1 and _PG_PALETTELEN that specifies the color used for the axis and parallel grid lines. (See description for gridstyle below.) Note that this member does not determine the color of the axis title. That selection is made through the axistitle structure.

axistitle

A _titletype structure that defines the title of the associated axis. The title of the y axis displays vertically to the left of the y axis, and the title of the x axis displays horizontally below the x axis.

grid

A Boolean true/false value that determines whether grid lines are drawn for the associated axis. Grid lines span the data window perpendicular to the axis.

gridstyle

An integer between 1 and _PG_PALETTELEN that specifies the grid's line style. Lines can be solid, dashed, dotted, or some combination. The default value for gridstyle is 1.

Note that the color of the parallel axis determines the color of the grid lines. Thus, the x axis grid is the same color as the y axis, and the y axis grid is the same color as the x axis.

labeled

A Boolean value that determines whether tick marks and labels are drawn on the axis. Axis labels should not be confused with axis titles. Axis labels are numbers or descriptions such as “23.2” or “January” attached to each tick mark.

logbase

If rangetype is logarithmic,, the logbase variable determines the log base used to scale the axis. The default value is 10.

rangetype

An integer that determines whether the scale of the axis is linear or logarithmic. The variable rangetype applies only to value data.

Specify a linear scale with _PG_LINEARAXIS. A linear scale is best when the difference between axis minimum and maximum is relatively small. For example, a linear axis range 0–10 results in 10 tick marks evenly spaced along the axis.

Use _PG_LOGAXIS to specify a logarithmic rangetype. Logarithmic scales are useful when the range is very large or when the data varies exponentially. Line graphs of exponentially varying data can be made straight with a logarithmic rangetype.

scalefactor

All numeric data are scaled by dividing each value by scalefactor. For relatively small values, scalefactor should be 1, which is the default. But data with large values should be scaled by an appropriate factor. For example, data in the range 2 million–20 million should be plotted with scalemin set to 2, scalemax set to 20, and scalefactor set to 1 million.

If autoscale is set to TRUE, presentation graphics automatically determines a suitable value for scalefactor based on the range of data to be plotted. Presentation graphics selects only values that are a factor of 1 thousand—that is, values such as 1 thousand, 1 million, or 1 billion. It then labels the scaletitle appropriately (see the following). If you desire some other value for scaling, you must set autoscale to FALSE and set scalefactor to the desired scaling value.

scalemax

Highest value represented by the axis.

scalemin

Lowest value represented by the axis.

scaletitle

A _titletype structure defining a string of text that describes the value of scalefactor. If autoscale is TRUE, presentation graphics automatically writes a scale description to scaletitle. If autoscale equals FALSE and scalefactor is 1, scaletitle.title should be blank. Otherwise your program should copy an appropriate scale description to scaletitle.title, such as “(´ 1000),” “(in millions of units),” or “times 10 thousand dollars.”

For the y axis, the scaletitle text displays vertically between the axis title and the y axis. For the x axis, the scale title appears below the x axis title.

ticdecimals

Number of digits to display after the decimal point in tick labels. Maximum value is 9. (This variable applies only to axes with value data and is ignored for the category axis.)

ticformat

An integer that determines format of the labels assigned to each tick mark. Set ticformat to _PG_EXPFORMAT for exponential format or to _PG_DECFORMAT for decimal. The default is _PG_DECFORMAT. (This variable applies only to axes with value data and is ignored for the category axis.)

ticinterval

Sets interval between tick marks on the axis. The tick interval is measured in the same units as the numeric data associated with the axis. For example, if 2 sequential tick marks correspond to the values 20 and 25, the tick interval between them is 5. (This variable applies only to axes with value data and is ignored for the category axis.)