Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.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
Javascript 通过滚动更改散点图上点的颜色_Javascript_D3.js_Scroll_Scatter Plot_Jquery Waypoints - Fatal编程技术网

Javascript 通过滚动更改散点图上点的颜色

Javascript 通过滚动更改散点图上点的颜色,javascript,d3.js,scroll,scatter-plot,jquery-waypoints,Javascript,D3.js,Scroll,Scatter Plot,Jquery Waypoints,我有一个散点图,它使用三种不同的CSV。以下Javascript控制来自其中一个CSV的点的放置: svg.append('g') .selectAll("dot") .data(files[2]) .enter() .append("circle") .attr("cx", function (d) { return x(d.Index); } ) .attr("cy&

我有一个散点图,它使用三种不同的CSV。以下Javascript控制来自其中一个CSV的点的放置:

svg.append('g')
    .selectAll("dot")
    .data(files[2])
    .enter()
    .append("circle")
      .attr("cx", function (d) { return x(d.Index); } )
      .attr("cy", function (d) { return y(d.Value); } )
      .attr("r", 4)
      .style("fill", function (d, i) { 
      if(i === 0) {
        return "#f05050"
      } else {
        return "#d3d3d3"
      }
    
    })
现在,除0索引中的点为红色外,此CSV中的点为灰色。当我滚动时,我的散点图保持在原来的位置,它的左边有滚动的文本。我的问题是,在滚动一定距离后,如何将0索引中的点更改为红色?提前谢谢