Skip to content

Commit

Permalink
if no offset element is given, assume 0 on pieChart, because pieChart…
Browse files Browse the repository at this point in the history
… uses mouse position for tooltips right now
  • Loading branch information
bobmonteverde committed Jun 28, 2012
1 parent 3071b32 commit 42aa8ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions nv.d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -4951,8 +4951,8 @@ nv.models.pieChart = function() {


var showTooltip = function(e, offsetElement) {
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
top = e.pos[1] + ( offsetElement.offsetTop || 0),
var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ),
top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0),
y = pie.valueFormat()(pie.y()(e.point)),
content = tooltip(pie.label()(e.point), y, e, chart);

Expand Down Expand Up @@ -5036,7 +5036,7 @@ nv.models.pieChart = function() {
e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top];
dispatch.tooltipShow(e);
});
if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e, that.parentNode) } ); // TODO: maybe merge with above?
if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e) } ); // TODO: maybe merge with above?

pie.dispatch.on('elementMouseout.tooltip', function(e) {
dispatch.tooltipHide(e);
Expand Down
Loading

0 comments on commit 42aa8ad

Please sign in to comment.