Hi Charles,Using the 'update-end' event for the CSVLayer class, I was able to obtain the feature's attributes, and then use this as a TextSymbol. Here is the code I used:var map, csv;
require([
"esri/map",
"esri/layers/CSVLayer",
"esri/Color",
"esri/graphic",
"esri/layers/GraphicsLayer",
"esri/symbols/SimpleMarkerSymbol",
"esri/renderers/SimpleRenderer",
"esri/InfoTemplate",
"esri/urlUtils",
"esri/symbols/Font",
"esri/symbols/TextSymbol",
"dojo/on",
"dojo/_base/array",
"dojo/domReady!"
], function(
Map, CSVLayer, Color,
Graphic, GraphicsLayer,
SimpleMarkerSymbol, SimpleRenderer,
InfoTemplate, urlUtils, Font, TextSymbol,
on, array
) {
urlUtils.addProxyRule({
proxyUrl: "http://server1/proxy/proxy.ashx",
urlPrefix: "skinner-lap"
});
map = new Map("map", {
basemap: "gray",
center: [ -60, -10 ],
zoom: 4
});
csv = new CSVLayer("http://server1/UserData/2.5_week.csv", {
copyright: "USGS.gov"
});
csv.on("update-end", function(results){
var textLayer = new GraphicsLayer();
array.forEach(results.target.graphics, function(feature, index){
var geom = feature.geometry;
var displayText = feature.attributes.id;
var font = new Font(
"12pt",
Font.STYLE_NORMAL,
Font.VARIANT_NORMAL,
Font.WEIGHT_BOLD,
"Helvetica"
);
var textSymbol = new TextSymbol(
displayText,
font,
new Color("#DC143C")
);
textLayer.add(new Graphic(geom, textSymbol));
});
map.addLayer(textLayer);
});
var blank = new Color([0, 0, 0, 0]); // hex is #ff4500
var marker = new SimpleMarkerSymbol("solid", 0, null, blank);
var renderer = new SimpleRenderer(marker);
csv.setRenderer(renderer);
map.addLayer(csv);
});