GCHART Procedure

About Patterns

Pattern Categories

When a chart needs one or more patterns, the procedure uses either one of the following:
  • default patterns and outlines that are automatically generated by SAS/GRAPH
  • patterns, colors, outlines, and images that are defined by PATTERN statements, graphics options, and procedure options
The following sections summarize pattern behavior for the GCHART procedure. For more information, see the PATTERN Statement.

Default Patterns and Outlines

The GCHART procedure uses default patterns and outlines when you do not do the following:
  • specify any PATTERN statements
  • use the CPATTERN= graphics option
  • use the COLORS= graphics options
  • use the COUTLINE= option in the action statement
The default patterns, colors, and outlines are generated from the current style. If all of the above conditions are true, and the GSTYLE option is in effect, then the GCHART procedure does the following:
  • selects the default fill, which is always solid, and rotates it through the color list of the current style, generating one solid pattern for each color. If the first color in the style's color list is black (or white), the procedure skips that color and begins generating patterns with the next color.
  • uses the style outline color to outline every patterned area.
If all of the above conditions are true, and the NOGSTYLE option is specified, then the GCHART procedure does the following:
  • selects the first default fill, which is always solid, and rotates it through the device's color list, generating one solid pattern for each color. If the first color in the device's color list is black (or white), the procedure skips that color and begins generating patterns with the next color.
  • uses the foreground color to outline every patterned area.
  • if the procedure needs additional patterns, GCHART selects the next default pattern fill that is appropriate to the type of chart. GCHART then rotates the pattern fill through the color on the list, skipping the foreground color as before. The procedure continues in this manner until it has generated enough patterns for the chart.
Changing any of the above conditions changes or overrides the default behavior:
  • If you specify a color list with the COLORS= option in a GOPTIONS statement. If the list contains more than one color, the procedure produces a solid pattern through that list, using every color, even if the foreground color is black (or white). The default outline color remains the style outline color.
  • If you specify either COLORS=(one-color) or the CPATTERN= graphics option, the default fill pattern changes from solid to the list of appropriate hatch patterns. The procedure uses the specified color to generate one pattern definition for each hatch pattern in the list. The default outline color remains the style outline color. (The Java and ActiveX devices do not support hatch patterns.)
For a description of these graphics options, see Graphics Options and Device Parameters Dictionary.

User-Defined Patterns, Outlines, and Images

You can use PATTERN statements to specify patterns, including color or fill type or both. You can also specify images to fill the bars of two-dimensional bar charts. For complete information about all patterns, see the PATTERN Statement. See also the section on controlling patterns and colors for each chart type.
When you use PATTERN statements, the procedure uses the specified patterns until all of the PATTERN definitions that they generate have been used. Then, if more patterns are required, it returns to the default pattern rotation.
To change the outline color of any pattern, whether it is a default or user-defined pattern, use the COUTLINE= option in the action statement that generates the chart.
Two-dimensional bar charts created with the HBAR and VBAR statements can use the PATTERN statement to fill specified bars with specified images. For details, see the option description for IMAGE= fileref | “external-file”. Other means of including images in charts include adding background images to bar charts. The IBACK= option specifies an image file that fills the entire area behind the graph. The IFRAME= option specifies an image file that fills the area within the axes of the graph.
For additional information, including a list of recognized image file types, see Image File Types Supported by SAS/GRAPH.