Data visualization with SAS programming

Using the entire region for a drawspace in ODS GTL

Accepted Solution Solved
Reply
Regular Contributor
Posts: 179
Accepted Solution

Using the entire region for a drawspace in ODS GTL

Good morning,

 

Am tying to get a handle on how to move a rectangle around in an ODS region using GTL.  I defined a region 5" wide and 1.75" high and want to draw the rectangle in the middle next to the left side.  

 

The code I have so far is:

 

%let path=c:\temp\;
ods pdf file="&path.test.pdf";
ods layout absolute x=0 y=0 height=8.48in;
ods region y=1.1in x=.5in width=5in height=1.75in style={background=cyan};
proc template;
define statgraph vennleft;
begingraph / drawspace = layoutpercent ;
entrytitle '';
layout region / opaque=false;
drawrectangle x = 0 y = 25 width = 28 height = 23 / display = (outline) anchor = BottomLeft;
endlayout;
endgraph;
end;
run;

proc sgrender data = SasHelp.Cars template = vennleft;
run; quit;
ods layout end;
ods pdf close;

 

What I get is a square in the middle third of the rectangle and the drawrectangle output appears in that per the attached image.  How do I tell it to use the entire region?

 

Thanks much!

 

--Ben


Capture.PNG

Accepted Solutions
Solution
‎01-12-2017 12:52 PM
SAS Super FREQ
Posts: 1,134

Re: Using the entire region for a drawspace in ODS GTL

I believe you are getting what you are coding.  ODS LAYOUT and REGION are totally independent of the GTL LAYOUT REGION.  Everything the SGRENDER produces goes into the ODS REGION you have defined.  GTL only knows of the graph canvas which is the white area in the middle.  Everything you specify inside the GTL code can only render inside the graph canvas, which is then placed inside the ODS Region you have defined.

View solution in original post


All Replies
Super User
Posts: 11,101

Re: Using the entire region for a drawspace in ODS GTL

drawrectangle x = 0 y = 25 width = 28 height = 23

 

Sure looks like you want to draw something almost square: width=28 and height=23 means that the x and y dimensions are almost the same=> squarish. The image you show has the "square" actuall just a tad wider than the height. Maybe you mean width=58??

 

 

Regular Contributor
Posts: 179

Re: Using the entire region for a drawspace in ODS GTL

This was just a test, but changing width to 58 makes the rectangle a bit wider; the x/y origin of it still remains in the center of the layout region.  I'd like to figure out how to position it's starting point to the left side of the region shown in cyan.

 

Thanks!

 

--Ben

Solution
‎01-12-2017 12:52 PM
SAS Super FREQ
Posts: 1,134

Re: Using the entire region for a drawspace in ODS GTL

I believe you are getting what you are coding.  ODS LAYOUT and REGION are totally independent of the GTL LAYOUT REGION.  Everything the SGRENDER produces goes into the ODS REGION you have defined.  GTL only knows of the graph canvas which is the white area in the middle.  Everything you specify inside the GTL code can only render inside the graph canvas, which is then placed inside the ODS Region you have defined.

Regular Contributor
Posts: 179

Re: Using the entire region for a drawspace in ODS GTL

Just found out what it was; a previous proc in the job had specified a width and height on an ods graphics statement.  Adding:

 

ods graphics on / width=5in height=1.75in; 

 

did the trick.  

 

Thanks!

 

--Ben

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 176 views
  • 2 likes
  • 3 in conversation