I just wanted to get the mouse position using D3 by using the following code:
var x = 0; svg.on(\'mousemove\', function () { x = d3.mouse(this)[0];
You can understand the click and drag function through this example very well.Hope it will helps..
var point = d3.mouse(this) , p = {x: point[0], y: point[1] };
http://jsfiddle.net/mdml/da37B/