Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
d3.js:由点发出同心圆的地图_D3.js_Setinterval_Topojson - Fatal编程技术网

d3.js:由点发出同心圆的地图

d3.js:由点发出同心圆的地图,d3.js,setinterval,topojson,D3.js,Setinterval,Topojson,离开d3.js几个月了。。。我继承了一张简单的美国地图,上面有其他人创建的功能 <style> body { background: #192887; } .graticule { fill: none; stroke: #fff; stroke-width: .5px; }

离开d3.js几个月了。。。我继承了一张简单的美国地图,上面有其他人创建的功能

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
特征由大小不同的简单点表示

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
我想在每个点上加上发散的同心圆,类似于迈克·博斯托克(Mike Bostock)的经典洋葱(Onion)示例:(看起来可能没那么不祥)

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
我在这里设置了一个街区:

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
(不确定为什么块中的状态不能正确渲染,但这可能与此无关。)

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
在迈克的例子中,只有一个点,所以我很难理解如何将他所做的转化为我所得到的(许多点)

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
这是我的剧本:

/**
 * Page initialization
 */
$(function() {
    renderMap('#map-container');
});

function renderMap(container) {
    var width = 960,
        height = 500,
        active;

    var projection = d3.geo.albersUsa()
        .scale(960)
        .translate([width / 2, height / 2]);

    var path = d3.geo.path()
        .projection(projection);

    var radius = d3.scale.sqrt()
        .domain([0, 1e7])
        .range([0, 10]);

    var path2 = d3.geo.path()
        .projection(projection);

    //  Remove svg, if already exist
    d3.select(container).select('svg').remove();

    var svg = d3.select(container).append("svg")
        .attr("width", width)
        .attr("height", height);

    svg.append("rect")
        .attr("width", width)
        .attr("height", height);
        //.on("click", reset);

    var g = svg.append("g");

    queue()
        .defer(d3.json, "/mbostock/raw/4090846/us.json")
        .defer(d3.json, "dots.json")
        .await(function (error, us, centroid) {
            g.append("g")
                .attr("id", "states")
                .selectAll("path")
                .data(topojson.feature(us, us.objects.states).features)
                .enter().append("path")
                .attr("d", path)
                .attr("class", "state");
                //.on('click', click);

            g.append('path')
                .attr("id", "state-borders")
                .datum(topojson.mesh(us, us.objects.states, function(a, b) { return a !== b; }))
                .attr("d", path)
                .attr("class", "mesh");

            var dots = g.append("g")
                .attr("id", "dots")
                .selectAll("path")
                .data(centroid.data)
              .enter().append("path")
                .attr("class", "dot")
                .attr("d", path2.pointRadius(function(d) { return radius(d.properties.pool); }));
        }    
    );

 }
    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
迈克制作戒指的例子的关键部分是:

setInterval(function() {
  svg.append("circle")
      .attr("class", "ring")
      .attr("transform", "translate(" + projection([100, -8]) + ")")
      .attr("r", 6)
      .style("stroke-width", 3)
      .style("stroke", "red")
    .transition()
      .ease("linear")
      .duration(6000)
      .style("stroke-opacity", 1e-6)
      .style("stroke-width", 1)
      .style("stroke", "brown")
      .attr("r", 160)
      .remove();
}, 750);
    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>

如何将环定位在点上?

回顾这两种方法之间的差异,进一步了解函数式/声明式编程是如何将迭代编程的痛苦抽象出来的

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
使用D3习语的方法:

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
小提琴:

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
更新:D3方式

<!DOCTYPE html>
<html>
<head>
    <title></title>

    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
              svg
                .selectAll("ring")
                .data(data)
                .enter()
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle)
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>
    <style>
        body {
              background: #192887;
            }

            .graticule {
              fill: none;
              stroke: #fff;
              stroke-width: .5px;
            }

            .land {
              fill: #007421;
            }

            .dot {
              fill: #c7141a;
            }

            .ring {
              fill: none;
              stroke: #c7141a;
            }
    </style>

    <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>

var width = 960,
    height = 500;

var projection = d3.geo.mercator()
    .center([113, -3])
    .scale(1275)
    .translate([width / 2, height / 2])
    .clipExtent([[0, 0], [width, height]])
    .precision(.1);

var path = d3.geo.path()
    .projection(projection);

var graticule = d3.geo.graticule()
    .step([5, 5]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("path")
    .datum(graticule)
    .attr("class", "graticule")
    .attr("d", path);


var data = [{x:-8,y:100},{x:-10,y:110},{x: -12,y:120}];

svg.selectAll("circle")
    .data(data)
    .enter()
    .append("circle")
    .attr("class","dot")
    .attr("transform",translateCircle)
    .attr("r",8);


function translateCircle(datum, index)
          {
            return "translate(" +  projection([datum.y, datum.x]) + ")";
          };

setInterval(function(){
          data.forEach(function(datum)
          {
              svg
                .append("circle")
                  .attr("class", "ring")
                  .attr("transform", translateCircle(datum))
                  .attr("r", 6)
                  .style("stroke-width", 3)
                  .style("stroke", "red")
                .transition()
                  .ease("linear")
                  .duration(6000)
                  .style("stroke-opacity", 1e-6)
                  .style("stroke-width", 1)
                  .style("stroke", "brown")
                  .attr("r", 160)
                  .remove();
          })
      }, 750)


d3.select(self.frameElement).style("height", height + "px");    
</script>

</body>
</html>

谢谢@arete-我会尝试一下这个想法-所以你使用translateCircle进行定位,然后点和环都调用该函数如果你觉得这个解决方案有用,请接受答案。