DATA Step Graphics Interface Dictionary |
Operating States: | GKOP, SGOP, WSAC, WSOP |
Return Codes: | 0, 8, 74 |
Default Values: | upx=0, upy=1 |
Syntax | |
Description | |
Argument Definitions | |
See Also |
Syntax |
return-code-variable=GSET('TEXUP',upx, upy);
Description |
The GSET('TEXUP', . . . ) function sets the angle of the text string. DSGI uses the values of character up vectors to determine the angle of a text string. The character up vector has two components, upx and upy, that describe the angle at which the text string is placed. The angle is calculated with the following formula:
angle=atan(upx/upy)
Effectively, when DSGI is calculating the angle for the text, it uses upx and upy as forces that are pushing the string toward an angle. The natural angle of text in the upx direction is toward the 6 o'clock position. In the upy direction, text naturally angles at the 3 o'clock position. If upx is greater than upy, the text is angled toward 6 o'clock. If upy is greater than upx, the text is angled toward 3 o'clock. Natural Angle of Text shows the angle of text when the values for upx and upy are (0.0, 1.0) and (1.0, 0.0).
As you change the values of upx and upy, the coordinate that has the highest value is taken as the angle, and the lowest value as the offset. Varying the Angle of Text shows the angle of text when the character up vector values (+1.0, +0.5) are used.
You can use the following macro to convert angles measured in degrees to character up vectors:
%macro angle(x); if mod(&x, 180)=90 then do; if mod(&x,270) = 0 then xup = 1.0; else xup = -1.0; rc = gset("texup", xup, 0.0); end; else do; b = mod(&x, 360); /* adjust y vector for 2nd and 3rd quadrants */ if b > 90 and b lt 270 then yup = -1.0; else yup = 1.0; a=&x*1.7453292519943300e-002; xup = tan(-a); /* adjust x vector for 3rd quadrant */ if b > 180 and b le 270 then xup = -xup; rc = gset("texup", xup, yup); end; %mend angle; data _null_; rc = ginit(); rc = graph("clear", "angle"); rc = gset("texalign", "left", "base"); rc = gset("texheight", 5); rc = gset("texfont", "swissl"); %angle(180); rc = gdraw("text", 50, 50, "180"); %angle(80); rc = gdraw("text", 50, 50, "80"); %angle(600); rc = gdraw("text", 50, 50, "600"); rc = graph("update"); rc = gterm(); run;
Argument Definitions |
upx |
numeric constant or numeric variable name; if upy is 0, upx cannot be 0. |
upy |
numeric constant or numeric variable name; if upx is 0, upy cannot be 0. |
See Also |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.