AnsweredAssumed Answered

How to change the radius of the circle around the marker using javascript Arcgis?

Question asked by manjarigoyal on Nov 12, 2014
Latest reply on Nov 12, 2014 by manjarigoyal

I am trying to create a buffer based on the drop down box radius value. so far I tried two different things but none of them working.

 

First try:

var circle;

        var radius = parseInt(dom.byId("Radius").value);

        function Buffer(evt){

          console.log(evt);

            var radius = parseInt(dom.byId("Radius").value);

              circle = new Circle({

                center: evt,

                geodesic: true,

                radius: radius

                radiusUnit: "esriMiles"

            }

            });

          });

          //map.graphics.clear();

          map.infoWindow.hide();

          var graphic = new Graphic(circle, circleSymb);

          map.graphics.add(graphic);

Second try:

var circle;

        function Buffer(evt){

          console.log(evt);

            var selectedRadius = (document.getElementById("Radius"), 'change', function(){

            circle.setRadius(document.getElementById('Radius').value)

            )};

              circle = new Circle({

                center: evt,

                geodesic: true,

                radius: "selectedRadius"

                radiusUnit: "esriMiles"

            }

            });

          });

          //map.graphics.clear();

          map.infoWindow.hide();

          var graphic = new Graphic(circle, circleSymb);

          map.graphics.add(graphic);

 

HTML Part: creates a drop down box

Choose the radius in Miles

      <select id="Radius">

       

      <option selected="selected">1 Mile</option>

          <option>2 Miles</option>

          <option>3 Miles</option>

          <option>4 Miles</option>

          <option>5 Miles</option>

          </select>

Outcomes