Using the MIDPOINT variable
is similar to using the X and Y variables to position graphics elements
in a vertical or horizontal bar chart when using data system coordinates.
For example, suppose you produce a vertical bar chart in which the
chart variable CITY produces a bar for each city in a data set. The
height of each bar is determined by the value of the SUMVAR= variable,
UNITS.
You can label these
bars by assigning the chart variable CITY to the Annotate MIDPOINT
variable. The MIDPOINT variable provides the
x coordinate for the label. By default, Annotate assigns the statistic
variable, in this case the SUMVAR= variable, UNITS, to the Annotate
Y variable, which provides the
y coordinate for the label.
The labels in this figure
are positioned by the values that are assigned to these Annotate variables:
-
MIDPOINT=CITY (where CITY is the
chart variable); the MIDPOINT variable provides the horizontal coordinate
in the vertical bar chart.
-
Y=UNITS (where UNITS is the SUMVAR=
variable); the Y variable provides the vertical coordinate. By specifying
Y=units/2, you can vertically center the label in the bar.
Note: In a horizontal bar chart,
the MIDPOINT variable controls the
y coordinate and the statistic variable controls the
x coordinate.
CAUTION:
Be careful
when using MIDPOINT and X and Y variables in the same data set.
Using the MIDPOINT
and X variables in an Annotate data set that is used to annotate a
VBAR chart or the MIDPOINT and Y variables in the same data set used
to annotate an HBAR chart can cause unexpected results.
When annotating a VBAR
chart, the Annotate facility uses the MIDPOINT variable as the horizontal
coordinate if it exists in the Annotate data set and ignores the X
variable. Consequently, you should use the MIDPOINT variable as the
horizontal coordinate for all observations in an Annotate data set
if you use it for one. A similar behavior occurs if you use both the
MIDPOINT and Y variables in an Annotate data set that is used to annotate
HBAR charts. The MIDPOINT variable is always used, regardless of whether
it has a missing value, and the Annotate facility ignores the Y variable.
In this case, as well, use the MIDPOINT variable for the vertical
coordinate for all observations in an Annotate data set if you use
it for one.