Created
June 25, 2017 09:43
-
-
Save yani-/ddff5f87c594ffc17cd005c265242908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mouseOver | |
.append('svg:rect') | |
.attr('width', width) | |
.attr('height', height) | |
.attr('fill', 'none') | |
.attr('pointer-events', 'all') | |
.on('mouseout', function() { | |
d3.select('.mouse-line') | |
.style('opacity', '0'); | |
d3.selectAll('.mouse-per-line circle') | |
.style('opacity', '0'); | |
d3.selectAll('.mouse-per-line text') | |
.style('opacity', '0'); | |
}) | |
.on('mouseover', function() { | |
d3.select('.mouse-line') | |
.style('opacity', '1'); | |
d3.selectAll('.mouse-per-line circle') | |
.style('opacity', '1'); | |
d3.selectAll('.mouse-per-line text') | |
.style('opacity', '1'); | |
}) | |
.on('mousemove', function() { | |
var mouse = d3.mouse(this); | |
d3.select('.mouse-line') | |
.attr('d', function() { | |
let d = 'M' + mouse[0] + ',' + height; | |
d += ' ' + mouse[0] + ',' + 0; | |
return d; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment