Hide Table of Contents
esri/plugins
esri/process
esri/toolbars
esri/workers
Class: SimpleFillSymbol
[ AMD Module Require | Legacy Module Require ]

require(["esri/symbols/SimpleFillSymbol"], function(SimpleFillSymbol) { /* code goes here */ });

Description

(Added at v1.0)
Fill symbols are used to draw polygon features on the graphics layer. SimpleFillSymbol can be solid, transparent, or one of several cross hatch patterns. In addition, the symbol can have an optional outline, which is defined by a line symbol.

Known limitation: When using FireFox 2.x, only STYLE_SOLID and STYLE_NULL are valid. It works in all modern browsers.

Samples

Search for samples that use this class.

Class hierarchy

esri/symbols/Symbol
|_esri/symbols/FillSymbol
  |_esri/symbols/SimpleFillSymbol

Constructors

NameSummary
new SimpleFillSymbol()Creates a new empty SimpleFillSymbol object.
new SimpleFillSymbol(style, outline, color)Creates a new SimpleFillSymbol object with parameters.
new SimpleFillSymbol(json)Creates a new SimpleFillSymbol object using a JSON object.

Constants

NameDescription
STYLE_BACKWARD_DIAGONALThe fill is backward diagonal lines.
STYLE_CROSSThe fill is a cross.
STYLE_DIAGONAL_CROSSThe fill is a diagonal cross.
STYLE_FORWARD_DIAGONALThe fill is forward diagonal lines.
STYLE_HORIZONTALThe fill is horizontal lines.
STYLE_NULLThe polygon has no fill.
STYLE_SOLIDThe fill is solid.
STYLE_VERTICALThe fill is vertical lines.

Properties

NameTypeSummary
colorColorSymbol color.
outlineSimpleLineSymbolOutline of the polygon.
styleStringThe fill style.
typeStringThe type of symbol.

Methods

NameReturn typeSummary
setColor(color)SymbolSets the symbol color.
setOutline(outline)FillSymbolSets the outline of the fill symbol.
setStyle(style)SimpleFillSymbolSets the fill symbol style.
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Constructor Details

new SimpleFillSymbol()

Creates a new empty SimpleFillSymbol object.
Sample:

var sfs = new esri.symbol.SimpleFillSymbol();

new SimpleFillSymbol(style, outline, color)

Creates a new SimpleFillSymbol object with parameters.
Parameters:
<String> style Required See Constants table for values.
<SimpleLineSymbol> outline Required See SimpleLineSymbol.
<Color> color Required Symbol color.
Sample:
var sfs = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
  new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT,
  new esri.Color([255,0,0]), 2),new esri.Color([255,255,0,0.25]));

new SimpleFillSymbol(json)

Creates a new SimpleFillSymbol object using a JSON object.
Parameters:
<Object> json Required

JSON object representing the SimpleFillSymbol. View the REST API Reference for Symbol Objects for details on creating a JSON symbol. Note that when specifying symbol width and height using JSON the values should be entered in points, the JavaScript API then converts the point values to pixels.

Property Details

<Color> color

Symbol color.
Outline of the polygon.

<String> style

The fill style. See the Constants table for valid values. Color is valid only with STYLE_SOLID.
Default value: STYLE_SOLID

<String> type

The type of symbol.
Known values: simplemarkersymbol | picturemarkersymbol | simplelinesymbol | cartographiclinesymbol | simplefillsymbol | picturefillsymbol | textsymbol
Method Details

setColor(color)

Sets the symbol color.
Return type: Symbol
Parameters:
<Color> color Required Symbol color.
Sample:

symbol.setColor(new esri.Color([255,255,0,0.5]));

setOutline(outline)

Sets the outline of the fill symbol.
Return type: FillSymbol
Parameters:
<SimpleLineSymbol> outline Required Symbol used for outline.
Sample:

selSymbol.setOutline(new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new esri.Color([255,0,0]), 2));   

setStyle(style)

Sets the fill symbol style.
Return type: SimpleFillSymbol
Parameters:
<String> style Required Fill style. See the Constants table for valid values.

toJson()

Converts object to its ArcGIS Server JSON representation.
Return type: Object