I am trying to use PROC GSLIDE to create a GSEG entry for a SGPLOT so that I can use PROC GREPLAY to combine multiple charts into one HTML output. The SGPLOT is created and works just fine, but when I run the GSLIDE step, it seems to skew the aspect ratio of the SGPLOT to a point where it's not readable. I have also tried using the iBack method with the same result. It appears the GSLIDE resizes the SGPLOT somehow, but I don't understand how to control that option. Any help is appreaciated.
ods graphics on / reset=index imagename="Myplot"; ods HTML file="TestChart.html" path="&odsout."; goptions hsize=4in vsize=2in; goptions xpixels=900 ypixels=900; goptions device=png; proc sgplot data = Trend_Final; series x = trend y = cRound / datalabel = trend legendlabel = "Work" lineattrs = (thickness = 2 pattern = solid color = BLACK); yaxis label = "Scheduled" grid values = (200 to 400 by 50) offsetmin = 0.05 offsetmax = 0.05; xaxis label = " Date" grid offsetmin = 0.05 offsetmax = 0.05; run; ODS HTML CLOSE; ODS LISTING; data CreatedAnno; xsys='3'; ysys='3'; hsys='3'; when='a'; function='image'; x=100; y=100; imgpath="&odsout.Myplot1.png"; style='fit'; output; run; title; footnote; proc gslide name="TVol" anno= CreatedAnno; run;
Sounds like the size of the sgplot image you're annotating into the gslide isn't matching up, and is getting stretched out of proportion.
You'll either need to make the gslide the same size as the sgplot, or make the sgplot the same size as the gslide.
I think you can control the size of the sgplot using something like ...
ods graphics on / imagefmt=staticmap imagename="somename" height=4in width=4in;
Thank you for the reply Dr. Allison, that is exactly what I was thinking as well, but I don't see an option to control the size of the GSLIDE output. I set the size of the .PNG file output in the ODS HTML statement and the output appears just fine (i.e. not distorted) but the GSLIDE statement produces the distorted output. Is there a default size for the GSLIDE output? The X/Y statement in the annotate statement don't seem to have any effect on the distortion, just the size ratio of the chart.
Since the output is going to HTML I would recommend looking into ODS tagsets.htmlpanel. That allows for describing the area of the document that your graphs or tables are going to display and keeps aspect ratios and text in a more useable appearance than the GSEG approach.
I've tried moving my code to use tagsets.htmlpanel, but I can't get that tagset to compile any charts.
I started with the example here:http://support.sas.com/kb/38/066.html, but even running just the code provided, I consistently get an "ERROR: No body file. TAGSETS.HTMLPANEL output will not be created." message.
I am on a linux grid environment, but I can still run ODS HTML statements, provided I include a file= and path= statement.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.