BookmarkSubscribeRSS Feed
mrom34
Calcite | Level 5

Hi,

I am trying to generate some barchat using GTL but I have a problem with the bar width and I am not sure to understand why.

When I add the barlabel=true option, the bar are very narrowed. but if I remove this option it looks much better. Do you kwnow why this label option modify the bar widht?

Here is the code I use:

proc template;

  define statgraph testgraph;

  begingraph;

  layout gridded / border=false;

    layout datalattice columnvar=path  / headerlabeldisplay=value HEADERLABELATTRS=(SIZE=6px) cellwidthmin=20

             columnheaders=bottom border=false columndatarange=union

            columnaxisopts=(TICKVALUEATTRS=(SIZE=6pt) display=(line TICKS tickvalues))

            rowaxisopts=(offsetmin=0

             label='% Subjects' griddisplay=on);

      layout prototype  / walldisplay=(fill) WALLCOLOR=white;;

        barchart x=quarter y=colj / skin=modern barlabel=true BARLABELATTRS=(SIZE=6pt);

                              

      endlayout;

    endlayout;

  endlayout;

  endgraph;

end;

run;

ods graphics on / reset=all height=800px width=1000px   antialias=on;  

proc sgrender data=test template=testgraph;

run;

ods graphics off

Plot without barlabel option:

SGRender.png

Plot with barlabel option:

SGRender.png

1 REPLY 1
DanH_sas
SAS Super FREQ

The axis offsets within each cell is being adjusted to accommodate for the added text width, creating less room for the bars. You can override this adjustment by explicitly setting the OFFSETMIN and OFFSETMAX to a small value in the COLUMNAXISOPTS.

Hope this helps,

Dan

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
  • 1 reply
  • 1937 views
  • 0 likes
  • 2 in conversation