on the whole page.
+ left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft;
+ top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop;
+
}
if (snapDistance && snapDistance > 0) {
@@ -264,6 +269,7 @@ window.nv.tooltip.* also has various helper methods.
//Original tooltip.show function. Kept for backward compatibility.
+ // pos = [left,top]
nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) {
//Create new tooltip div if it doesn't exist on DOM.
@@ -281,7 +287,10 @@ window.nv.tooltip.* also has various helper methods.
container.style.opacity = 0;
container.innerHTML = content;
body.appendChild(container);
-
+
+ //If the parent container is an overflow
with scrollbars, subtract the scroll offsets.
+ pos[0] = pos[0] - parentContainer.scrollLeft;
+ pos[1] = pos[1] - parentContainer.scrollTop;
nv.tooltip.calcTooltipPosition(pos, gravity, dist, container);
};
@@ -320,7 +329,7 @@ window.nv.tooltip.* also has various helper methods.
};
//Global utility function to render a tooltip on the DOM.
- //pos = [X,Y] coordinates of where to place the tooltip, relative to the SVG chart container.
+ //pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container.
//gravity = how to orient the tooltip
//dist = how far away from the mouse to place tooltip
//container = tooltip DIV
diff --git a/test/lineChartTest.html b/test/lineChartTest.html
index b75f0e5..f8921ca 100644
--- a/test/lineChartTest.html
+++ b/test/lineChartTest.html
@@ -4,13 +4,13 @@