Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:39:48+00:00 2026-06-11T00:39:48+00:00

I’m trying to get the chart’s gridlines to be transparent but it doesn’t seem

  • 0

I’m trying to get the chart’s gridlines to be transparent but it doesn’t seem to be supported:

http://support.sas.com/documentation/cdl/en/grstatug/63302/HTML/default/viewer.htm#n1f71f6e9v037an1jy274v66z4r1.htm

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:39:49+00:00Added an answer on June 11, 2026 at 12:39 am

    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:

    • http://www2.sas.com/proceedings/sugi29/091-29.pdf
    • Algorithm for Additive Color Mixing for RGB Values

    Some utility macros are needed to do this, here they are:

    **
    ** MACRO TO CONVERT RGB->HEX
    *;
    %macro rgb_to_hex(iR=,iG=,iB=);
      %local r g b hex;
    
      %let r=%sysfunc(round(&iR,1));
      %let g=%sysfunc(round(&iG,1));
      %let b=%sysfunc(round(&iB,1)); 
    
      %let hex = CX%sysfunc(putn(&r,hex2.))%sysfunc(putn(&g,hex2.))%sysfunc(putn(&b,hex2.));
      &hex
    %mend;
    
    
    **
    ** MACRO TO CONVERT HEX->RGB.  RESULTS ARE SAVED TO THE SPECIFIED MACRO VARIABLES
    *;
    %macro hex_to_rgb(iHex=, iRedMacroVar=rr, iGreenMacroVar=gg, iBlueMacroVar=bb);
    
      %global &iRedMacroVar &iGreenMacroVar &iBlueMacroVar;
      %local r g b;
    
      %let r=%substr(&iHex,3,2);
      %let g=%substr(&iHex,5,2);
      %let b=%substr(&iHex,7,2);
    
      %let &iRedMacroVar   = %sysfunc(putn(%sysfunc(inputn(&r,hex2.)),z3.));
      %let &iGreenMacroVar = %sysfunc(putn(%sysfunc(inputn(&g,hex2.)),z3.));
      %let &iBlueMacroVar  = %sysfunc(putn(%sysfunc(inputn(&b,hex2.)),z3.));
    
    %mend;
    
    
    **
    ** MACRO TO BLEND COLORS TOGETHER.
    *;
    %macro blend_colors(iHexColor1=, iHexColor2=, iBlendType=average);
      %local blended;
    
      %hex_to_rgb(iHex=&iHexColor1, iRedMacroVar=r1, iGreenMacroVar=g1, iBlueMacroVar=b1)
      %hex_to_rgb(iHex=&iHexColor2, iRedMacroVar=r2, iGreenMacroVar=g2, iBlueMacroVar=b2)
    
    
    
      %if "%upcase(&iBlendType)" eq "AVERAGE" %then %do;
        %let blended = %rgb_to_hex(iR=%qsysfunc(round((&r1 + &r2) / 2,1)),
                                   iG=%qsysfunc(round((&g1 + &g2) / 2,1)),
                                   iB=%qsysfunc(round((&b1 + &b2) / 2,1)));
      %end;
      %else %if "%upcase(&iBlendType)" eq "ADDITIVE" %then %do;
        %let blended = %rgb_to_hex(iR=%sysfunc(min(&r1 + &r2, 255)),
                                   iG=%sysfunc(min(&g1 + &g2, 255)),
                                   iB=%sysfunc(min(&b1 + &b2, 255)));
      %end;
      %else %do;
        %put %str(E)RROR: (MACRO.BLEND_COLORS.SAS): INCORRECT PARAMETER PASSED IN FOR IBLENDTYPE.;
      %end;
      &blended
    %mend;
    

    And here’s the code:

    **
    ** PARAMETERS - SPECIFY A BACKGROUND COLOR AND THE AMOUNT OF GREY TO BLEND AGAINST IT
    *;
    
    * EXAMPLE1;
    %let bg_color   = CX000000; *BLACK;
    %let grid_color = CX202020; *JUST A LITTLE GREY NEEDED;
    
    * EXAMPLE2;
    /*%let bg_color   = CX0FF000; *GREEN;*/
    /*%let grid_color = CX080808; * VERY LITTLE GREY NEEDED;*/
    
    /** EXAMPLE3;*/
    /*%let bg_color   = CXFF0000; *RED;*/
    /*%let grid_color = CX363636; *STRONGER GREY NEEDED;*/
    
    
    **
    ** YOU COULD ALSO SPECIFY COLORS USING RGB IF YOU PREFER. 
    ** USING THE BELOW COMMENTED OUT SYNTAX
    *;
    /*%let bg_color   = %rgb_to_hex(iR=0  ,iG=0  ,iB=0  );*/
    /*%let grid_color = %rgb_to_hex(iR=20 ,iG=20 ,iB=20);*/
    
    
    
    
    **
    ** BLEND THE COLORS TOGETHER
    *;
    %let blended = %blend_colors(iHexColor1=&bg_color, iHexColor2=&grid_color, iBlendType=additive);
    
    
    
    
    **
    ** 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=&blended; * USE THE BLENDED COLOR AS THE GRID COLOR;
      end;
    run;
    
    
    **
    ** LAYOUT TEMPLATE FOR A SIMPLE SERIES CHART
    *;
    proc template;
     define statgraph mychart;
      begingraph; 
        layout overlay / wallcolor=&bg_color
                         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;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.