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

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

Description

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/symbol/Symbol
|_esri/symbol/FillSymbol
  |_esri/symbol/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

NameTypeSummary
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:
require([
  "esri/symbols/SimpleFillSymbol", ... 
], function(SimpleFillSymbol, ... ) {
  var sfs = new SimpleFillSymbol();
  ...
});

new SimpleFillSymbol(style,outline,color)

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

new SimpleFillSymbol(json)

Creates a new SimpleFillSymbol object using a JSON object.
Arguments:
<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. The default value is STYLE_SOLID. 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 value: Symbol
Arguments:
<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 value: FillSymbol
Arguments:
<SimpleLineSymbol> outline Required Symbol used for outline.
Sample:
require([
  "esri/symbols/SimpleLineSymbol", "esri/Color", ... 
], function(SimpleLineSymbol, Color, ... ) {
  selSymbol.setOutline(new SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 2));   
  ...
});

setStyle(style)

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

toJson()

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