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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1869 views
  • 0 likes
  • 2 in conversation