|
|
|
@ -398,7 +398,12 @@ nv.interactiveBisect = function (values, searchVal, xAccessor) {
|
|
|
|
|
//Create new tooltip div if it doesn't exist on DOM.
|
|
|
|
|
container = document.createElement('div');
|
|
|
|
|
container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip');
|
|
|
|
|
var body = document.getElementsByTagName('body')[0]; //All new tooltips are placed directly on <body>
|
|
|
|
|
var body;
|
|
|
|
|
if (chartContainer)
|
|
|
|
|
body = chartContainer;
|
|
|
|
|
else
|
|
|
|
|
body = document.getElementsByTagName('body')[0];
|
|
|
|
|
|
|
|
|
|
body.appendChild(container);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -423,8 +428,11 @@ nv.interactiveBisect = function (values, searchVal, xAccessor) {
|
|
|
|
|
var top = (fixedTop != null) ? fixedTop : position.top;
|
|
|
|
|
|
|
|
|
|
if (chartContainer) {
|
|
|
|
|
left += chartContainer.getBoundingClientRect().left + window.pageXOffset;
|
|
|
|
|
top += chartContainer.getBoundingClientRect().top + window.pageYOffset;
|
|
|
|
|
var svgComp = chartContainer.getElementsByTagName("svg")[0];
|
|
|
|
|
var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect();
|
|
|
|
|
|
|
|
|
|
left += boundRect.left + window.pageXOffset;
|
|
|
|
|
top += boundRect.top + window.pageYOffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (snapDistance && snapDistance > 0) {
|
|
|
|
@ -434,7 +442,7 @@ nv.interactiveBisect = function (values, searchVal, xAccessor) {
|
|
|
|
|
var container = getTooltipContainer(contentGenerator(data));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container);
|
|
|
|
|
nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container, true);
|
|
|
|
|
return nvtooltip;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -582,7 +590,7 @@ nv.interactiveBisect = function (values, searchVal, xAccessor) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Global utility function to render a tooltip on the DOM.
|
|
|
|
|
nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) {
|
|
|
|
|
nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container, skipOffsetCalc) {
|
|
|
|
|
|
|
|
|
|
var height = parseInt(container.offsetHeight),
|
|
|
|
|
width = parseInt(container.offsetWidth),
|
|
|
|
@ -599,12 +607,12 @@ nv.interactiveBisect = function (values, searchVal, xAccessor) {
|
|
|
|
|
dist = dist || 20;
|
|
|
|
|
|
|
|
|
|
var tooltipTop = function ( Elem ) {
|
|
|
|
|
if (Elem.parentNode.tagName === 'BODY') return top;
|
|
|
|
|
if (skipOffsetCalc === true) return top;
|
|
|
|
|
return nv.tooltip.findTotalOffsetTop(Elem, top);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var tooltipLeft = function ( Elem ) {
|
|
|
|
|
if (Elem.parentNode.tagName === 'BODY') return left;
|
|
|
|
|
if (skipOffsetCalc === true) return left;
|
|
|
|
|
return nv.tooltip.findTotalOffsetLeft(Elem,left);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -670,7 +678,6 @@ nv.interactiveBisect = function (values, searchVal, xAccessor) {
|
|
|
|
|
tooltips[0].className = 'nvtooltip-pending-removal';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
|
|
|
|
|
while (purging.length) {
|
|
|
|
@ -2457,7 +2464,7 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
|
|
|
|
|
interactiveLayer.tooltip
|
|
|
|
|
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
|
|
|
|
|
.chartContainer(that)
|
|
|
|
|
.chartContainer(that.parentNode)
|
|
|
|
|
.enabled(tooltips)
|
|
|
|
|
.valueFormatter(function(d,i) {
|
|
|
|
|
return yAxis.tickFormat()(d);
|
|
|
|
@ -5334,7 +5341,7 @@ nv.models.lineChart = function() {
|
|
|
|
|
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
|
|
|
|
|
interactiveLayer.tooltip
|
|
|
|
|
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
|
|
|
|
|
.chartContainer(that)
|
|
|
|
|
.chartContainer(that.parentNode)
|
|
|
|
|
.enabled(tooltips)
|
|
|
|
|
.valueFormatter(function(d,i) {
|
|
|
|
|
return yAxis.tickFormat()(d);
|
|
|
|
@ -13688,7 +13695,7 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
|
|
|
|
|
interactiveLayer.tooltip
|
|
|
|
|
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
|
|
|
|
|
.chartContainer(that)
|
|
|
|
|
.chartContainer(that.parentNode)
|
|
|
|
|
.enabled(tooltips)
|
|
|
|
|
.valueFormatter(function(d,i) {
|
|
|
|
|
return yAxis.tickFormat()(d);
|
|
|
|
|