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

Dear all,

I have a subgrouped vbar proc gchart with a legend:

legend1 label=none value=(font="wingdings" h=1.3 'LL' 'L' 'K' 'J' 'JJ');

which results into:

smiley.gif

Now I'd like to and some "normal" Text behind each smiley like

:-(( very unhappy

😞 unhappy

😐 indifferent

🙂 happy

:-)) very happy

I'd have to change fonts then in the legend statement. But when I do this e.g. the string "very unhappy" is treated as the value for the next shape:

legend1 label=none value=(font="wingdings" 'LL' font="arial" "very unhappy"  ....... )

Does anybody know how I can combine the smileys and the text?

Best regards

Eva

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

Hmm...  Upon further experimentation, I need to correct my previous reply...

It *is* possible to change the font (between wingdings and normal text) in the middle of legend text values!  I just now tried it, and it works.  (Note this works in device=png, but does not seem to be supported with device=activex -- I mention this because you mentioned in other threads that you were using activex).

Here's a short (nonsense) example just to demonstrate:

goptions htext=4pct;

legend1 position=(top left inside) mode=share across=1 label=none

value=(

   t=1 f="wingdings" '4a'x f="albany amt" ' Happy'

   t=2 f="wingdings" '4c'x f="albany amt" ' Unhappy'

   );

proc gplot data=sashelp.class;

plot height*weight=sex / legend=legend1;

run;

smiley.png

View solution in original post

8 REPLIES 8
ballardw
Super User

Have you tried additional parantheses to keep one "value" together. Untested:

value = (  (font="wingdings" h=1.3 'LL' font="arial" 'very unhappy')

               (font="wingdings" 'L'  font="arial" 'unhappy')

/* continue the pattern*/

           );

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Hello ballardw,

the additional brackets don't work 😞

The smilies are left out and the text is printed only.

Hello Mohammad,

thanx for the white papers. They are very useful for legends. A solution for the mentioned problem though is not in them.

Hello Anca,

maybe something like that. The tooltip when you move your mouse over the bars shows the text as well. I guess the users have to live with that.

MohammadFayaz
Calcite | Level 5

These articles may be useful:

AncaTilea
Pyrite | Level 9

I believe that instead if using the legend, you may want to use a footnote statement that will allow you to change fonts.

I don't think I was able to find the answer when I had similar problem.

:smileyconfused: Confused.

GraphGuy
Meteorite | Level 14

Using an official gplot legend, I don't know of a way to switch the font 1/2-way through the text.

One work-around is to either show the plain text in the legend, and annotate the wingding faces beside them ... or show the wingding faces in the legend and annotate the text.  Using this technique, you'll have to determine the x/y for the annotated stuff by trial-and-error, and then hard-code the values - and if any later changes cause the legend to move, then you'll have to manually update the annotate x/y positions (you can usually avoid that problem by annotating using the data's coordinate system, but since this is positioning based on the legend rather than the data, we can't do that).

Anca's suggestion to use the footnote (or a title2) would also be a decent work-around, assuming you're ok with a legend at the bottom (or top, using title2) of the page, arranged horizontally.

Eva
Quartz | Level 8 Eva
Quartz | Level 8

I talked with my customer and we'll probably have some info box. As we have a complete web application which contains the SAS graphs we have enough room on the left to have an <i> Button. The customers says that in the long run the emoticons are better than text and new users have to click on that info buttons then. I think that's a good solution. Emoticons speak a language of their own.

And as you said - positioning the legend is difficult because the user can switch beetween parameters and then the legend's position on the web page might be somewhere else or the size of the graph.

GraphGuy
Meteorite | Level 14

Hmm...  Upon further experimentation, I need to correct my previous reply...

It *is* possible to change the font (between wingdings and normal text) in the middle of legend text values!  I just now tried it, and it works.  (Note this works in device=png, but does not seem to be supported with device=activex -- I mention this because you mentioned in other threads that you were using activex).

Here's a short (nonsense) example just to demonstrate:

goptions htext=4pct;

legend1 position=(top left inside) mode=share across=1 label=none

value=(

   t=1 f="wingdings" '4a'x f="albany amt" ' Happy'

   t=2 f="wingdings" '4c'x f="albany amt" ' Unhappy'

   );

proc gplot data=sashelp.class;

plot height*weight=sex / legend=legend1;

run;

smiley.png

Eva
Quartz | Level 8 Eva
Quartz | Level 8

Yes, I want to switch to png anyway because there are now several features which I need and activex does not support. I still have that insufficient authorization problem but there's a collegue who solved this problem before on our platform. So I hope I can do that too.

I didn't know that legend values support tick marks 🙂
Thanx for your example!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 1719 views
  • 6 likes
  • 5 in conversation