score:1

Accepted answer

You can calculate the actual distance of each point to the point of interest and determine points color based on this distance like:

var threshold=...
var p =...
d3.select('circle').each(function(d){
    var x = p.x - d.x;
    var y = p.y - d.y;
    d.distance = Math.sqrt(x*x + y*y);
}).attr('fill', function(d){
    return d.distance < threshold? 'red' : 'blue'
})

Ps. Sorry, answered from mobile


Related Query

More Query from same tag