-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathd3.chart.tooltip.min.js
6 lines (6 loc) · 1.15 KB
/
d3.chart.tooltip.min.js
1
2
3
4
5
6
/*! d3.chart.tooltip - v0.1.0
* License: MIT Expat
* Author: Irene Ros
* Date: 2013-06-20
*/
d3.chart("TooltipMixinChart",{initialize:function(t){t=t||{};var e={noText:"You need to call .text on your tooltip mixin and provide it a rendering function!"};this.tooltipedLayer=t.layer,this.tooltipedSelectionType=t.type;var n=this.base.append("div").classed("tooltip",!0);this.layer("tooltips",n,{dataBind:function(){return this.selectAll("div").data([!0])},insert:function(){return this.append("div")},events:{enter:function(){var t=this.chart(),n=this;t.tooltipedLayer.base.selectAll(t.tooltipedSelectionType).on("mouseover.tooltip",function(o,i){n.style({left:d3.event.pageX+20+"px",top:d3.event.pageY-20+"px",position:"absolute","z-index":1001}).html(function(){if(t._textFn===void 0)throw Error(e.noText);return t._textFn(o,i)})}).on("mousemove.tooltip",function(o,i){n.style({left:d3.event.pageX+20+"px",top:d3.event.pageY-20+"px"}).html(function(){if(t._textFn===void 0)throw Error(e.noText);return t._textFn(o,i)})}).on("mouseout.tooltip",function(){n.html("")})}}})},text:function(t){return 0===arguments.length?this._textFn:(this._textFn=d3.functor(t),this)}});