Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // define drag behavior
- drag = d3.behavior.drag()
- .origin(function(d) { return {x: d['x'], y: d['y']}; })
- .on('dragstart', function(d) {
- dragStart = new Date();
- }).on('drag', dragged)
- .on('dragend', function(d) {
- dragEnd = new Date();
- // units are seconds
- var elapsedTime = (dragEnd - dragStart) / 1000;
- console.log("elapsed drag time: " + elapsedTime);
- // TODO: generate the log of the drag ---
- });
- // create circles
- var circles = svg
- .selectAll('circle')
- .data(data)
- .enter().append('circle')
- .attr('class', 'circle')
- .attr('cx', function(d) { return d['x']; })
- .attr('cy', function(d) { return d['y']; })
- .attr('r', radius)
- .classed('unsorted', true)
- .call(drag)
- .on('click', clicked)
- .on('mouseover', mouseover)
- .on('mouseout', mouseout);
- // define mouseover behavior
- function mouseover(d) {
- mouseoverStart = new Date();
- tip.show(d);
- }
- // define mouseout behavior
- function mouseout(d) {
- tip.hide(d);
- mouseoverEnd = new Date();
- // units are seconds
- var elapsedTime = (mouseoverEnd - mouseoverStart) / 1000;
- console.log("elapsed mouseover time: " + elapsedTime);
- // TODO: generate the log of the mouseover --
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement