apfister-esristaff

Setting Attributes Dynamically for graphics used in Service Area

Discussion created by apfister-esristaff Employee on Mar 27, 2010
Latest reply on Apr 1, 2010 by apfister-esristaff
Is there a way to dynamically set the attributes used in the features for Service Areas?  I've used the Service Area example from the javascript samples to try and modify.  See below.

Thanks,
Adam

 function mapClickHandler(evt){
      map.graphics.clear(); //clear existing graphics    
      //define the symbology used to display the results and input point
      var pointSymbol =  new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND, 20,
            new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
            new dojo.Color([88,116,152]), 2),
            new dojo.Color([88,116,152,0.45]));      
      var inPoint = new esri.geometry.Point(evt.mapPoint.x,evt.mapPoint.y,map.spatialReference);
      
      //this doesn't work
      var location = new esri.Graphic(inPoint, pointSymbol, {
     "FreightCost": 3.50
    }, null);

      map.graphics.add(location);
      var features = [];
      features.push(location);
      var facilities = new esri.tasks.FeatureSet();
      facilities.features = features;
      params.facilities = facilities;

      //solve ...
}

Outcomes