Server IP : 162.0.232.140 / Your IP : 18.218.213.153 Web Server : LiteSpeed System : Linux premium139.web-hosting.com 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : micrcvoy ( 740) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/micrcvoy/public_html/controlPanel/assets/plugins/chartist/dist/ |
Upload File : |
(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define([], function () { return (root.returnExportsGlobal = factory()); }); } else if (typeof exports === 'object') { // Node. Does not work with strict CommonJS, but // only CommonJS-like enviroments that support module.exports, // like Node. module.exports = factory(); } else { root['Chartist.plugins.tooltips'] = factory(); } }(this, function () { /** * Chartist.js plugin to display a data label on top of the points in a line chart. * */ /* global Chartist */ (function(window, document, Chartist) { 'use strict'; var defaultOptions = { prefix: undefined, suffix: undefined // showTooltips: true, // tooltipEvents: ['mousemove', 'touchstart', 'touchmove'], // labelClass: 'ct-label', // labelOffset: { // x: 0, // y: -10 // }, // textAnchor: 'middle' }; Chartist.plugins = Chartist.plugins || {}; Chartist.plugins.tooltip = function(options) { options = Chartist.extend({}, defaultOptions, options); return function tooltip(chart) { var tooltipSelector = '.ct-point'; if (chart instanceof Chartist.Bar) { tooltipSelector = '.ct-bar'; } else if (chart instanceof Chartist.Pie) { tooltipSelector = '.ct-slice'; } var $chart = $(chart.container); var $toolTip = $chart .append('<div class="chartist-tooltip"></div>') .find('.chartist-tooltip') .hide(); $chart.on('mouseenter', tooltipSelector, function() { var $point = $(this); var tooltipText = ''; if ($point.attr('ct:meta')) { tooltipText += $point.attr('ct:meta') + ': '; } else { // For Pie Charts also take the labels into account // Could add support for more charts here as well! if (chart instanceof Chartist.Pie) { var label = $point.next('.ct-label'); if (label.length > 0) { tooltipText += label.text() + ': '; } } } var value = $point.attr('ct:value'); if (options.prefix !== undefined && options.prefix) { value = options.prefix + value.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,"); } tooltipText += value; if (options.suffix !== undefined && options.suffix) { tooltipText += options.suffix; } $toolTip.html(tooltipText).show(); }); $chart.on('mouseleave', tooltipSelector, function() { $toolTip.hide(); }); $chart.on('mousemove', function(event) { $toolTip.css({ left: (event.offsetX || event.originalEvent.layerX) - $toolTip.width() / 2 + 5, top: (event.offsetY || event.originalEvent.layerY) - $toolTip.height() - 10 }); }); } }; }(window, document, Chartist)); return Chartist.plugins.tooltips; }));