AnsweredAssumed Answered

how to label layers using LayerDrawingOptions

Question asked by svikram86 on Sep 16, 2014
Latest reply on Sep 29, 2014 by gettingready

Hello All,

 

I am trying to display the labels in the client side using LayerDrawingOptions . My actual requirement is to turn on/off labels in a layer . I believe it is only possible using Label class and LayerDrawingoptions . Below is my code but the label doesn't display. .

 

When I check the property . labelPlacement is always null . Can anybody tell me what am I missing . Thanks

 

LabelId.jpg

 

var textSymbol = new esri.symbol.TextSymbol({

                font: new esri.symbol.Font("18", esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_BOLD, "Helvetica"),

                color: new esri.Color("#666633")

            });

 

 

            var labelClass = new esri.layers.LabelClass({

                labelExpression: "[SeriesID]",

                labelPlacement: "above-along",

                symbol:textSymbol

            });

 

 

            var layerDrawingOption = new esri.layers.LayerDrawingOptions({

                labelingInfo: [labelClass],

                showLabels: true,

transparency:50

            });

 

    dynamicLayer.setLayerDrawingOptions(layerDrawingOptions, true);

Outcomes