106
rated 0 times
[
107]
[
1]
/ answers: 1 / hits: 23135
/ 12 Years ago, fri, september 14, 2012, 12:00:00
I have a graph, and I want the line representing the graph to show a circle at the x coordinate when hovering on top of the svg area. This circle should follow the path of the line that represents the curve. The problem is that I don't know how to do this.
The code below shows how far I have succeded, and it indeed adds a circle to the document at the right x coordinate. Now, what do I replace the question mark with?
svg.on(mousemove, function() {
d3.select(path.line)
.style(stroke-width, 2.5px);
svg.append(svg:circle)
.attr(cx, Math.floor(event.offsetX-m[1]))
.attr(cy, ?)
.attr(r, 10)
.attr(fill, red);
});
More From » svg