Commit d61c9012 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix tooltip position

parent be9caf62
...@@ -1063,17 +1063,23 @@ ...@@ -1063,17 +1063,23 @@
tHeight = tooltip.property('offsetHeight'); tHeight = tooltip.property('offsetHeight');
// Determin tooltip position // Determin tooltip position
if (__axis_rotated) { if (__axis_rotated) {
tooltipLeft = mouse[0]; tooltipLeft = mouse[0] + 100;
tooltipRight = tooltipLeft + tWidth;
chartRight = getCurrentWidth() - getCurrentPaddingRight();
tooltipTop = x(dataToShow[0].x) + 20;
} else { } else {
svgLeft = getSvgLeft(); svgLeft = getSvgLeft();
tooltipLeft = svgLeft + getCurrentPaddingLeft() + x(dataToShow[0].x) + 20; tooltipLeft = svgLeft + getCurrentPaddingLeft() + x(dataToShow[0].x) + 20;
tooltipRight = tooltipLeft + tWidth; tooltipRight = tooltipLeft + tWidth;
chartRight = svgLeft + getCurrentWidth() - getCurrentPaddingRight(); chartRight = svgLeft + getCurrentWidth() - getCurrentPaddingRight();
tooltipTop = mouse[1] + 15;
}
if (tooltipRight > chartRight) { if (tooltipRight > chartRight) {
tooltipLeft -= tWidth + 30; tooltipLeft -= tWidth + 60;
} }
if (tooltipTop + tHeight > getCurrentHeight()) {
tooltipTop -= tHeight + 30;
} }
tooltipTop = mouse[1] + 15 + tHeight < getCurrentHeight() ? mouse[1] + 15 : mouse[1] - tHeight;
// Set tooltip // Set tooltip
// todo get rid of magic numbers // todo get rid of magic numbers
tooltip tooltip
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment