Hi Noah,
I recommend separating your efforts into two distinct working pieces:
1) render your scatterplot and be able to update its position with a function call (regardless of scrolling). Perhaps craft a function that will change the color accordingly and call it on button click or from the console.
I notice some issues in your d3 code that are subtle, the first render will work but its likely to break if you run it again. you do .selectAll("dot") when it should be .selectAll("circle.dot") (you should also .classed("dot", true) to your circle).
You are changing color based on the order of elements, you probably want to use your d.Index to change the color.
It's hard to give more specific advice without seeing a live example.
good luck!