Date: Fri, 7 Mar 2008 10:30:07 -0500
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: "html" annotate variable with function="label"
Content-Type: text/plain; charset="iso-8859-15"
RolandRB wrote:
> I can get the "html" variable to work with the "label" function but I
> am right-aligning the text and the hotspot does not lie over the text
> but rather to the left of it. How do I get round this so that the
> hotspot lies over the text?
Roland:
From what I can tell you found a bug in the ODS HTML destination or
annotation engine.
Experiments in 9.1.3 show that when the annotate POSITION variable is set
for right alignment (<), the engine generates an imagemap with an AREA tag
that has incorrect coordinates. Specifically, the direction of the x-travel
in the area box is opposite the direction of the x-travel of the text.
In other words, the box of the imagemap area coordinates is mirrored about
the left edge of the text.
The coordinates can be fixed using post processing. Ugly, but necessary in
situations like these.
At the end of the example a new browser is opened showing the corrected
page. If you tab around, you will eventually see the the 'active border'
around the text instead of off to the left of it.
------------------------------------------------
ods _all_ close;
%let work = %sysfunc(pathname(WORK));
ods html
file="&work.\report.html"
gpath="&work." (url='')
style=meadow
;
goptions reset=all device=gif ftext='Arial' htext=14pt ;
symbol1 v=circle h=12pt;
axis1 minor=none;
%annomac;
data anno;
%dclanno;
xsys=1;
ysys=1;
HTML = 'href="http://support.sas.com"';
%label (90,90,"Some text that is right-anchored",black,0,0,2,'Comic Sans
MS',<);
run;
proc gplot data=sashelp.class anno=anno;
plot weight*age=sex/haxis=axis1;
run;
quit;
ods html close;
data _null_;
infile "&work.\report.html" lrecl=1000;
file "&work.\report-fixed.html";
input;
if index (_infile_, 'href="http://support.sas.com"') then do;
* need to tweak
* <area shape="RECT" href="---the link destination---" coords="---the ods
html generated coordinates---"> ;
*;
rx = prxparse ('/coords="(.*)"/');
pos = prxmatch (rx, _infile_);
if pos then do;
* unmirror the area;
coords = prxposn(rx,1,_infile_);
x1 = input(scan(coords,1,','),best12.);
y1 = input(scan(coords,2,','),best12.);
x2 = input(scan(coords,3,','),best12.);
y2 = input(scan(coords,4,','),best12.);
dx = x2 - x1;
x1 = x2;
x2 + dx;
_infile_ = tranwrd (_infile_, trim(coords), catx(',',x1,y1,x2,y2));
end;
call prxfree (rx);
end;
put _infile_;
run;
options noxwait xmin noxsync;
%sysexec start "Viewer" "&work.\report-fixed.html";
------------------------------------------------
Richard A. DeVenezia
http://www.devenezia.com