Skip to content

Commit

Permalink
[Tooltip] Changed the way the tooltip functions to make up for the fa…
Browse files Browse the repository at this point in the history
…ct firefox doesn't have certain properties on the event and event target

better offset
  • Loading branch information
panda01 committed May 27, 2015
1 parent d6a90b2 commit 0b54381
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ define(function (require) {
* @returns {D3.Selection}
*/
PointSeriesChart.prototype.createEndZones = function (svg) {
var self = this;
var xAxis = this.handler.xAxis;
var xScale = xAxis.xScale;
var yScale = xAxis.yScale;
Expand Down Expand Up @@ -100,19 +101,22 @@ define(function (require) {

function callPlay(event) {
var boundData = event.target.__data__;
var offsetX = self.chartEl.getBoundingClientRect().left;
var wholeBucket = boundData && boundData.x != null;

// the min and max that the endzones start in
var min = leftEndzone.w;
var max = rightEndzone.x;

// bounds of the cursor to consider
var xLeft = event.offsetX;
var xRight = event.offsetX;
var xLeft = event.clientX - offsetX;
var xRight = event.clientX - offsetX;
if (wholeBucket) {
xLeft = xScale(boundData.x);
xRight = xScale(xAxis.addInterval(boundData.x));
}


return {
wholeBucket: wholeBucket,
touchdown: min > xLeft || max < xRight
Expand All @@ -133,4 +137,4 @@ define(function (require) {

return PointSeriesChart;
};
});
});

0 comments on commit 0b54381

Please sign in to comment.