Skip to content

Commit

Permalink
Fixing up position of tooltips for pie charts when page is scrolled
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhley committed Nov 19, 2015
1 parent 1e6d6d0 commit 819f75c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dc.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dc.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,13 +1334,13 @@ dc.baseMixin = function (_chart) {
var gBounding = _chart.g().node().getBoundingClientRect();
var centroid = arc.centroid(d);

style.left = gBounding.left + (gBounding.width / 2) - (tooltipBounding.width / 2) + centroid[0];
style.top = gBounding.top + (gBounding.height / 2) - tooltipBounding.height - 10 + centroid[1];
style.left = gBounding.left + (gBounding.width / 2) - (tooltipBounding.width / 2) + centroid[0] + window.scrollX;
style.top = gBounding.top + (gBounding.height / 2) - tooltipBounding.height - 10 + centroid[1] + window.scrollY;
// all other charts
} else {
var elBounding = element.getBoundingClientRect();

style.left = elBounding.left - (tooltipBounding.width / 2) + window.scrollX + (elBounding.width / 2);
style.left = elBounding.left + (elBounding.width / 2) - (tooltipBounding.width / 2) + window.scrollX;
style.top = elBounding.top - tooltipBounding.height - 10 + window.scrollY;
}

Expand Down
6 changes: 3 additions & 3 deletions web/js/dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/js/dc.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions web/js/dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/js/dc.min.js.map

Large diffs are not rendered by default.

0 comments on commit 819f75c

Please sign in to comment.