Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium163.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : infihsqw ( 644)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /home/infihsqw/mobileking-ae.store/old/controlPanel/assets/plugins/chartist/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/infihsqw/mobileking-ae.store/old/controlPanel/assets/plugins/chartist/dist/chartist-plugin-tooltip.js
(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;

}));

ZeroDay Forums Mini