%let name=beltplot; filename odsout '.'; /* Proof-of-concept to map point-defects and area-defects on an industrial belt. For point-defects, just specify len_start & wid_start and use 'missing' (.) value for len_end & wid_end. */ %let max_width=90; %let max_len=1800; data beltdata; input len_start wid_start len_end wid_end; datalines; 33 47 . . 32 76 . . 8 26 . . 10 52 . . 105 15 . . 96 48 . . 90 47 . . 88 46 . . 125 47 . . 127 46 . . 126 48 . . 122 46 . . 112 48 . . 158 47 . . 173 46 . . 251 46 . . 155 17 . . 255 19 . . 255 21 . . 357 46 . . 555 62 . . 252 12 . . 302 17 . . 412 18 . . 516 19 . . 145 72 155 66 401 46 450 48 500 44 520 49 130 44 155 52 253 0 287 3 ; run; data beltanno; set beltdata; length function $8 color style $12 html $500; xsys='2'; ysys='2'; hsys='3'; when='a'; /* area-defect */ if (len_end ne .) and (wid_end ne .) then do; color='blue'; function='move'; x=len_start; y=wid_start; output; function='bar'; line=0; style='m5x45'; x=len_end; y=wid_end; html= 'title='||quote( 'Start corner ('||trim(left(len_start))||','||trim(left(wid_start))||')'||'0D'x|| 'End corner ('||trim(left(len_end))||','||trim(left(wid_end))||')')|| ' href="beltplot_info.htm"'; output; end; /* point-defect */ else do; color='cxff0000'; function='pie'; x=len_start; y=wid_start; rotate=360; style='psolid'; size=.6; html= 'title='||quote('Coordinate ('||trim(left(len_start))||','||trim(left(wid_start))||')')|| ' href="beltplot_info.htm"'; output; end; run; goptions device=png; goptions noborder; goptions xpixels=2000 ypixels=500; /* This makes the gif image long & narrow, like a real belt */ ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Custom Belt Defect Plot") style=htmlblue; goptions ftitle="albany amt/bold" ftext="albany amt" htitle=18pt htext=10pt; /* Standard belt sizes are 72in x 600ft, and 84in x 1800ft. Sizes range from 49in x 300ft to 84in x 1800ft. */ axis1 order=(0 to 72 by 12) minor=none offset=(0,0) label=(angle=90 'Width (inches)'); axis2 order=(0 to 600 by 50) minor=none offset=(0,0) label=(j=l 'Length (ft)'); /* Make the normal gplot markers 'invisible', because we're wanting to look at the annotated ones instead. */ symbol v=none i=none h=.0001; title1 j=l move=(+3,+0) ls=1.0 "Conveyor Belt Defect Visualization"; title2 j=l move=(+3,+0) ls=1.1 f=marker c=cxff0000 'W' c=black f="albany amt" ' Point Defect ' f=markere c=blue 'U' c=black f="albany amt" ' Area Defect'; footnote j=l box=1 bcolor=grayee 'Core End' j=r box=1 bcolor=grayee 'Belt End'; proc gplot data=beltdata anno=beltanno; plot wid_start*len_start=1 / cframe=tan vaxis=axis1 haxis=axis2 autohref chref=gray88 autovref cvref=gray88 des='' name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;