Plotting Symbols with Labels

511
1
08-21-2013 10:16 AM
FarisJeryes
New Contributor
Hi,

I am trying to plot points into the map and then label them.

I am using the following code for plotting the points:
 
var graphic = new esri.Graphic(new esri.geometry.Point(point), symbol);
app.map.graphics.add(graphic);


The next step would be just to have a small label next to the symbols. No pop-ups, no InfoTemplate, nothing clickable. Just a plain Text Label right next to the symbol.

I would appreciate if you can lead me to the right direction in the documentation.

Thanks
0 Kudos
1 Reply
FarisJeryes
New Contributor
I will go ahead and answer my own question. 🙂

var displayText = "Sample TextLabel";
var font = new esri.symbol.Font("6pt", esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_BOLD, "Helvetica");
var textSymbol = new esri.symbol.TextSymbol(displayText, font, new dojo._base.Color("#000000"));
textSymbol.setOffset(4,8);
var graphic11 = new esri.Graphic(new esri.geometry.Point(point), textSymbol);
app.map.graphics.add(graphic11);
0 Kudos