Accepted answer

In your brushed and zoomed functions, you need to select your circles and apply dynamic attributes. But before you do that, you need to rename the class for your circles. Something like:

// draw dots
    .attr("class", "circle")


function brushed() {
  if (d3.event.sourceEvent && d3.event.sourceEvent.type === "zoom") return; // ignore brush-by-zoom
  var s = d3.event.selection || x2.range();
  x.domain(, x2));".area").attr("d", area);".axis--x").call(xAxis);
    .attr("r", (d)=>{return (d.PTS)})
    .attr("cx", (d)=>{return x(})
    .attr("cy", (d)=>{return y(d.PTS)})".zoom").call(zoom.transform, d3.zoomIdentity
      .scale(width / (s[1] - s[0]))
      .translate(-s[0], 0));

function zoomed() {
  if (d3.event.sourceEvent && d3.event.sourceEvent.type === "brush") return; // ignore zoom-by-brush
  var t = d3.event.transform;
  x.domain(t.rescaleX(x2).domain());".area").attr("d", area);".axis--x").call(xAxis);
    .attr("r", (d)=>{return (d.PTS)})
    .attr("cx", (d)=>{return x(})
    .attr("cy", (d)=>{return y(d.PTS)})".brush").call(brush.move, x.range().map(t.invertX, t));

Related Query

More Query from same tag