AnsweredAssumed Answered

Buffer with different colored rings

Question asked by gsanders32 on Mar 24, 2014
Latest reply on Mar 31, 2014 by gsanders32
Hello, i need a little help. I created a  web map that uses the buffer tool with 7 different rings. I want to change the color of each ring. Does anyone know how to do this?

Thanks, Gray

  <script>
    dojo.require("esri.map");
    dojo.require("esri.tasks.geometry");

    var map = null;
    var gsvc = null;

    function initialize() {
      gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
      map.on("click", doBuffer);}

    function doBuffer(evt) {

      map.graphics.clear();
      var params = new esri.tasks.BufferParameters();
      params.geometries = [ evt.mapPoint ];

      //buffer in linear units such as meters, km, miles etc.
      params.distances = [ 100, 200, 300, 350, 400, 500, 540 ];
      params.unit = esri.tasks.GeometryService.UNIT_YARDS;
      params.outSpatialReference = map.spatialReference;

      gsvc.buffer(params, showBuffer);
    }

    function showBuffer(geometries) {
      var symbol = new esri.symbol.SimpleFillSymbol(
        esri.symbol.SimpleFillSymbol.STYLE_SOLID,
        new esri.symbol.SimpleLineSymbol(
          esri.symbol.SimpleLineSymbol.STYLE_SOLID,
          new dojo.Color([255,0,0,0.85]), 2
        ),
        new dojo.Color([0,0,0,0.06])
      );

      dojo.forEach(geometries, function(geometry) {
        var graphic = new esri.Graphic(geometry,symbol);
        map.graphics.add(graphic);
      });
    }

    dojo.ready(initialize);
  </script>

[ATTACH=CONFIG]32460[/ATTACH]

Attachments

Outcomes