我在我的项目中使用svg圈子,
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 120">
<g>
<g id="one">
<circle fill="green" cx="100" cy="105" r="20" />
</g>
<g id="two">
<circle fill="orange" cx="100" cy="95" r="20" />
</g>
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
我在g标签中使用z-index 来显示第一个元素.在我的项目中,我只需要使用z-index值,但我不能将z-index用于我的svg元素.我google了很多,但我找不到任何相对的东西.所以请帮我在我的svg中使用z-index.
这是DEMO.
假设我有几个复合形状(<g>).我希望能够点击并拖动它们,但是我希望我碰巧在Z顺序中将其拖动到另一个的TOP上,这样如果我将它拖到其他的那个上,那么另一个一个人应该黯然失色.
这是我第一次尝试 d3.js,我在使用 d3-tip 函数时遇到了一些小问题。一张图片胜过一千个字,所以这是我的问题。

d3-tips 工作正常,直到我将图表放入模态中。我尝试过将 css z-index 作为 d3-tip 样式的一部分:
.d3-tip {
line-height: 1;
font-weight: bold;
padding: 12px;
background: rgba(0, 0, 0, 0.8);
color: #fff;
border-radius: 2px;
z-index: 1;
}
Run Code Online (Sandbox Code Playgroud)
这没有任何效果,并且以我有限的 CSS 知识,我认为 z-index 仍然使用我的主体作为关系键。
这是我的var tip设置:
var tip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function(d) {
return "<strong>Date:</strong> <span style='color:red'>" + d.date + "</span></br><strong>Time:</strong> <span style='color:red'>" + d.time + "</span>
</br><strong>Around:</strong> <span style='color:red'>" + d.timeGroup + "</span>";
});
Run Code Online (Sandbox Code Playgroud)
这是我的模式:
<div id="modal-barGraph" class="modal flex-child fade" role='dialog'>
<div …Run Code Online (Sandbox Code Playgroud)