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

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

Description

(Added at v1.0)
Line symbols are used to draw linear features on the graphics layer. SimpleLineSymbol is either a solid line or a predefined pattern of dashes and dots.

Samples

Search for samples that use this class.

Class hierarchy

esri/symbols/Symbol
|_esri/symbols/LineSymbol
  |_esri/symbols/SimpleLineSymbol

Subclasses

Constructors

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

Constants

NameDescription
STYLE_DASHThe line is made of dashes.
STYLE_DASHDOTThe line is made of a dash-dot pattern.
STYLE_DASHDOTDOTThe line is made of a dash-dot-dot pattern.
STYLE_DOTThe line is made of dots.
STYLE_LONGDASHLine is constructed of a series of dashes.
STYLE_LONGDASHDOTLine is constructed of a series of short dashes.
STYLE_NULLThe line has no symbol.
STYLE_SHORTDASHLine is constructed of a series of short dashes.
STYLE_SHORTDASHDOTLine is constructed of a dash followed by a dot.
STYLE_SHORTDASHDOTDOTLine is constructed of a series of a dash and two dots.
STYLE_SHORTDOTLine is constructed of a series of short dots.
STYLE_SOLIDThe line is solid.

Properties

NameTypeSummary
colorColorSymbol color.
styleStringThe line style.
typeStringThe type of symbol.
widthNumberWidth of line symbol in pixels.

Methods

NameReturn typeSummary
setColor(color)SymbolSets the symbol color.
setStyle(style)SimpleLineSymbolSets the line symbol style.
setWidth(width)LineSymbolSets the LineSymbol width.
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Constructor Details

new SimpleLineSymbol()

Creates a new empty SimpleLineSymbol object.
Sample:

var sls = new esri.symbol.SimpleLineSymbol();

new SimpleLineSymbol(style, color, width)

Creates a new SimpleLineSymbol object with parameters.
Parameters:
<String> style Required See Constants table for values.
<Color> color Required Symbol color.
<Number> width Required Width of the line in pixels.
Sample:
var sls = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,
  new esri.Color([255,0,0]), 3);

new SimpleLineSymbol(json)

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

JSON object representing the SimpleLineSymbol. 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.

<String> style

The line style. See the Constants table for valid values.
Default value: STYLE_SOLID

<String> type

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

<Number> width

Width of line symbol in pixels.
Default value: 1
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]));

setStyle(style)

Sets the line symbol style.
Return type: SimpleLineSymbol
Parameters:
<String> style Required Line style. See the Constants table for valid values.

setWidth(width)

Sets the LineSymbol width.
Return type: LineSymbol
Parameters:
<Number> width Required Width of line symbol in pixels.
Sample:

var outline = new esri.symbol.SimpleLineSymbol().setWidth(1);

toJson()

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