<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to label the count at each stack of a stacked bar chart? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/how-to-label-the-count-at-each-stack-of-a-stacked-bar-chart/m-p/648113#M19902</link>
    <description>&lt;P&gt;Normally, you could use the SEGEMENTLABELTYPE to turn on the bar segment labels, but this will show the response values, which are the values in your "percent" variable. To show your "count" variable in the same location, your best option is to overlay a TEXTPLOT on the BARCHARTPARM to put the count values in the segments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do this, you will need to write a little data step to calculate the y positions for each value in a separate column that you will use for the Y column on the TEXTPLOT statement. The data step should accumulate the y positions for group value in a category, so be sure your data is sorted correctly before feed it into this data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
    <pubDate>Fri, 15 May 2020 17:40:43 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2020-05-15T17:40:43Z</dc:date>
    <item>
      <title>how to label the count at each stack of a stacked bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-to-label-the-count-at-each-stack-of-a-stacked-bar-chart/m-p/648101#M19900</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Im using the below code to create a stacked bar chart. I'm using axistable to present the n (count) for each stack , since&amp;nbsp; there a is big list of the groups ( stack) , the plot is looking compressed and not at all readable , that is, the axistable occupies most of the graphic area. What is the best way to present the count of each stack and how to do that?Any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc template;&lt;/P&gt;&lt;P&gt;define statgraph bar100;&lt;BR /&gt;&lt;BR /&gt;begingraph;&lt;BR /&gt;layout overlay;&lt;BR /&gt;BARCHARTPARM X = avis y=percent / group=avalx name="lgnd1";&lt;BR /&gt;&lt;BR /&gt;discretelegend "lgnd1" /halign=right across=1 sortorder=DESCENDINGFORMATTED;&lt;BR /&gt;innermargin / align=bottom opaque=true separator=True;&lt;BR /&gt;axistable x=avis value=count/ display=(label) classdisplay=stack class=avalc classorder=descending/*colorgroup=trt01p*/ position=0 pad=10 /*headerlabel='Number of subjects'*/;&lt;BR /&gt;endinnermargin;&lt;BR /&gt;&lt;BR /&gt;endlayout;&lt;BR /&gt;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;proc sgrender data=g100 template=bar100;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Manj_0-1589562174690.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39479i73C332D9F9F2B8BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Manj_0-1589562174690.png" alt="Manj_0-1589562174690.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 17:03:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-to-label-the-count-at-each-stack-of-a-stacked-bar-chart/m-p/648101#M19900</guid>
      <dc:creator>Manj</dc:creator>
      <dc:date>2020-05-15T17:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to label the count at each stack of a stacked bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-to-label-the-count-at-each-stack-of-a-stacked-bar-chart/m-p/648113#M19902</link>
      <description>&lt;P&gt;Normally, you could use the SEGEMENTLABELTYPE to turn on the bar segment labels, but this will show the response values, which are the values in your "percent" variable. To show your "count" variable in the same location, your best option is to overlay a TEXTPLOT on the BARCHARTPARM to put the count values in the segments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do this, you will need to write a little data step to calculate the y positions for each value in a separate column that you will use for the Y column on the TEXTPLOT statement. The data step should accumulate the y positions for group value in a category, so be sure your data is sorted correctly before feed it into this data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 17:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-to-label-the-count-at-each-stack-of-a-stacked-bar-chart/m-p/648113#M19902</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-05-15T17:40:43Z</dc:date>
    </item>
  </channel>
</rss>

