BookmarkSubscribeRSS Feed
0 Likes

It would be highly appreciated if an option is given in the bar graph to resize the Y-axis labels area so that labels are never hidden and replaced by "...". So far it seems that the space allocated for labels and the space allocated for bars is automatically defined by SAS and it happens that labels are hidden when too long (in these cases we would like just to reduce the space for the bars). We provide an example in the picture on how we would like it work. We didn't find any option to avoid this behaviour without having to just reduce the size of the labels. We would like to have this on SAS Viya 4.0. Thank you.

 

f_lanzellotto_0-1727802026565.png

 

3 Comments
ballardw
Super User

First show example code, or describe exactly how your graph is made.

 

Second: "are never hidden and replaced by "..." may be a pretty ambitious goal considering that a single character value can be up to 32K (over 32 thousand) characters long. On paper, letter size paper and a 12 character per inch font, that translates to nearly 10 pages of text. So "never" is not a realistic request.

Ksharp
Super User

You could use options splitchar= and fitpolicy= to split this long label into TWO or more rows.

 

data have;
input y :$40. x;
cards;
xxxxxxxxxxxx/yyyyyyyyyyy  12
aaaaaa/bbbbbb  10
;
proc sgplot data=have;
hbarparm response=x category=y;
yaxis splitchar='/' fitpolicy=splitalways;
run;

Ksharp_0-1727833565122.png

 

f_lanzellotto
Calcite | Level 5

Hello, I will provide a bit more context:

1. I'm doing this in an online report in SAS Visual Analytics. I don't have code to share for this because I'm just using the standard bar graph provided by the tool, setting horizontal bars.

2. I'm not expecting to have the text "never hidden" but the issue is this: for our application it would be acceptable to have "small bars" (even just covering only 10% of the whole object area in extreme cases) but giving always priority to show full text of labels when possibile. So far the bar graph object is automatically resizing the space for labels and for bars, but in doing this the bars area is never getting smaller than something like 60-70% of whole object area. As a result I get big bars with hidden labels. What I would like to get instead is small bars and full labels in case labels are long.

 

An option in doing this would be allowing the user to set "minimum bar area" in % of bar graph object size (or even fixed size). Probably something like that already exist but embedded in the code of the object. It would be sufficient to make it a parameter that could be edited by the user, as it happens for many others. Would it be possibile to include this in a future release? Or am I missing the proper way of doing this (we already checked with SAS staff and no solution was provided).

 

Thank you.