Select to view content in your preferred language

Showing Multiple Labels

1907
1
Jump to solution
02-29-2016 10:16 PM
cadgism
Occasional Contributor

How can I place multiple labels in a parcel feature layer.  My following function adds single attribute field as label  as charm. Dont know how to add multiple attributes as labels.  Appricate any help.

=========================================

function showLables(color, fsize, lblLayerID, LayerName, LabelField) {

    color = new esri.Color(color);

    var labelField  = LabelField;

    statesLabel = new esri.symbol.TextSymbol().setColor(color);

    statesLabel.font.setSize(fsize);

    statesLabel.font.setFamily("arial");

    var renderer = new esri.renderer.SimpleRenderer(statesLabel);

    var labels = new esri.layers.LabelLayer({ id: lblLayerID });

    labels.addFeatureLayer(LayerName, renderer, "{" + labelField  + "}");

    app.map.addLayer(labels);

}

Thank you

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

If I understand your question then you just need to concatenate all the attributes you want to show into the same string:

labels.addFeatureLayer(LayerName, renderer, "{" + labelField + "}" + ", " + "{"  + labelField2 + "}");

View solution in original post

1 Reply
by Anonymous User
Not applicable

If I understand your question then you just need to concatenate all the attributes you want to show into the same string:

labels.addFeatureLayer(LayerName, renderer, "{" + labelField + "}" + ", " + "{"  + labelField2 + "}");