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

Source: stackoverflow.com

#### Related Query

- D3: Select a circle by x and y coordinates in a scatter plot
- How can I plot positive and negative values for both axes in a scatter plot with d3?
- Create an interactive 3d scatter plot with D3.js and Three.js with json data
- Moving scatter plot circles with context zooming and brush in D3
- Clean way to create scatter plot from x and y vectors
- d3js Box and Whisker plot: add a single circle to plot given a point in the distribution
- dc.js Scatter Plot and elasticY behavior
- How can I select a dot from a scatter and display data about it?
- Select existing circle node in d3 and append childs
- D3JS - Display both circles and triangles in a scatter plot
- D3: adding a line when clicking on a circle in scatter plot
- select dot in scatter plot based on data id in d3js
- How do I select one group of values from dataset to plot a linechart using D3.js and not the whole dataset
- Ploting Scales and Axes using d3.js code in Google Datastudio for scatter plot
- C3.js Scatter plot - how to associate third data (additional value) as part of original column data for callbacks to set radius and display in tooltip
- Using D3 transition method with data for scatter plot
- How can I change the radius and opacity of a circle in d3?
- Circle clip and projection with D3 orthographic
- Increase and decrease radius of a circle using d3 transition
- Change size of bubble in Scatter Plot for c3.js
- d3.js scatter plot - zoom/drag boundaries, zoom buttons, reset zoom, calculate median
- D3js Grouped Scatter plot with no collision
- nvd3 scatter plot with ordinal scale
- D3: Select and alter external SVG?
- d3.js zoom/drag scatter plot
- Combining angularJS and d3.js: Refreshing a plot after submitting new input parameters
- how do you draw linear line in scatter plot with d3.js
- d3.js Plot elements using polar coordinates
- D3 click coordinates after pan and zoom
- Find centroid of topoJSON path and use it to position a circle in D3

#### More Query from same tag

- d3.v3 transitions happening instantly?
- Why does D3 circle position virtually reset after drag
- getBBox() and getComputedTextLength() once working, once not
- d3.js bar chart - show/hide bars on legend click. how to filter correctly?
- d3js transition step function
- Ajax D3.js Table based on CSV
- Resizing the boxplot
- d3 Stacked Bar Chart Not Updating
- How to install and use observablehq/stdlib angular 2+ project
- How to calculate the center of a rotated element, after resizing it
- Partition has a blank slice
- How to increase tick label width in d3.js axis
- D3.js force layout: How to isolate node groups?
- D3 graph questions about zoom
- d3.js default axis.tickFormat to 24 hour clock
- How can insert order of an enter selection be controlled?
- localhost on mavericks accepts one file, denies an adjusted version of same
- D3.js issue using the line chart defined function
- nvd3, x-axis ticks are repeating for certain months
- How to get SVG path data of TopoJSON feature without adding it to the DOM?
- Making X-axis in cross filter dynamic
- change client data transforms value in meteor.js
- Apply multiple filters except Others in crossfilter dc js
- d3: Path data generator and if-statement
- Display non-ASCII characters from CSV file retrieved with d3.csv
- What is causing certain data to display weird in this d3 chart?
- Adding background color in d3 js bar chart using data values
- How to apply a CSS style sheet to a D3 force-directed graph?
- How to make labels appear only when the chart is zoomed in
- Filtering Data with on click function