require(["esri/symbols/MarkerSymbol"], function(MarkerSymbol) { /* code goes here */ });
Description
Samples
Search for
samples that use this class.
Class hierarchy
esri/symbols/Symbol
|_esri/symbols/MarkerSymbol
Subclasses
Properties
Methods
Property Details
The angle of the marker.
Default value: 0
Size of the marker in pixels.
The type of symbol.
Known values: simplemarkersymbol | picturemarkersymbol | simplelinesymbol | cartographiclinesymbol | simplefillsymbol | picturefillsymbol | textsymbol
The offset on the x-axis in pixels.
Default value: 0
The offset on the y-axis in pixels.
Default value: 0
Method Details
Rotates the symbol clockwise around its center by the specified angle.
Parameters:
<Number > angle |
Required |
The angle value. 0 is pointing right and values progress clockwise. |
Sets the symbol color.
Parameters:
<Color > color |
Required |
Symbol color. |
Sample:
require([
"esri/Color", ...
], function(Color, ... ) {
symbol.setColor(new Color([255,255,0,0.5]));
...
});
Sets the x and y offset of a marker in screen units.
Parameters:
<Number > x |
Required |
The X offset value in pixels. |
<Number > y |
Required |
The Y offset value in pixels. |
Sets the size of a marker in pixels.
Parameters:
<Number > size |
Required |
The width of the symbol in pixels. |
Sample:
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setPath(path);
markerSymbol.setColor(new Color(color));
markerSymbol.setOutline(null);
markerSymbol.setSize("32");
Converts object to its ArcGIS Server JSON representation.
Be aware that the angle in the JSON is different from MarkerSymbol.angle. The angle in the JSON follows the traditional ArcGIS specification and is rotated counter-clockwise, whereas the angle in the symbol is rotated clockwise. For example, if your MarkerSymbol has angle=30 (clockwise), this method will return a JSON object where angle=-30 (counter-clockwise):
{
"color": [255,255,255,64],
"size": 12,
"angle": -30,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCross",
"outline": {"color":[0,0,0,255],"width":1,"type":"esriSLS","style":"esriSLSSolid"}
}