Search code examples
sassas-gtl

Why is textattributes(textattrs) not working in my SAS barchart with segments?


In the graph the numbers in the segments is just shown in black.

proc template;
  define statgraph barchart;
    begingraph ;
      discreteattrmap name="farger";
       value "Asia"   / fillattrs=(color=darkgreen) textattrs=(color=white);
       value "USA" / fillattrs=(color=white) textattrs=(color=green);
       value "Europe" / fillattrs=(color=red) textattrs=(color=blue);
     enddiscreteattrmap;
     discreteattrvar attrvar=origin var=origin attrmap="farger";

     entrytitle "Freq of Total Models by Type and Origin";

     layout overlay;
        barchart x=type / name="carmodels"
          stat=freq display=all
          group=origin
          barlabel=true
          groupdisplay=Stack 
          segmentlabel=true; 
        discretelegend "carmodels";
      endlayout;
    endgraph;
  end;
run;
%stpbegin;
proc sgrender data=SASHELP.cars template=barchart;
run;

Show example graph:

In the graph the segments the numbers should have been in the color set in the textattrs in my discreteattrmap but is just shown in black.


Solution

  • According to the documentation for DISCRETEATTRMAP, the TEXTATTRS option would be ignored in a BARCHART statement.

    TEXTATTRS=style-element | style-element (text-options)| (text-options)

    specifies the text attributes to use when an attribute map is applied to text in a graph.

    Default: The GraphDataText style element.

    Restriction: This option is honored only by the TEXTGROUP= option in the AXISTABLE statement and the GROUP= option in the TEXTPLOT statement.