I have a linegraph where the labels for each line is long. If the legend contains a lot of explanation text for the lines, the text overlaps. If I change the x- and ypixels, the graph gets bigger and the text in the legend get supersmall.
Is there a way to tell graph that the graph itself should be x*y pixels big and the rest should be left to the legend? So the text won´t be resized.
What proc are you using? (proc gplot?)
What output device are you using? (device=gif? java? activex? other?)
Are you specifying any "goptions htext" size? or gunit=pct, etc?
And are you doing anything "tricky" such as using "proc greplay"?
The sizing of the legends, and other text can depend on several things.
Hmm ... the dev=javaimg is a likely candidate ... it might only have "partial support" of the SAS/Graph options that control the legend size.
If you want the most complete control of everything in the graph (such as the legend text size), I'd recommend using device=png (or device=gif). Also, I'd recommend specifying a specific point-size for the text, such as ...
Or, if you want the legend to be a specific size, different from the rest of the text, you can control that via a legend statement, something like ...
Here is an example that illustrates my problem:
If I change the array to 10 items, it looks ok. But with 18 the text get too small.
If I change the ypixels to 1000 the graph gets bigger but not the legend.
start = compress(start);
end = compress(end);
label = strip(label);
proc format cntlin = b;
data test(keep = sex2 value height);
length sex2 $160;
array kon (18) $ ('A','B','C','D','E','F','G','H','I','J','K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R');
do i = 1 to dim(kon);
sex2 = propcase(put(kon(i),$ATCFMT.));
value = ranuni(0);
Also, if you want to specifically want to control the size of the plot (such that it stays a fixed size, rather than increasing when you increase the ypixels), you can do that with a legend statement, such as...
I don't think that annotating the legend text manually with dev=javaimg would be possible.
The main problem I foresee is that in order for annotate to have blank space under the graph to annotate the text onto, you'd want to use a blank "footnote" to add space under the graph ... but since device=javaimg does not support gtitles (ie, titles in the graph area, like dev=png/gif does) you can't use a blank footnote to add this white-space.
footnote1 height=3in " ";
Another problem you'd be likely to run into is that dev=javaimg probably doesn't support all the annotate stuff you might want to use. I haven't tried annotate with the java/javaimg lately, but last time I tried there were enough things not supported, that I couldn't do what I wanted with it.
java/javaimg is good for making a quick/pretty *simple* graph, but when you want to do a complex graph, or have the maximum control overy your graph's appearance, I strongly recommend using the old/traditional devices such as dev=png or dev=gif, etc.