如何获取此svg圈子出现在我的d3路径上面而不是下面? [英] How can I get this svg circle to appear above my d3 path and not below?

查看:123
本文介绍了如何获取此svg圈子出现在我的d3路径上面而不是下面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个d3图形插件,它基于给出的实时数据绘制图形。当鼠标悬停在图形上时,在鼠标后面有一个工具提示,显示该点的数据。此工具提示的一部分是出现在距光标最近点的路径上的圆。问题是,无论我尝试,我不能得到这个圆形出现在路径线之上,像它被推翻。我已经尝试使用z-index,更改元素的附加顺序,以及一些其他真正古怪的尝试。没有什么影响(除了打破一切。)这是一个粘贴代码。有问题的元素有类focusCircle。

I wrote a d3 graph plugin that draws a graph based on real time data given to it. When you mouseover the graph, there is a tooltip that follows your mouse, showing data at that point. Part of this tooltip is a circle that appears on the path at the closest point to the cursor. The problem is that no matter what I try, I cannot get this circle to appear above the path line like it's suposed to. I have tried using z-index, changing the append order of elements, and some other really wacky attempts. Nothing has had an affect (besides breaking everything.) Here's a pastebin of the code. The element in question has the class "focusCircle". Any help would be greatly appreciated.

推荐答案

在调用resize函数之前,您的圈子会被渲染。 resize函数调用draw函数,其中附加了2条路径。我认为这些是你的圈子之上的。

Your circle gets rendered before the "resize" function is called. The "resize" function calls the "draw" function, where 2 paths get appended. I think those are the ones above your circle.

这篇关于如何获取此svg圈子出现在我的d3路径上面而不是下面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆