我正在尝试使用图形模板语言让标记显示在我的图表上。我尝试将标记定义添加到样式中,添加到markerattrs=
选项语句中的 seriesplot 语句中,并且还对图表组使用离散属性映射。我似乎无法使这些方法中的任何一种起作用。
风格定义:
proc template;
define style excel;
parent=styles.htmlblue;
class graph / attrpriority='none';
style graphdata1 / contrastColor=#416FA6;
style graphdata2 / contrastColor=#A8423F;
style graphdata3 / contrastColor=#86A44A;
style graphdata4 / contrastColor=#8064A2;
style graphdata5 / contrastColor=#DA8137;
style graphdata6 / contrastColor=#D7E4BD;
style graphdata7 / contrastColor=#FCD5B5;
style graphdata8 / contrastColor=#8EA5CB;
style graphdata9 / contrastColor=#E6B9B8;
style graphdata10 / contrastColor=#CCC1DA;
end;
run;
图表模板:
proc template;
define statgraph excel_series_trended;
dynamic _date _class _metric _title;
begingraph;
entrytitle halign=center _title;
discreteattrmap name="symbols" / ignorecase=true ;
value "IBM" / markerattrs=(color=blue symbol=diamondfilled) ;
value other / markerattrs=(color=red symbol=circlefilled) ;
enddiscreteattrmap ;
discreteattrvar attrvar=groupmarkers var=stock attrmap="symbols" ;
layout lattice / rowdatarange=data columndatarange=data rowgutter=0 columngutter=0;
layout overlay / walldisplay=(fill)
yaxisopts=( griddisplay=on gridattrs=(pattern=2 color=Cx999999) linearopts=(viewmin=0) )
xaxisopts=( type=discrete );
seriesplot x=_date y=_metric / group=_class markercolorgroup=_class name='series' groupdisplay=overlay connectorder=xaxis lineattrs=(pattern=solid thickness=3);
endlayout;
sidebar / align=bottom spacefill=false;
discretelegend 'series' / opaque=true border=false halign=center valign=center displayclipped=true order=rowmajor;
endsidebar;
endlayout;
endgraph;
end;
run;
使用数据集渲染图表sashelp.stocks
:
ods html style=excel;
ods graphics / antialias=on antialiasmax=999999;
proc sgrender data=sashelp.stocks template=excel_series_trended;
where date between '01jan2005'd and '01jun2005'd;
dynamic _date="date" _metric="high" _class="stock";
run;