AnsweredAssumed Answered

Adding Text for multiple Feature Layers using TextSymbol - Can't figure out.

Question asked by thejohnny on Jun 2, 2015
Latest reply on Jun 2, 2015 by thejohnny

Scenario,

 

  I have a map which I'm trying to show Elected officials who reside over certain areas.  I have 5 different groups (Congress, Senate, Commission, Assembly, and Ward).  The first one you select with the checkbox works fine, labels good enough for what I need it to do.  However, when you select the next Elected type it hides the previous one and then symbolizes the featureLayer correctly but just no text when I try to add it to the map.  Any help with getting this working would be greatly appreciated.

 

Here is the function that I call to do this text labeling:

 

function labelElecteds(elc) {

        var electedColor = new Color("#000");

        var electedLabel = new TextSymbol().setColor(electedColor);

        electedLabel.font.setSize("12pt");

        electedLabel.font.setFamily("Calibri");

        var electedLabelRenderer = new SimpleRenderer(electedLabel);

        var labels = new LabelLayer({ id: "labels"});

        labels.addFeatureLayer(elc,electedLabelRenderer, "{NAME}");

        map.addLayer(labels);

      }

Outcomes