相关疑难解决方法(0)

如何检测两个线段相交的位置?

如何确定两条线是否相交,如果它们相交,在x,y点处是什么?

geometry line-intersection

519
推荐指数
17
解决办法
41万
查看次数

具有鼠标悬停工具提示的多重系列折线图

我使用这个bl.ocks.org代码示例创建了一个多系列折线图.我已经设法在JSFiddle上重新创建它.

多系列折线图

现在,我正在尝试添加一个x值鼠标悬停工具提示,当您悬停其垂直位置时,它会显示每行的工具提示.事情是这样的,但对于多行.

我发现这个StackOverflow答案(它包括一个JSFiddle),但我似乎无法使它与我的多重系列折线图一起工作.

svg.append("path") // this is the black vertical line to follow mouse
  .attr("class","mouseLine")  
  .style("stroke","black")
  .style("stroke-width", "1px")
  .style("opacity", "0");

var mouseCircle = causation.append("g") // for each line, add group to hold text and circle
      .attr("class","mouseCircle"); 

mouseCircle.append("circle") // add a circle to follow along path
  .attr("r", 7)
  .style("stroke", function(d) { console.log(d); return color(d.key); })
  .style("fill","none")
  .style("stroke-width", "1px"); 

mouseCircle.append("text")
  .attr("transform", "translate(10,3)"); // text to hold coordinates

var bisect = d3.bisector(function(d) { …
Run Code Online (Sandbox Code Playgroud)

jquery d3.js

11
推荐指数
1
解决办法
1万
查看次数

标签 统计

d3.js ×1

geometry ×1

jquery ×1

line-intersection ×1