{"version":3,"file":"chartist-plugin-tooltip.min.js","sources":["chartist-plugin-tooltip.js"],"names":["root","factory","define","amd","returnExportsGlobal","exports","module","this","window","document","Chartist","defaultOptions","currency","undefined","plugins","tooltip","options","extend","chart","tooltipSelector","Bar","Pie","$chart","$","container","$toolTip","append","find","hide","on","$point","tooltipText","tooltipFnc","attr","label","next","length","text","value","isEmptyObject","replace","html","show","event","css","left","originalEvent","layerX","offsetX","width","top","layerY","offsetY","height","tooltips"],"mappings":";;;;;;CAAC,SAAUA,EAAMC,GACO,kBAAXC,SAAyBA,OAAOC,IAEzCD,UAAW,WACT,MAAQF,GAAKI,oBAAsBH,MAET,gBAAZI,SAIhBC,OAAOD,QAAUJ,IAEjBD,EAAK,6BAA+BC,KAEtCM,KAAM,WAyFN,MAlFC,UAASC,EAAQC,EAAUC,GAC1B,YAEA,IAAIC,IACFC,SAAUC,OAWZH,GAASI,QAAUJ,EAASI,YAC5BJ,EAASI,QAAQC,QAAU,SAASC,GAIlC,MAFAA,GAAUN,EAASO,UAAWN,EAAgBK,GAEvC,SAAiBE,GACtB,GAAIC,GAAkB,WAClBD,aAAiBR,GAASU,IAC5BD,EAAkB,UACTD,YAAiBR,GAASW,MACnCF,EAAkB,YAGpB,IAAIG,GAASC,EAAEL,EAAMM,WACjBC,EAAWH,EACdI,OAAO,wCACPC,KAAK,qBACLC,MAEDN,GAAOO,GAAG,aAAcV,EAAiB,WACvC,GAAIW,GAASP,EAAEhB,MACXwB,EAAc,EAElB,IAAIf,EAAQgB,WACVD,EAAcf,EAAQgB,WAAWF,EAAOG,KAAK,YAAc,GAAIH,EAAOG,KAAK,iBACtE,CACL,GAAIH,EAAOG,KAAK,WACdF,GAAeD,EAAOG,KAAK,WAAa,WAIxC,IAAIf,YAAiBR,GAASW,IAAK,CACjC,GAAIa,GAAQJ,EAAOK,KAAK,YACpBD,GAAME,OAAS,IACjBL,GAAeG,EAAMG,OAAS,QAKpC,GAAIC,GAAQR,EAAOG,KAAK,WACnBV,GAAEgB,cAAcvB,EAAQJ,YAC3B0B,EAAQtB,EAAQJ,SAAW0B,EAAME,QAAQ,+BAAgC,QAE3ET,GAAeO,EAGjBb,EAASgB,KAAKV,GAAaW,SAG7BpB,EAAOO,GAAG,aAAcV,EAAiB,WACvCM,EAASG,SAGXN,EAAOO,GAAG,YAAa,SAASc,GAI9BlB,EAASmB,KACPC,MAAOF,EAAMG,cAAcC,QAAUJ,EAAMK,SAAWvB,EAASwB,QAAU,EAAI,GAC7EC,KAAMP,EAAMG,cAAcK,QAAUR,EAAMS,SAAW3B,EAAS4B,SAAW,UAMjF7C,OAAQC,SAAUC,UAEbA,SAASI,QAAQwC","sourcesContent":["(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], function () {\n return (root.returnExportsGlobal = factory());\n });\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like enviroments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n root['Chartist.plugins.tooltips'] = factory();\n }\n}(this, function () {\n\n /**\n * Chartist.js plugin to display a data label on top of the points in a line chart.\n *\n */\n /* global Chartist */\n (function(window, document, Chartist) {\n 'use strict';\n\n var defaultOptions = {\n currency: undefined\n // showTooltips: true,\n // tooltipEvents: ['mousemove', 'touchstart', 'touchmove'],\n // labelClass: 'ct-label',\n // labelOffset: {\n // x: 0,\n // y: -10\n // },\n // textAnchor: 'middle'\n };\n\n Chartist.plugins = Chartist.plugins || {};\n Chartist.plugins.tooltip = function(options) {\n\n options = Chartist.extend({}, defaultOptions, options);\n\n return function tooltip(chart) {\n var tooltipSelector = '.ct-point';\n if (chart instanceof Chartist.Bar) {\n tooltipSelector = '.ct-bar';\n } else if (chart instanceof Chartist.Pie) {\n tooltipSelector = '.ct-slice';\n }\n\n var $chart = $(chart.container);\n var $toolTip = $chart\n .append('
')\n .find('.chartist-tooltip')\n .hide();\n\n $chart.on('mouseenter', tooltipSelector, function() {\n var $point = $(this);\n var tooltipText = '';\n\n if (options.tooltipFnc) {\n tooltipText = options.tooltipFnc($point.attr('ct:meta') || '', $point.attr('ct:value'));\n } else {\n if ($point.attr('ct:meta')) {\n tooltipText += $point.attr('ct:meta') + '