boundaryLayer2 = new esri.layers.FeatureLayer(featureCollection, { id: "thematicGraphics", mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, name: "Starts By Dwelling Type", description: "Starts By Dwelling Type" });
var layerDefinition = { name: "Starts By Dwelling Type", geometryType: "esriGeometryPolygon", fields: [{ name: "OBJECTID", type: "esriFieldTypeOID", alias: "OBJECTID" }, { name: uidField, type: "esriFieldTypeString", alias: uidField, length: 255 }, { name: "value", type: "esriFieldTypeDouble", alias: "Starts" }] };
Solved! Go to Solution.
Would you mind sending me the JSON you pass to the server? I'll figure out why the layer name isn't being passed along as you expect.
{ "mapOptions": { "extent": { "xmin": -8580100.447969673, "ymin": 5542939.755732017, "xmax": -8277409.213130328, "ymax": 5726388.988967983, "spatialReference": { "wkid": 54004 } }, "spatialReference": { "wkid": 54004 } }, "operationalLayers": [{ "id": "Basemap", "url": "http://localhost:6080/arcgis/rest/services/CanadaMercator2010/MapServer", "title": "Basemap", "opacity": 1 }, { "id": "thematicGraphics", "opacity": 0.75, "featureCollection": { "layers": [{ "layerDefinition": { "name": "polygonLayer", "geometryType": "esriGeometryPolygon", "drawingInfo": { "renderer": { "type": "classBreaks", "field": "value", "minValue": 0, "classBreakInfos": [{ "classMaxValue": 0, "label": "0", "description": "", "symbol": { "color": [222, 222, 222, 255], "outline": { "color": [0, 0, 0, 255], "width": 0.375, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } }, { "classMaxValue": 1, "label": "1", "description": "", "symbol": { "color": [69, 117, 181, 255], "outline": { "color": [0, 0, 0, 255], "width": 0.375, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } }, { "classMaxValue": 11, "label": "1-11", "description": "", "symbol": { "color": [162, 180, 189, 255], "outline": { "color": [0, 0, 0, 255], "width": 0.375, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } }, { "classMaxValue": 52, "label": "11-52", "description": "", "symbol": { "color": [255, 255, 191, 255], "outline": { "color": [0, 0, 0, 255], "width": 0.375, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } }, { "classMaxValue": 60, "label": "52-60", "description": "", "symbol": { "color": [245, 152, 105, 255], "outline": { "color": [0, 0, 0, 255], "width": 0.375, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } }, { "classMaxValue": 94, "label": "60-94", "description": "", "symbol": { "color": [214, 47, 39, 255], "outline": { "color": [0, 0, 0, 255], "width": 0.375, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } }] } }, "fields": [{ "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" }, { "name": "neighbourhood_geographic_layer_id", "type": "esriFieldTypeString", "alias": "neighbourhood_geographic_layer_id", "length": 255 }, { "name": "value", "type": "esriFieldTypeDouble", "alias": "Starts" }] }, "featureSet": { "geometryType": "esriGeometryPolygon", "features": [] } }] } }], "exportOptions": { "outputSize": [null, null], "dpi": 96 }, "layoutOptions": { "copyrightText": "2012", "scaleBarOptions": { "metricUnit": "Meters", "metricLabel": "m", "nonMetricUnit": "Feet", "nonMetricLabel": "ft" }, "legendOptions": { "operationalLayers": [{ "id": "thematicGraphics" }] } } }
I did a bit more hunting, and discovered that this is a known bug. The bug number is NIM085927. We expect to fix it in time for the next release (3.3).