Created
September 22, 2015 01:39
-
-
Save pzi/b493d216d1d86053485e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// this = marker under mouse | |
const matrix = this.getScreenCTM() | |
.translate(+this.getAttribute('cx'), +this.getAttribute('cy')); | |
const graphDiv = document.getElementById(graphOptions.chart.id).getBoundingClientRect(); | |
let tooltTipLeftpx = matrix.e - graphDiv.left; | |
if (tooltTipLeftpx > (graphOptions.chart.width - (graphOptions.chart.padding * 1.5))) { | |
tooltTipLeftpx -= graphOptions.chart.padding * 2; | |
} | |
tooltip.style({ | |
'left': `${tooltTipLeftpx}px`, | |
'top': `${matrix.f - graphDiv.top}px` | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: I am using a div outside the svg as a tooltip.