I am using ESRI Javascript 3.7 framework to develop a map application, in it I am trying to display labels created using LabelLayer at certain scales only, say from 1:1 to 1:500 scale only.
How can I achieve this?
I played a little with ScaleDependentRenderer but it results in 2 firebug exceptions. Not sure if the ScaleDependentRenderer is the right answer or not.
var occupancyLabelLayer = new esri.layers.LabelLayer({ id: "labels" });
// add the label layer to the map
map.addLayer(occupancyLabelLayer);
var labelField = "FLOOR";
// create a text symbol to define the style of labels
var spaceLabelColor = new dojo.Color("red");
var spaceOccupancyLabel = new esri.symbol.TextSymbol().setColor(spaceLabelColor);
//spaceOccupancyLabel.font.setSize("14pt");
spaceOccupancyLabel.font.setFamily("arial");
var spaceOccupancyLabelRenderer = new esri.renderer.SimpleRenderer(spaceOccupancyLabel);
var spaceLabelScaleDependentRenderer = new ScaleDependentRenderer({
rendererInfos: [{
renderer: spaceOccupancyLabelRenderer,
minScale: 500,
maxScale: 1
}]
});
occupancyLabelLayer.addFeatureLayer(featureLayer, spaceLabelScaleDependentRenderer, "${" + labelField + "}");
Firebug Exceptions:
1)exception in animation handler for: onEnd
http://js.arcgis.com/3.7/ (line 45)
2)TypeError: b is undefined
http://js.arcgis.com/3.7/js/esri/layers/LabelLayer.js Line 21