| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 11× 11× 11× 11× 1× 11× 11× 11× 11× 1× 1× 1× 2× 2× 1× 1× 1× 15× 15× 14× 1× 15× 15× 15× 15× 1× 15× 15× 15× 15× 9× 9× 8× 1× 1× 9× 6× 3× 3× 1× 15× 15× 15× 12× 12× 12× 12× 12× 10× 5× 1× 12× 1× 9× 9× 9× 1× 8× 3× 5× 5× 3× 2× 1× 14× 14× 14× 224× 224× 224× 14× 672× 672× 672× 672× 14× 1× 1157× 1× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../../common/utils/helper", "../../common/user-interaction/tooltip"], function (require, exports, ej2_base_1, ej2_base_2, helper_1, tooltip_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AccumulationTooltip = (function (_super) { __extends(AccumulationTooltip, _super); function AccumulationTooltip(accumulation) { var _this = _super.call(this, accumulation) || this; _this.accumulation = accumulation; _this.addEventListener(); return _this; } AccumulationTooltip.prototype.addEventListener = function () { Iif (this.accumulation.isDestroyed) { return; } this.accumulation.on(ej2_base_1.Browser.isPointer ? 'pointerleave' : 'mouseleave', this.mouseLeaveHandler, this); this.accumulation.on(ej2_base_1.Browser.touchMoveEvent, this.mouseMoveHandler, this); this.accumulation.on(ej2_base_1.Browser.touchEndEvent, this.mouseUpHandler, this); }; AccumulationTooltip.prototype.mouseLeaveHandler = function (e) { this.removeTooltip(1000); }; AccumulationTooltip.prototype.mouseUpHandler = function (e) { var control = this.accumulation; if (control.tooltip.enable && control.isTouch && helper_1.withInBounds(control.mouseX, control.mouseY, control.initialClipRect)) { this.tooltip(e); this.removeTooltip(2000); } }; AccumulationTooltip.prototype.mouseMoveHandler = function (e) { var control = this.accumulation; if (control.tooltip.enable && helper_1.withInBounds(control.mouseX, control.mouseY, control.initialClipRect)) { this.tooltip(e); } }; AccumulationTooltip.prototype.tooltip = function (event) { var svgElement = this.getElement(this.element.id + '_tooltip_svg'); var isTooltip = svgElement && parseInt(svgElement.getAttribute('opacity'), 10) > 0; var tooltipDiv = this.getTooltipElement(isTooltip); this.renderSeriesTooltip(event, this.accumulation, !isTooltip, tooltipDiv); }; AccumulationTooltip.prototype.renderSeriesTooltip = function (e, chart, isFirst, tooltipDiv) { var data = this.getPieData(e, chart, chart.mouseX, chart.mouseY); var rect = chart.initialClipRect; this.currentPoints = []; if (data.point && (!this.previousPoints[0] || (this.previousPoints[0].point !== data.point))) { Eif (this.pushData(data, isFirst, tooltipDiv, false)) { if (this.triggerEvent(data, isFirst, this.getTooltipText(data, chart.tooltip))) { this.createTooltip(chart, isFirst, this.findHeader(data), data.point.symbolLocation, data.series.clipRect, data.point, ['Circle'], 0, rect, null, data.point); } else { this.removeHighlight(this.control); this.getElement(this.element.id + '_tooltip').remove(); } this.isRemove = true; } } else { if (!data.point && this.isRemove) { this.removeTooltip(1000); this.isRemove = false; } } }; AccumulationTooltip.prototype.getPieData = function (e, chart, x, y) { var target = e.target; var id = helper_1.indexFinder(target.id, true); if (!isNaN(id.series)) { var seriesIndex = id.series; var pointIndex = id.point; Eif (!ej2_base_2.isNullOrUndefined(seriesIndex) && !isNaN(seriesIndex) && !ej2_base_2.isNullOrUndefined(pointIndex) && !isNaN(pointIndex)) { var series = this.getSeriesFromIndex(seriesIndex, chart.visibleSeries); if (series.enableTooltip) { return new helper_1.AccPointData(series.points[pointIndex], series); } } } return new helper_1.AccPointData(null, null); }; AccumulationTooltip.prototype.getSeriesFromIndex = function (index, visibleSeries) { return visibleSeries[0]; }; AccumulationTooltip.prototype.getTooltipText = function (data, tooltip) { var series = data.series; var format = tooltip.format ? tooltip.format : '${point.x} : <b>${point.y}</b>'; return this.parseTemplate(data.point, series, format); }; AccumulationTooltip.prototype.findHeader = function (data) { if (this.header === '') { return ''; } this.header = this.parseTemplate(data.point, data.series, this.header); if (this.header.replace(/<b>/g, '').replace(/<\/b>/g, '').trim() !== '') { return this.header; } return ''; }; AccumulationTooltip.prototype.parseTemplate = function (point, series, format) { var value; var textValue; for (var _i = 0, _a = Object.keys(point); _i < _a.length; _i++) { var dataValue = _a[_i]; value = new RegExp('${point' + '.' + dataValue + '}', 'gm'); format = format.replace(value.source, point[dataValue]); } for (var _b = 0, _c = Object.keys(Object.getPrototypeOf(series)); _b < _c.length; _b++) { var dataValue = _c[_b]; value = new RegExp('${series' + '.' + dataValue + '}', 'gm'); textValue = series[dataValue]; format = format.replace(value.source, textValue); } return format; }; AccumulationTooltip.prototype.getModuleName = function () { return 'AccumulationTooltip'; }; AccumulationTooltip.prototype.destroy = function (chart) { }; return AccumulationTooltip; }(tooltip_1.BaseTooltip)); exports.AccumulationTooltip = AccumulationTooltip; }); |