我有一个图表,我需要一个参考线,鼠标光标位于此图中.此参考线将跟随图形内的鼠标移动.
但这似乎没有用.它仅适用于轴和轴的刻度线(.轴线).在调试时,我发现鼠标事件在SVG上应用时工作正常但在组上没有,为什么呢?
这是我的代码:
<html>
<head>
<script src="jquery.js">
</script>
<script src="d3.v2.js">
</script>
<script src="retest.js">
</script>
<style type="text/css">
.g_main {
cursor:pointer;
}
.axis path, .axis line {
stroke: #DBDBDB;
/*shape-rendering: crispEdges;
*/
}
.y g:first-child text {
display:none;
}
.y g:first-child line {
stroke: #989898 ;
stroke-width: 2.5px;
}
/*.x g:first-child line {
stroke: black ;
stroke-width: 2.5px;
}
*/
.y path {
stroke: #989898 ;
stroke-width: 2.5px;
}
</style>
</head>
<body>
<center>
<button id="reload" onclick="loadViz();">
load Graph
</button>
<div id="viz" …Run Code Online (Sandbox Code Playgroud)