'use strict'; System.register(['d3', 'jquery', 'lodash', 'app/core/utils/kbn'], function (_export, _context) { "use strict"; var d3, $, _, kbn, _createClass, TOOLTIP_PADDING_X, TOOLTIP_PADDING_Y, StatusHeatmapTooltip; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } return { setters: [function (_d) { d3 = _d.default; }, function (_jquery) { $ = _jquery.default; }, function (_lodash) { _ = _lodash.default; }, function (_appCoreUtilsKbn) { kbn = _appCoreUtilsKbn.default; }], execute: function () { _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); TOOLTIP_PADDING_X = 30; TOOLTIP_PADDING_Y = 5; _export('StatusHeatmapTooltip', StatusHeatmapTooltip = function () { function StatusHeatmapTooltip(elem, scope) { _classCallCheck(this, StatusHeatmapTooltip); this.scope = scope; this.dashboard = scope.ctrl.dashboard; this.panelCtrl = scope.ctrl; this.panel = scope.ctrl.panel; this.heatmapPanel = elem; this.mouseOverBucket = false; this.originalFillColor = null; elem.on("mouseover", this.onMouseOver.bind(this)); elem.on("mouseleave", this.onMouseLeave.bind(this)); } _createClass(StatusHeatmapTooltip, [{ key: 'onMouseOver', value: function onMouseOver(e) { if (!this.panel.tooltip.show || !this.scope.ctrl.data || _.isEmpty(this.scope.ctrl.data)) { return; } if (!this.tooltip) { this.add(); this.move(e); } } }, { key: 'onMouseLeave', value: function onMouseLeave() { this.destroy(); } }, { key: 'onMouseMove', value: function onMouseMove(e) { if (!this.panel.tooltip.show) { return; } this.move(e); } }, { key: 'add', value: function add() { this.tooltip = d3.select("body").append("div").attr("class", "statusmap-tooltip graph-tooltip grafana-tooltip"); } }, { key: 'destroy', value: function destroy() { if (this.tooltip) { this.tooltip.remove(); } this.tooltip = null; } }, { key: 'show', value: function show(pos) { if (!this.panel.tooltip.show || !this.tooltip) { return; } // shared tooltip mode if (pos.panelRelY) { return; } var cardId = d3.select(pos.target).attr('cardId'); if (!cardId) { this.destroy(); return; } var card = this.panelCtrl.cardsData.cards[cardId]; if (!card) { this.destroy(); return; } var x = card.x; var y = card.y; var value = card.value; var values = card.values; var tooltipTimeFormat = 'YYYY-MM-DD HH:mm:ss'; var time = this.dashboard.formatDate(+x, tooltipTimeFormat); var tooltipHtml = '