How to add two symbols in a single graphic ?

2346
2
Jump to solution
07-24-2017 09:55 AM
KamalMittal
New Contributor III

I am trying to add a SimpleFillSymbol() and TextSymbol() in a single graphics() after draw polygon on the feature layer. Independently they are working fine but i want to combine these two symbols.

Here is the code : 

// SimpleFillSymbol code

var symbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([r,g,b,0.9]),
4
),new Color([r,g,b,0.5]));

//TextSymbol code

var symbol1 = new esri.symbol.TextSymbol();
symbol1.setText("tsText");
symbol1.setColor(new dojo.Color([0, 255, 0]));

var graphic = new Graphic(evt.geometry, symbol);
map.graphics.add(graphic);

I have attach the HTML file of a sample feature layer.

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Kamal,

   You can not have two symbols for the same graphic. You have to clone the graphic and have two graphics each with their own symbol.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Kamal,

   You can not have two symbols for the same graphic. You have to clone the graphic and have two graphics each with their own symbol.

EvelynHernandez
Occasional Contributor III

If u wanna do something like:

U have to do it through the service in arcmap.

0 Kudos