Mouse position in D3

前端 未结 4 1730
别跟我提以往
别跟我提以往 2020-12-04 08:54

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];               


        
4条回答
  •  佛祖请我去吃肉
    2020-12-04 09:24

    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/

提交回复
热议问题