Solved! Go to Solution.
symbols.text = new esri.symbol.TextSymbol("Text", font, new dojo.Color([128, 0, 0, 1])).setAngle(0).setOffset(0, 0);
Is it possible to call a textsymbol or "label" displaying atop this PictureMarkerSymbol? We would like to show the ID number (from a feature class) of each barrier in the routing result.
If I understand correctly, you want to put some text above a picture marker symbol? You can use a TextSymbol to do this.
Also, you marked your post as an answer. I'm not sure why you're even allowed to do that (forum software, not your fault) but can you see if you can undo that?
var overviewMapDijit = new esri.dijit.OverviewMap({ map: map, visible: true }); overviewMapDijit.startup(); routeTask = new esri.tasks.RouteTask(naURL); //setup the route parameters routeParams = new esri.tasks.RouteParameters(); routeParams.stops = new esri.tasks.FeatureSet(); routeParams.outSpatialReference = { "wkid": mapWKID }; dojo.connect(routeTask, "onSolveComplete", showRoute); dojo.connect(routeTask, "onError", errorHandler); startSymbol = new esri.symbol.PictureMarkerSymbol('images/marker_start.png', 20, 34) startSymbol.setOffset(0, 14); stopSymbol = new esri.symbol.PictureMarkerSymbol('images/marker_stop.png', 20, 34) stopSymbol.setOffset(0, 14); barrierSymbol = new esri.symbol.PictureMarkerSymbol('images/barrier.png', 30, 46) barrierSymbol.setOffset(0, 0); highlightSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 46, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color("#FF00FFFF"), 2), new dojo.Color([0, 255, 0, 0])) routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color([0, 0, 255, 0.5])).setWidth(5);
symbols.text = new esri.symbol.TextSymbol("Text", font, new dojo.Color([128, 0, 0, 1])).setAngle(0).setOffset(0, 0);
You would add a new symbol along with the other symbols you're adding. My point graphic performance demo has some code to create text symbols. Specifically:symbols.text = new esri.symbol.TextSymbol("Text", font, new dojo.Color([128, 0, 0, 1])).setAngle(0).setOffset(0, 0);
The first parameter to the TextSymbol constructor is a string specifying the text to be displayed.
Adding it seems to break the initialization of my dropdowns, but this is probably due to my inexperience with the JS api.
Thanks again!
Greg