BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rexMundi
Fluorite | Level 6

I'm trying to offset a legend in my GCHART but I can't seem to get it to work!

I have set the position, then offset, using cm, in, pct, and combinations of these

I cannot seem to get the Legend to move from its position

%_eg_conditional_dropds(WORK.SORTTempTableSorted);

GOPTIONS ACCESSIBLE border hsize = 28.3cm vsize = 8cm FTEXT=Calibri CBACK=GRAYE6;
/* -------------------------------------------------------------------
   Sort data set SASApp-CLK:WORK.ONHAND_COUNT
   ------------------------------------------------------------------- */
/*find max days old*/
PROC SQL;
	CREATE VIEW WORK.MaxDaysOld AS
		SELECT MAX(T.DAYS_OLD) AS maxdays
	FROM WORK.ONHAND_COUNT as T
;
DATA _null_;
	SET WORK.MaxDaysOld;
	CALL symput("maxdays", maxdays);
	run;

PROC SQL;
	CREATE VIEW WORK.SORTTempTableSorted AS
		SELECT T.DAYS_OLD, T.STATUS, T.COUNT
	FROM WORK.ONHAND_COUNT as T
;
QUIT;
Legend99
	ACROSS=1
	POSITION = (TOP RIGHT INSIDE)
	OFFSET=(-30,-30)
	MODE=SHARE
	CFRAME=BLACK
	
	;
Axis1
	STYLE=1
	WIDTH=1
	MINOR=
	(NUMBER=1
	)
    LABEL=( "On Hand" )
    VALUE=(FONT='Calibri' )
;

Axis2
	STYLE=1
	WIDTH=1
	INTERVAL=EVEN 
	ORDER = (1 TO &maxdays BY 1)
	LABEL=( "Days Old" )
	VALUE=(FONT='Calibri' height=1.1)

;
TITLE;
TITLE1 "Age Range";
FOOTNOTE;
FOOTNOTE1 "Generated by Reporting and Validation Team on &SYSDATE";
PROC GCHART DATA=WORK.SORTTempTableSorted
;
	VBAR 
	 DAYS_OLD
 /
	SUMVAR=COUNT
	SUBGROUP=STATUS
	CLIPREF
	FRAME DISCRETE	
	TYPE=SUM
	
	COUTLINE=BLACK
	RAXIS=AXIS1
	MAXIS=AXIS2
	LEGEND=LEGEND99
	
;
/* -------------------------------------------------------------------
   End of task code
   ------------------------------------------------------------------- */
RUN; QUIT;
%_eg_conditional_dropds(WORK.SORTTempTableSorted);
TITLE; FOOTNOTE;
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

The online help says (about both the OFFSET= and the related ORIGIN= option):

 

Restriction    Not supported by Java and ActiveX

 

So, this might explain the issue if either of these techniques is involved in your case.

View solution in original post

8 REPLIES 8
ballardw
Super User

Could you provide some data in the form of a data step that can duplicate the behavior. It doesn't need to be the full data set just enough records to generate a graph.

 

Also what is your current setting for GUNIT?

 

Do you get any messages in the log?

rexMundi
Fluorite | Level 6

Sorry not sure what you mean re:data step, still an extreme novice with this stuff!

 

I haven't defined GUNIT - I tried various settings with cm, in, pct, and no specification, all with the same (no) result

 

Please see log below

1 The SAS System                                                                                      15:07 Thursday, April 28, 2016

NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
NOTE: Writing TAGSETS.SASREPORT13(EGSRX) Body file: EGSRX
NOTE: SQL view WORK.MAXDAYSOLD has been defined.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      


NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      57:25   
NOTE: There were 18 observations read from the data set WORK.ONHAND_COUNT.
NOTE: There were 1 observations read from the data set WORK.MAXDAYSOLD.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

NOTE: SQL view WORK.SORTTEMPTABLESORTED has been defined.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


WARNING: Font CALIBRI could not be used.
         Font SIMULATE substituted for font CALIBRI.

NOTE: There were 18 observations read from the data set WORK.ONHAND_COUNT.
NOTE: There were 18 observations read from the data set WORK.SORTTEMPTABLESORTED.
NOTE: PROCEDURE GCHART used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

NOTE: View WORK.SORTTEMPTABLESORTED has been dropped.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

FreelanceReinh
Jade | Level 19

Hello @rexMundi,

 

I've run your code with dummy data I created (SAS 9.4). When I modify the values in the OFFSET= option, the legend changes its position as expected, at least with small values around zero. (-30, -30) was not suitable in conjunction with the small VSIZE value (8cm), but this depends on the GUNIT option (good point from @ballardw😞 The legend was outside the visible area. The only issue I'd have with the legend is that the text ("status" and the STATUS values) is invisible because it's black text on a black background (CFRAME=BLACK).

 

Do you see the legend, but it doesn't move when you alter the OFFSET values?

rexMundi
Fluorite | Level 6

Strange!

I have tried multiple x,y values, none below 1, but none were successful in moving the legend

And yes it's all black at the moment - this is not the desired effect, just something i'd declared so as to see clearly the impact of the offset

 

There must be some other setting overriding this one? I tried a different, new project and couldn't get the offset to work either. Something in autoexec? CSS?Capture.PNG

FreelanceReinh
Jade | Level 19

The online help says (about both the OFFSET= and the related ORIGIN= option):

 

Restriction    Not supported by Java and ActiveX

 

So, this might explain the issue if either of these techniques is involved in your case.

rexMundi
Fluorite | Level 6

I had noticed that, but admit to being a bit confused - I'm using SAS EG to export the GCHART, via Report, to PDF - are Java or ActiveX required by this process?

FreelanceReinh
Jade | Level 19

Possibly, but I don't know for sure. I don't use SAS EG. If also the ORIGIN= option (used instead of OFFSET=) had no effect*, I would tend to believe that the restriction mentioned is the reason.

 

* or other options with the same restriction, e.g. ORDER= (this should be fairly easy to check)

rexMundi
Fluorite | Level 6

Presto! Changing the optios/results/graph setting to GIF from ActiveX has resolved the issue.

 

It's presented a few other issues but I should be able to work through those.

 

Thanks guys

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2291 views
  • 3 likes
  • 3 in conversation