I’m trying to get the chart’s gridlines to be transparent but it doesn’t seem to be supported:
I’m doing to try and blend the gridlines with the chart background color (which in my code can change between colors) which would make the gridlines subtle rather than jarring when background colors change.
Here is my code:
**
** TAKE THE DEFAULT STYLE BEING USED. MODIFY IT SO THAT
** GRAPH GRIDLINES WILL BE GREEN AND MOSTLY TRANSPARENT
*;
proc template;
define style my_style;
parent = styles.default;
style GraphGridLines from GraphGridLines / contrastcolor=green transparency=.05;
end;
run;
**
** LAYOUT TEMPLATE FOR A SIMPLE SERIES CHART
*;
proc template;
define statgraph mychart;
begingraph;
layout overlay / wallcolor=black
xaxisopts=(display=(line) griddisplay=on)
yaxisopts=(display=(line))
;
seriesplot x=name y=height / lineattrs=(color=white);
endlayout;
endgraph;
end;
run;
**
** PLOT SAMPLE DATA USING CUSTOM STYLE AND CHART LAYOUT WE JUST DEFINED
*;
ods graphics / width=640 height=640 ;
ods html style=my_style;
proc sgrender data=sashelp.class template=mychart;
run;
ods html close;
Is there another way to achieve this effect by blending the green color with the background color?
I figured it out. The below code will blend together a shade of gray with the background color you specify. It then uses the blended color as the color for the gridlines.
I took some tips/code/ideas from these:
Some utility macros are needed to do this, here they are:
And here’s the code: