all files / linear-gauge/ linear-gauge.js

96.88% Statements 714/737
85.53% Branches 455/532
100% Functions 65/65
96.85% Lines 708/731
5 statements, 2 functions, 11 branches Ignored     
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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161    22× 22× 22×       163× 163× 163× 163×     44× 44× 44× 44× 44× 44× 44× 44× 44× 44× 44× 44× 44× 44×   497× 497× 497× 497× 497× 497× 497×   498×   497×   497× 497× 497×   497×   550× 550× 550×   550×   550×   550×           1021× 1021× 519×   1021×   499× 499× 16× 16× 16×   16×         16× 16× 16× 16× 16×       353× 337× 337×       16× 16×   16× 16× 16×           550× 49×   550× 72×   550× 550× 550×   498× 498× 498× 498× 498× 498×   497× 497× 497×   497× 15× 15×         497×   549× 549× 549× 549×   549× 549× 549× 549× 549×     546×   549× 549× 549× 74×   549× 530×   549×   549× 549× 549× 549×     549× 549×               549× 549× 549× 549×           549× 549× 549× 549× 549× 149× 149× 149× 149×     966× 966× 966× 966× 966× 966×   497× 497× 497× 497× 497× 497× 497× 497×   497× 497× 497× 497× 497× 497×                             469× 469× 468× 468×   468× 468×   468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468× 468×   549× 549× 549× 549× 549× 549× 549× 549× 549×       549× 549× 549× 549× 549× 549× 551× 547× 547×     549× 229× 217× 217×   217×     12× 12×   229× 229× 229×       320× 307×   307×     13× 13×   320×   320× 320×   549× 549× 63× 63× 17×   17× 17× 17×         46× 46× 46× 46×     63×     198× 198× 198× 198× 198×     196× 196× 196×   198× 198×   38× 38× 38× 38× 38× 38× 38× 38× 38×       38× 38× 38× 38× 38× 38× 38× 38×   38× 38× 38× 32×                 38× 25× 25×         38×   120× 120× 120× 120× 120× 120× 120× 120× 120× 120× 25× 25×       25× 25× 25× 25× 25× 25×   25× 25×                 25× 18×       25× 25×         95× 43× 43× 43×         52×     120×     120× 120×     120×               63× 63× 63× 63× 63× 63× 63× 63× 63× 63× 63× 63× 57× 19×       10× 10× 10×   10×       38× 38×     63× 50×   63×         23× 23× 23× 23× 23×       23×   120× 120× 27× 27× 27×     120×   40× 40× 40× 40× 40× 40× 38× 38× 38× 32×               32× 32× 32× 32× 32× 25×       40× 25× 25×   40× 40× 40×   40×   15× 15×     17× 17×   17×             221× 221× 221× 221× 221× 221×             37× 37× 37× 37× 37× 37× 34× 34× 32×       34× 34×   34× 34×   26×     18×       22× 22× 22× 22× 22× 22× 22× 22× 22×                       16× 16×   16× 10×               22× 19× 19×   22×     25× 25× 25× 25×                   25× 25×         806× 806× 806× 806× 806×   806× 805× 805× 805× 805×   805× 805× 805× 805× 805× 805× 805×   805× 805× 805× 805× 805×                               961× 961× 1117× 1117× 1277× 1277× 22× 22×     1117× 1408× 1408× 18× 18×       961×   961× 961× 961× 973× 973×     961× 150×           961× 184×           961× 19×           961× 17×           961× 19×           961× 22×           961×     149×   55× 55× 55× 55× 55× 55× 55× 61× 61×                               38× 38× 10× 10× 13× 13×                                 38× 38×     55× 55×   55× 47× 47× 47× 47× 47×                                                                                                                                                                                    
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        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 extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/* istanbul ignore next */ 
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    Iif (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) Eif (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "./model/base", "./axes/axis", "./model/constant", "./utils/helper", "./utils/helper", "./utils/helper", "./model/constant", "./axes/axis-panel", "@syncfusion/ej2-svg-base", "./axes/axis-renderer", "./annotations/annotations", "./user-interaction/tooltip", "./model/theme", "./axes/gradient"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, base_1, axis_1, constant_1, helper_1, helper_2, helper_3, constant_2, axis_panel_1, ej2_svg_base_1, axis_renderer_1, annotations_1, tooltip_1, theme_1, gradient_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var LinearGauge = (function (_super) {
        __extends(LinearGauge, _super);
        function LinearGauge(options, element) {
            var _this = _super.call(this, options, element) || this;
            _this.gradientCount = 0;
            _this.isDrag = false;
            _this.splitUpCount = 0;
            _this.allowLoadingAnimation = false;
            _this.isPointerAnimationInProgress = false;
            _this.isOverAllAnimationComplete = false;
            _this.pointerDrag = false;
            _this.isTouchPointer = false;
            _this.isCheckPointerDrag = false;
            _this.mouseX = 0;
            _this.mouseY = 0;
            _this.gaugeResized = false;
            return _this;
        }
        LinearGauge.prototype.preRender = function () {
            this.unWireEvents();
            this.isPointerAnimationInProgress = false;
            this.trigger(constant_1.load, { gauge: this });
            this.initPrivateVariable();
            this.setCulture();
            this.createSvg();
            this.wireEvents();
        };
        LinearGauge.prototype.setTheme = function () {
            this.themeStyle = theme_1.getThemeStyle(this.theme);
        };
        LinearGauge.prototype.initPrivateVariable = function () {
            if (this.element.id === '') {
                var collection = document.getElementsByClassName('e-lineargauge').length;
                this.element.id = 'lineargauge_' + 'control_' + collection;
            }
            this.renderer = new ej2_svg_base_1.SvgRenderer(this.element.id);
            this.gaugeAxisLayoutPanel = new axis_panel_1.AxisLayoutPanel(this);
            this.axisRenderer = new axis_renderer_1.AxisRenderer(this);
        };
        LinearGauge.prototype.setCulture = function () {
            this.intl = new ej2_base_1.Internationalization();
        };
        LinearGauge.prototype.createSvg = function () {
            this.removeSvg();
            this.calculateSize();
            if (ej2_base_3.isNullOrUndefined(this.renderer)) {
                this.renderer = new ej2_svg_base_1.SvgRenderer(this.element.id);
            }
            if (ej2_base_3.isNullOrUndefined(this.gaugeAxisLayoutPanel)) {
                this.gaugeAxisLayoutPanel = new axis_panel_1.AxisLayoutPanel(this);
            }
            if (ej2_base_3.isNullOrUndefined(this.axisRenderer)) {
                this.axisRenderer = new axis_renderer_1.AxisRenderer(this);
            }
            this.svgObject = this.renderer.createSvg({
                id: this.element.id + '_svg',
                width: this.availableSize.width,
                height: this.availableSize.height
            });
        };
        LinearGauge.prototype.removeSvg = function () {
            helper_1.removeElement(this.element.id + '_Secondary_Element');
            if (!(ej2_base_3.isNullOrUndefined(this.svgObject)) && !ej2_base_3.isNullOrUndefined(this.svgObject.parentNode)) {
                ej2_base_3.remove(this.svgObject);
            }
            this.clearTemplate();
        };
        LinearGauge.prototype.renderAnimation = function () {
            var _this = this;
            if (this.allowLoadingAnimation) {
                var element = document.getElementById(this.element.id + '_RangesGroup_0');
                this.axisElementAnimate(element);
                if (this.styleRemove) {
                    clearTimeout(this.styleRemove);
                }
                this.styleRemove = setTimeout(function () {
                    var styleElement = document.querySelectorAll('style.' + _this.element.id + 'animation');
                    if (styleElement.length > 0) {
                        styleElement[0].remove();
                    }
                }, (this.animationDuration === 0 && ej2_base_1.animationMode === 'Enable') ? 1000 : this.animationDuration);
            }
        };
        LinearGauge.prototype.axisElementAnimate = function (element) {
            var _this = this;
            var tempOpacity = 0;
            var opacity = 1;
            var elements = document.querySelectorAll('style.' + this.element.id + 'animation');
            new ej2_base_3.Animation({}).animate(element, {
                duration: (this.animationDuration === 0 && ej2_base_1.animationMode === 'Enable') ? 1000 : this.animationDuration > 0 ?
                    this.animationDuration / this.splitUpCount : 0,
                progress: function (args) {
                    if (args.timeStamp > args.delay) {
                        tempOpacity = ((args.timeStamp - args.delay) / args.duration);
                        elements[0].innerHTML = '.' + _this.element.id + 'animation' + '{opacity:' + (opacity * tempOpacity) + '}';
                    }
                },
                end: function () {
                    Eif (!ej2_base_3.isNullOrUndefined(elements) && elements.length !== 0) {
                        elements[0].innerHTML = '.' + _this.element.id + 'animation' + '{opacity: 1}';
                    }
                    for (var i = 0; i < _this.axes.length; i++) {
                        _this.axisRenderer.pointerAnimation(_this.axes[i], i);
                        if ((_this.axes.length - 1) === 0 && _this.axes[i].pointers.length === 0) {
                            _this.isOverAllAnimationComplete = true;
                        }
                    }
                }
            });
        };
        LinearGauge.prototype.calculateSize = function () {
            if (!ej2_base_3.isNullOrUndefined(this.height)) {
                this.element.style.height = this.height;
            }
            if (!ej2_base_3.isNullOrUndefined(this.width)) {
                this.element.style.width = this.width;
            }
            var width = helper_1.stringToNumberSize(this.width, this.element.offsetWidth) || this.element.offsetWidth || 600;
            var height = helper_1.stringToNumberSize(this.height, this.element.offsetHeight) || this.element.offsetHeight || 450;
            this.availableSize = new helper_1.Size(width, height);
        };
        LinearGauge.prototype.renderElements = function () {
            this.setTheme();
            this.renderGaugeElements();
            this.calculateBounds();
            this.renderAxisElements();
            this.renderAnimation();
            this.renderComplete();
        };
        LinearGauge.prototype.render = function () {
            this.isPropertyChange = false;
            this.isCheckPointerDrag = false;
            this.allowLoadingAnimation = ((this.animationDuration === 0 && ej2_base_1.animationMode === 'Enable') || this.animationDuration > 0)
                && !this.isOverAllAnimationComplete;
            if (this.allowLoadingAnimation) {
                var styleClass = document.getElementsByClassName(this.element.id + 'animation');
                if (styleClass.length === 0) {
                    var styleClass_1 = ej2_base_3.createElement('style', {
                        className: this.element.id + 'animation'
                    });
                    styleClass_1.innerText = '.' + this.element.id + 'animation' + '{opacity: 0}';
                    document.body.appendChild(styleClass_1);
                }
            }
            this.renderElements();
        };
        LinearGauge.prototype.renderGaugeElements = function () {
            this.appendSecondaryElement();
            this.renderBorder();
            this.renderTitle();
            this.renderContainer();
        };
        LinearGauge.prototype.appendSecondaryElement = function () {
            Eif (ej2_base_3.isNullOrUndefined(helper_1.getElement(this.element.id + '_Secondary_Element'))) {
                var secondaryElement = ej2_base_3.createElement('div');
                secondaryElement.id = this.element.id + '_Secondary_Element';
                secondaryElement.style.position = 'relative';
                this.element.appendChild(secondaryElement);
            }
        };
        LinearGauge.prototype.calculateBounds = function () {
            this.gaugeAxisLayoutPanel.calculateAxesBounds();
        };
        LinearGauge.prototype.renderAxisElements = function () {
            this.axisRenderer.renderAxes();
            this.element.appendChild(this.svgObject);
            if (this.annotationsModule) {
                this.annotationsModule.renderAnnotationElements(this);
            }
            if (!this.isCheckPointerDrag) {
                this.trigger(constant_1.loaded, { gauge: this });
            }
            helper_1.removeElement('gauge-measuretext');
        };
        LinearGauge.prototype.renderBorder = function () {
            var width = this.border.width;
            Eif (width > 0 || (this.background || this.themeStyle.backgroundColor)) {
                var rect = new helper_2.RectOption(this.element.id + '_LinearGaugeBorder', this.background || this.themeStyle.backgroundColor, this.border, 1, new helper_2.Rect(width / 2, width / 2, this.availableSize.width - width, this.availableSize.height - width));
                this.svgObject.appendChild(this.renderer.drawRectangle(rect));
            }
        };
        LinearGauge.prototype.renderTitle = function () {
            var width = (this.availableSize.width - this.margin.left - this.margin.right);
            var style = {
                size: this.titleStyle.size || this.themeStyle.titleFontSize,
                color: this.titleStyle.color,
                fontFamily: this.titleStyle.fontFamily || this.themeStyle.fontFamily,
                fontWeight: this.titleStyle.fontWeight || this.themeStyle.titleFontWeight,
                fontStyle: this.titleStyle.fontStyle || this.themeStyle.titleFontStyle,
                opacity: this.titleStyle.opacity
            };
            var trimmedTitle = helper_3.textTrim(width, this.title, style);
            var size = helper_2.measureText(trimmedTitle, style);
            var options = new helper_2.TextOption(this.element.id + '_LinearGaugeTitle', this.availableSize.width / 2, this.margin.top + (size.height / 2), 'middle', trimmedTitle);
            var titleBounds = {
                x: options.x - (size.width / 2),
                y: options.y,
                width: size.width,
                height: size.height
            };
            var x = this.margin.left;
            var y = titleBounds.y;
            var height = (this.availableSize.height - y - this.margin.bottom);
            this.actualRect = { x: x, y: y, width: width, height: height };
            if (this.title) {
                var element = helper_2.textElement(options, style, style.color || this.themeStyle.titleFontColor, null, this.svgObject);
                element.setAttribute('aria-label', this.description || this.title);
                element.setAttribute('role', 'region');
                element.setAttribute('tabindex', this.tabIndex.toString());
            }
        };
        LinearGauge.prototype.unWireEvents = function () {
            ej2_base_3.EventHandler.remove(this.element, ej2_base_2.Browser.touchStartEvent, this.gaugeOnMouseDown);
            ej2_base_3.EventHandler.remove(this.element, ej2_base_2.Browser.touchMoveEvent, this.mouseMove);
            ej2_base_3.EventHandler.remove(this.element, ej2_base_2.Browser.touchEndEvent, this.mouseEnd);
            ej2_base_3.EventHandler.remove(this.element, 'contextmenu', this.gaugeRightClick);
            ej2_base_3.EventHandler.remove(this.element, (ej2_base_2.Browser.isPointer ? 'pointerleave' : 'mouseleave'), this.mouseLeave);
            window.removeEventListener((ej2_base_2.Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeEvent);
        };
        LinearGauge.prototype.wireEvents = function () {
            ej2_base_3.EventHandler.add(this.element, ej2_base_2.Browser.touchStartEvent, this.gaugeOnMouseDown, this);
            ej2_base_3.EventHandler.add(this.element, ej2_base_2.Browser.touchMoveEvent, this.mouseMove, this);
            ej2_base_3.EventHandler.add(this.element, ej2_base_2.Browser.touchEndEvent, this.mouseEnd, this);
            ej2_base_3.EventHandler.add(this.element, 'contextmenu', this.gaugeRightClick, this);
            ej2_base_3.EventHandler.add(this.element, (ej2_base_2.Browser.isPointer ? 'pointerleave' : 'mouseleave'), this.mouseLeave, this);
            this.resizeEvent = this.gaugeResize.bind(this);
            ej2_base_3.EventHandler.add(window, (ej2_base_2.Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeEvent);
            this.setStyle(this.element);
        };
        LinearGauge.prototype.setStyle = function (element) {
            element.style.touchAction = 'element';
            element.style.msTouchAction = 'element';
            element.style.msContentZooming = 'none';
            element.style.msUserSelect = 'none';
            element.style.webkitUserSelect = 'none';
            element.style.position = 'relative';
        };
        LinearGauge.prototype.gaugeResize = function () {
            var _this = this;
            Eif (!this.isDestroyed) {
                var args = {
                    gauge: this,
                    previousSize: new helper_1.Size(this.availableSize.width, this.availableSize.height),
                    name: constant_1.resized,
                    currentSize: new helper_1.Size(0, 0),
                    cancel: false
                };
                var currentSize = this.element.getBoundingClientRect();
                args.currentSize = new helper_1.Size(currentSize.width, currentSize.height);
                this.trigger(constant_1.resized, args);
                Eif (!args.cancel) {
                    Iif (this.resizeTo) {
                        clearTimeout(this.resizeTo);
                    }
                    Eif (!ej2_base_3.isNullOrUndefined(this.element) && this.element.classList.contains('e-lineargauge')) {
                        this.resizeTo = window.setTimeout(function () {
                            _this.gaugeResized = true;
                            _this.createSvg();
                            _this.allowLoadingAnimation = false;
                            _this.renderElements();
                        }, 500);
                    }
                }
            }
            return false;
        };
        LinearGauge.prototype.destroy = function () {
            this.unWireEvents();
            _super.prototype.destroy.call(this);
            Eif (!ej2_base_3.isNullOrUndefined(this.gaugeAxisLayoutPanel)) {
                this.gaugeAxisLayoutPanel.destroy();
            }
            Eif (!ej2_base_3.isNullOrUndefined(this.axisRenderer)) {
                this.axisRenderer.destroy();
            }
            this.gaugeAxisLayoutPanel = null;
            this.axisRenderer = null;
            this.activePointer = null;
            this.activeAxis = null;
            this.actualRect = null;
            this.containerObject = null;
            this.containerBounds = null;
            this.availableSize = null;
            this.mouseElement = null;
            this.nearSizes = [];
            this.farSizes = [];
            this.themeStyle = null;
            this.intl = null;
            this.removeSvg();
            this.resizeEvent = null;
            this.svgObject = null;
            this.renderer = null;
        };
        LinearGauge.prototype.renderContainer = function () {
            var width;
            var height;
            var x;
            var y;
            var options;
            var labelPadding = 20;
            var extraPadding = 30;
            var path = '';
            var fill = (this.container.backgroundColor !== 'transparent'
                || (this.theme !== 'Bootstrap4' && this.theme !== 'Material' && this.theme !== 'Material3' && this.theme !== 'Material3Dark'
                    && this.theme !== 'Fluent2' && this.theme !== 'Fluent2Dark' && this.theme !== 'Bootstrap5' && this.theme !== 'Bootstrap5Dark'))
                ? this.container.backgroundColor : this.themeStyle.containerBackground;
            var rect;
            var radius = this.container.width;
            var bottomRadius = radius + ((radius / 2) / Math.PI);
            var topRadius = radius / 2;
            var allowContainerRender = false;
            for (var i = 0; i < this.axes.length; i++) {
                if (this.axes[i].minimum !== this.axes[i].maximum) {
                    allowContainerRender = true;
                    break;
                }
            }
            if (this.orientation === 'Vertical') {
                if (this.allowMargin) {
                    height = this.actualRect.height;
                    height = (this.container.height > 0) ? this.container.height :
                        ((height / 2) - ((height / 2) / 4)) * 2;
                    height = (this.container.type === 'Thermometer') ? height - (bottomRadius * 2) - topRadius : height;
                }
                else {
                    height = this.actualRect.height - labelPadding - extraPadding;
                    height = (this.container.type === 'Thermometer') ? (radius !== 0) ? (this.actualRect.height - (bottomRadius * 2) - topRadius - extraPadding) : height : height;
                }
                width = this.container.width;
                x = (this.actualRect.x + ((this.actualRect.width / 2) - (this.container.width / 2))) + this.container.offset;
                y = this.actualRect.y + ((this.actualRect.height / 2) - ((this.container.type === 'Thermometer') ?
                    ((height + (bottomRadius * 2) - topRadius)) / 2 : height / 2));
            }
            else {
                if (this.allowMargin) {
                    width = (this.container.height > 0) ? this.container.height :
                        ((this.actualRect.width / 2) - ((this.actualRect.width / 2) / 4)) * 2;
                    width = (this.container.type === 'Thermometer') ? width - (bottomRadius * 2) - topRadius : width;
                }
                else {
                    width = this.actualRect.width - labelPadding;
                    width = (this.container.type === 'Thermometer') ? (this.actualRect.width - (bottomRadius * 2) - topRadius) : width;
                }
                x = this.actualRect.x + ((this.actualRect.width / 2) - ((this.container.type === 'Thermometer') ?
                    (width - (bottomRadius * 2) + topRadius) / 2 : width / 2));
                y = (this.actualRect.y + ((this.actualRect.height / 2) - (this.container.width / 2))) + this.container.offset;
                height = this.container.width;
            }
            this.containerBounds = (!allowContainerRender) ? { x: 0, y: 0, width: 0, height: 0 } : { x: x, y: y, width: width, height: height };
            if ((this.containerBounds.width > 0 && this.orientation === 'Vertical') || (this.containerBounds.height > 0 && this.orientation === 'Horizontal')) {
                this.containerObject = this.renderer.createGroup({ id: this.element.id + '_Container_Group', transform: 'translate( 0, 0)' });
                if (this.container.type === 'Normal') {
                    var containerBorder = { color: this.container.border.color || this.themeStyle.containerBorderColor,
                        width: this.container.border.width, dashArray: this.container.border.dashArray };
                    rect = new helper_2.RectOption(this.element.id + '_' + this.container.type + '_Layout', fill, containerBorder, 1, new helper_2.Rect(x, y, width, height));
                    this.containerObject.appendChild(this.renderer.drawRectangle(rect));
                    Iif (this.allowLoadingAnimation) {
                        this.containerObject.classList.add(this.element.id + 'animation');
                    }
                }
                else {
                    path = helper_3.getBox(this.containerBounds, this.container.type, this.orientation, new helper_1.Size(this.container.height, this.container.width), 'container', null, null, this.container.roundedCornerRadius);
                    options = new helper_2.PathOption(this.element.id + '_' + this.container.type + '_Layout', fill, this.container.border.width, this.container.border.color || this.themeStyle.containerBorderColor, 1, this.container.border.dashArray, path);
                    this.containerObject.appendChild(this.renderer.drawPath(options));
                    if (this.allowLoadingAnimation) {
                        this.containerObject.classList.add(this.element.id + 'animation');
                    }
                }
                this.svgObject.appendChild(this.containerObject);
            }
        };
        LinearGauge.prototype.setMouseXY = function (e) {
            var pageX;
            var pageY;
            var svgRect = helper_1.getElement(this.element.id + '_svg').getBoundingClientRect();
            var rect = this.element.getBoundingClientRect();
            if (e.type.indexOf('touch') > -1) {
                this.isTouch = true;
                var touchArg = e;
                pageY = touchArg.changedTouches[0].clientY;
                pageX = touchArg.changedTouches[0].clientX;
            }
            else {
                this.isTouch = e.pointerType === 'touch' || e.pointerType === '2';
                pageX = e.clientX;
                pageY = e.clientY;
            }
            this.mouseY = (pageY - rect.top) - Math.max(svgRect.top - rect.top, 0);
            this.mouseX = (pageX - rect.left) - Math.max(svgRect.left - rect.left, 0);
        };
        LinearGauge.prototype.gaugeOnMouseDown = function (e) {
            var _this = this;
            var current;
            var currentPointer;
            this.setMouseXY(e);
            var args = this.getMouseArgs(e, 'touchstart', constant_1.gaugeMouseDown);
            this.trigger(constant_1.gaugeMouseDown, args, function () {
                _this.mouseX = args.x;
                _this.mouseY = args.y;
                Iif (_this.isTouch) {
                    e.preventDefault();
                    _this.isTouchPointer = true;
                }
                Eif (args.target) {
                    Eif (!args.cancel && ((args.target.id.indexOf('MarkerPointer') > -1) || (args.target.id.indexOf('BarPointer') > -1))) {
                        _this.isOverAllAnimationComplete = true;
                        current = _this.moveOnPointer(args.target);
                        currentPointer = helper_3.getPointer(args.target, _this);
                        _this.activeAxis = _this.axes[currentPointer.axisIndex];
                        _this.activePointer = _this.activeAxis.pointers[currentPointer.pointerIndex];
                        if (ej2_base_3.isNullOrUndefined(_this.activePointer.pathElement)) {
                            _this.activePointer.pathElement = [e.target];
                        }
                        var pointInd = parseInt(_this.activePointer.pathElement[0].id.slice(-1), 10);
                        var axisInd = parseInt(_this.activePointer.pathElement[0].id.match(/\d/g)[0], 10);
                        if (currentPointer.pointer.enableDrag) {
                            _this.trigger(constant_2.dragStart, {
                                axis: _this.activeAxis,
                                name: constant_2.dragStart,
                                pointer: _this.activePointer,
                                currentValue: _this.activePointer.currentValue,
                                pointerIndex: pointInd,
                                axisIndex: axisInd
                            });
                        }
                        if (!ej2_base_3.isNullOrUndefined(current) && current.pointer) {
                            _this.pointerDrag = true;
                            _this.mouseElement = args.target;
                        }
                    }
                }
            });
            return false;
        };
        LinearGauge.prototype.mouseMove = function (e) {
            var _this = this;
            var current;
            this.setMouseXY(e);
            var args = this.getMouseArgs(e, 'touchmove', constant_1.gaugeMouseMove);
            this.trigger(constant_1.gaugeMouseMove, args, function () {
                _this.mouseX = args.x;
                _this.mouseY = args.y;
                var dragArgs;
                Eif (args.target && !args.cancel) {
                    if (_this.pointerDrag && _this.activePointer) {
                        Eif (!ej2_base_3.isNullOrUndefined(_this.activePointer.pathElement)) {
                            Iif (_this.isTouch) {
                                _this.isTouchPointer = true;
                                e.preventDefault();
                            }
                            var pointerIndex = parseInt(_this.activePointer.pathElement[0].id.slice(-1), 10);
                            var axisIndex = parseInt(_this.activePointer.pathElement[0].id.split('AxisIndex_')[1].match(/\d/g)[0], 10);
                            Eif (_this.axes[axisIndex].pointers[pointerIndex].enableDrag) {
                                current = _this.moveOnPointer(_this.activePointer.pathElement[0]);
                                Eif (!(ej2_base_3.isNullOrUndefined(current)) && current.pointer) {
                                    _this.element.style.cursor = current.style;
                                }
                                _this.isDrag = _this.isCheckPointerDrag = true;
                                dragArgs = {
                                    axis: _this.activeAxis,
                                    pointer: _this.activePointer,
                                    previousValue: _this.activePointer.currentValue,
                                    name: constant_2.dragMove,
                                    currentValue: null,
                                    axisIndex: axisIndex,
                                    pointerIndex: pointerIndex
                                };
                                if (_this.activePointer.pathElement[0].id.indexOf('MarkerPointer') > -1) {
                                    _this.markerDrag(_this.activeAxis, (_this.activeAxis.pointers[pointerIndex]));
                                }
                                else {
                                    _this.barDrag(_this.activeAxis, (_this.activeAxis.pointers[pointerIndex]));
                                }
                                dragArgs.currentValue = _this.activePointer.currentValue;
                                _this.trigger(constant_2.dragMove, dragArgs);
                            }
                        }
                    }
                    else {
                        if (args.target.id.indexOf('Pointer') > -1 && ej2_base_3.isNullOrUndefined(_this.activePointer)) {
                            var pointerIndex = parseInt(args.target.id.split('Pointer_')[1], 10);
                            var axisIndex = parseInt(args.target.id.split('AxisIndex_')[1].match(/\d/g)[0], 10);
                            Iif (_this.axes[axisIndex].pointers[pointerIndex].enableDrag) {
                                _this.element.style.cursor = 'pointer';
                            }
                        }
                        else {
                            _this.element.style.cursor = (_this.pointerDrag) ? _this.element.style.cursor : 'auto';
                        }
                    }
                    _this.gaugeOnMouseMove();
                }
            });
            this.notify(ej2_base_2.Browser.touchMoveEvent, e);
            Iif ((!ej2_base_3.isNullOrUndefined(args.target) && args.target.id === (this.element.id + '_LinearGaugeTitle')) || document.getElementById(this.element.id + '_EJ2_Title_Tooltip')) {
                this.titleTooltip(e, false);
            }
            return false;
        };
        LinearGauge.prototype.titleTooltip = function (event, isTitleTouch) {
            var targetId = event.target.id;
            Eif ((targetId === (this.element.id + '_LinearGaugeTitle')) && (event.target.textContent.indexOf('...') > -1)) {
                clearTimeout(this.tooltipTimeout);
                helper_3.showTooltip(this.title, this);
                Eif (isTitleTouch) {
                    this.tooltipTimeout = setTimeout(helper_3.removeTooltip.bind(this), 2000);
                }
            }
            else {
                helper_1.removeElement(this.element.id + '_EJ2_Title_Tooltip');
            }
        };
        LinearGauge.prototype.moveOnPointer = function (element) {
            var clientRect = this.element.getBoundingClientRect();
            var isPointer = false;
            var top;
            var left;
            var pointerElement = helper_1.getElement(element.id);
            var svgPath = pointerElement;
            var cursorStyle;
            var process;
            var current = helper_3.getPointer(element, this);
            var axis = current.axis;
            var pointer = current.pointer;
            if (pointer.enableDrag) {
                if (pointer.type === 'Bar') {
                    if (this.orientation === 'Vertical') {
                        top = pointerElement.getBoundingClientRect().top - clientRect.top;
                        top = (!axis.isInversed) ? top : top + svgPath.getBBox().height;
                        isPointer = !axis.isInversed ? (this.mouseY < (top + 10) && this.mouseY >= top) :
                            (this.mouseY <= top && this.mouseY > (top - 10));
                        cursorStyle = 'grabbing';
                    }
                    else {
                        left = pointerElement.getBoundingClientRect().left - clientRect.left;
                        left = (!axis.isInversed) ? left + svgPath.getBBox().width : left;
                        isPointer = !axis.isInversed ? (this.mouseX > (left - 10) && this.mouseX <= left) :
                            (this.mouseX >= left && this.mouseX < (left + 10));
                        cursorStyle = 'grabbing';
                    }
                }
                else {
                    isPointer = true;
                    cursorStyle = 'grabbing';
                }
            }
            if (isPointer) {
                process = { pointer: isPointer, style: cursorStyle };
            }
            return process;
        };
        LinearGauge.prototype.gaugeRightClick = function (event) {
            Eif (event.buttons === 2 || event.pointerType === 'touch') {
                event.preventDefault();
                event.stopPropagation();
                return false;
            }
            return true;
        };
        LinearGauge.prototype.mouseLeave = function (e) {
            this.activeAxis = null;
            this.activePointer = null;
            var args = this.getMouseArgs(e, 'touchmove', constant_1.gaugeMouseLeave);
            this.trigger(constant_1.gaugeMouseLeave, args);
            Iif (!ej2_base_3.isNullOrUndefined(this.mouseElement)) {
                this.mouseElement = null;
                this.pointerDrag = false;
            }
            return false;
        };
        LinearGauge.prototype.gaugeOnMouseMove = function () {
            var current;
            if (this.pointerDrag) {
                current = helper_3.getPointer(this.mouseElement, this);
                Eif (current.pointer.enableDrag && current.pointer.animationComplete) {
                    this[current.pointer.type.toLowerCase() + 'Drag'](current.axis, current.pointer);
                }
            }
            return true;
        };
        LinearGauge.prototype.mouseEnd = function (e) {
            this.isTouchPointer = false;
            this.setMouseXY(e);
            var isImage = ej2_base_3.isNullOrUndefined(this.activePointer) ? false : this.activePointer.markerType === 'Image';
            var args = this.getMouseArgs(e, 'touchend', constant_1.gaugeMouseUp);
            this.trigger(constant_1.gaugeMouseUp, args);
            if (this.activeAxis && this.activePointer) {
                var pointerInd = parseInt(this.activePointer.pathElement[0].id.slice(-1), 10);
                var axisInd = parseInt(this.activePointer.pathElement[0].id.split('_AxisIndex_')[1], 10);
                if (this.activePointer.enableDrag) {
                    this.trigger(constant_2.dragEnd, {
                        name: constant_2.dragEnd,
                        axis: this.activeAxis,
                        pointer: this.activePointer,
                        currentValue: this.activePointer.currentValue,
                        axisIndex: axisInd,
                        pointerIndex: pointerInd
                    });
                    this.axes[axisInd].pointers[pointerInd].value = this.activePointer.currentValue;
                    this.activeAxis = null;
                    this.activePointer = null;
                    this.isDrag = false;
                    if (!ej2_base_3.isNullOrUndefined(this.mouseElement && !isImage)) {
                        this.triggerDragEvent(this.mouseElement);
                    }
                }
            }
            if (!ej2_base_3.isNullOrUndefined(this.mouseElement)) {
                this.mouseElement = null;
                this.pointerDrag = false;
            }
            this.element.style.cursor = 'auto';
            this.notify(ej2_base_2.Browser.touchEndEvent, e);
            if (args.target.id === (this.element.id + '_LinearGaugeTitle') || document.getElementById(this.element.id + '_EJ2_Title_Tooltip')) {
                this.titleTooltip(e, true);
            }
            return true;
        };
        LinearGauge.prototype.print = function (id) {
            Eif ((this.allowPrint) && (this.printModule)) {
                this.printModule.print(this, id);
            }
        };
        LinearGauge.prototype.export = function (type, fileName, orientation, allowDownload) {
            var _this = this;
            if (ej2_base_3.isNullOrUndefined(allowDownload)) {
                allowDownload = true;
            }
            if ((type !== 'PDF') && (this.allowImageExport) && (this.imageExportModule)) {
                return new Promise(function (resolve, reject) {
                    resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
                });
            }
            else Eif ((this.allowPdfExport) && (this.pdfExportModule)) {
                return new Promise(function (resolve, reject) {
                    resolve(_this.pdfExportModule.export(_this, type, fileName, orientation, allowDownload));
                });
            }
            return null;
        };
        LinearGauge.prototype.getMouseArgs = function (e, type, name) {
            var rect = this.element.getBoundingClientRect();
            var location = new helper_2.GaugeLocation(-rect.left, -rect.top);
            var isTouch = (e.type === type);
            location.x += isTouch ? e.changedTouches[0].clientX : e.clientX;
            location.y += isTouch ? e.changedTouches[0].clientY : e.clientY;
            return {
                cancel: false, name: name,
                model: this,
                x: location.x, y: location.y,
                target: isTouch ? e.target : e.target
            };
        };
        LinearGauge.prototype.markerDrag = function (axis, pointer) {
            var options;
            var textOptions;
            var x;
            var y;
            var value = helper_3.convertPixelToValue(this.element, this.mouseElement, this.orientation, axis, 'drag', new helper_2.GaugeLocation(this.mouseX, this.mouseY));
            if (helper_3.withInRange(value, null, null, axis.visibleRange.max, axis.visibleRange.min, 'pointer')) {
                options = new helper_2.PathOption('pointerID', pointer.color || this.themeStyle.pointerColor, pointer.border.width, pointer.border.color, pointer.opacity, pointer.border.dashArray, null, '');
                if (this.orientation === 'Vertical') {
                    pointer.bounds.y = this.mouseY;
                }
                else {
                    pointer.bounds.x = this.mouseX + helper_1.getExtraWidth(this.element);
                }
                pointer.currentValue = this.isTouch ? (pointer.startValue = value) : (pointer.value = value);
                if (pointer.markerType === 'Text') {
                    textOptions = new helper_2.TextOption('pointerID', x, y, 'middle', pointer.text, null, 'auto');
                    textOptions = helper_1.calculateTextPosition(pointer.bounds, pointer.markerType, textOptions, this.orientation, axis, pointer);
                }
                options = helper_1.calculateShapes(pointer.bounds, pointer.markerType, new helper_1.Size(pointer.width, pointer.height), pointer.imageUrl, options, this.orientation, axis, pointer);
                if (pointer.markerType === 'Image' || pointer.markerType === 'Text') {
                    this.mouseElement.setAttribute('x', (pointer.markerType === 'Text' ? textOptions.x : pointer.bounds.x - (pointer.bounds.width / 2)).toString());
                    this.mouseElement.setAttribute('y', (pointer.markerType === 'Text' ? textOptions.y : pointer.bounds.y - (pointer.bounds.height / 2)).toString());
                }
                else if (pointer.markerType === 'Circle') {
                    this.mouseElement.setAttribute('cx', (options.cx).toString());
                    this.mouseElement.setAttribute('cy', (options.cy).toString());
                    this.mouseElement.setAttribute('r', (options.r).toString());
                }
                else {
                    this.mouseElement.setAttribute('d', options.d);
                }
            }
        };
        LinearGauge.prototype.barDrag = function (axis, pointer) {
            var line = axis.lineBounds;
            var range = axis.visibleRange;
            var isDrag;
            var lineHeight = (this.orientation === 'Vertical') ? line.height : line.width;
            var lineY = (this.orientation === 'Vertical') ? line.y : line.x;
            var path;
            var value1 = ((helper_1.valueToCoefficient(range.min, axis, this.orientation, range) * lineHeight) + lineY);
            var value2 = ((helper_1.valueToCoefficient(range.max, axis, this.orientation, range) * lineHeight) + lineY);
            if (this.orientation === 'Vertical') {
                isDrag = (!axis.isInversed) ? (this.mouseY > value2 && this.mouseY < value1) : (this.mouseY > value1 && this.mouseY < value2);
                Eif (isDrag) {
                    Eif ((this.container.type === 'Normal' || this.container.width === 0) && !ej2_base_3.isNullOrUndefined(this.mouseElement)) {
                        Eif (!axis.isInversed) {
                            this.mouseElement.setAttribute('y', this.mouseY.toString());
                        }
                        this.mouseElement.setAttribute('height', Math.abs(value1 - this.mouseY).toString());
                    }
                    else {
                        if (!axis.isInversed) {
                            pointer.bounds.y = this.mouseY;
                        }
                        pointer.bounds.height = Math.abs(value1 - this.mouseY);
                    }
                }
            }
            else {
                var extraWidth = helper_1.getExtraWidth(this.element);
                isDrag = (!axis.isInversed) ? (this.mouseX + extraWidth > value1 && this.mouseX + extraWidth < value2) :
                    (this.mouseX + extraWidth > value2 && this.mouseX + extraWidth < value1);
                if (isDrag) {
                    if ((this.container.type === 'Normal' || this.container.width === 0) && !ej2_base_3.isNullOrUndefined(this.mouseElement)) {
                        if (axis.isInversed) {
                            this.mouseElement.setAttribute('x', (this.mouseX + extraWidth).toString());
                        }
                        this.mouseElement.setAttribute('width', Math.abs(value1 - (this.mouseX + extraWidth)).toString());
                    }
                    else {
                        Eif (axis.isInversed) {
                            pointer.bounds.x = this.mouseX + extraWidth;
                        }
                        pointer.bounds.width = Math.abs(value1 - (this.mouseX + extraWidth));
                    }
                }
            }
            if (!ej2_base_3.isNullOrUndefined(this.mouseElement)) {
                var value = helper_3.convertPixelToValue(this.element, this.mouseElement, this.orientation, axis, 'drag', new helper_2.GaugeLocation(this.mouseX, this.mouseY));
                pointer.currentValue = this.isTouch ? (pointer.startValue = value) : (pointer.value = value);
            }
            if (isDrag && !ej2_base_3.isNullOrUndefined(this.mouseElement) && this.mouseElement.tagName === 'path') {
                path = helper_3.getBox(pointer.bounds, this.container.type, this.orientation, new helper_1.Size(pointer.bounds.width, pointer.bounds.height), 'bar', this.container.width, axis, pointer.roundedCornerRadius);
                this.mouseElement.setAttribute('d', path);
            }
        };
        LinearGauge.prototype.triggerDragEvent = function (activeElement) {
            var _this = this;
            var active = helper_3.getPointer(activeElement, this);
            var value = helper_3.convertPixelToValue(this.element, activeElement, this.orientation, active.axis, 'tooltip', null);
            var dragArgs = {
                name: 'valueChange',
                gauge: this,
                element: activeElement,
                axisIndex: active.axisIndex,
                axis: active.axis,
                pointerIndex: active.pointerIndex,
                pointer: active.pointer,
                value: value
            };
            this.trigger(constant_1.valueChange, dragArgs, function (pointerArgs) {
                Iif (value !== pointerArgs.value) {
                    _this.setPointerValue(pointerArgs.axisIndex, pointerArgs.pointerIndex, pointerArgs.value);
                }
            });
        };
        LinearGauge.prototype.setPointerValue = function (axisIndex, pointerIndex, value) {
            Eif (!this.isDestroyed) {
                var axis = this.axes[axisIndex];
                var pointer = axis.pointers[pointerIndex];
                this.gaugeResized = false;
                if (this.allowLoadingAnimation) {
                    this.allowLoadingAnimation = false;
                    this.createSvg();
                    this.renderGaugeElements();
                    this.calculateBounds();
                    this.renderAxisElements();
                }
                if (pointer.startValue !== value) {
                    this.isPointerAnimationInProgress = false;
                    var id = this.element.id + '_AxisIndex_' + axisIndex + '_' + pointer.type + 'Pointer_' + pointerIndex;
                    var pointerElement = helper_1.getElement(id);
                    value = (value < axis.visibleRange.min) ? axis.visibleRange.min : ((value > axis.visibleRange.max) ?
                        axis.visibleRange.max : value);
                    pointer.currentValue = value;
                    pointer.isPointerAnimation = true;
                    this.isPropertyChange = true;
                    Eif ((pointerElement !== null) && helper_3.withInRange(pointer.currentValue, null, null, axis.visibleRange.max, axis.visibleRange.min, 'pointer')) {
                        pointer.value = this.pointerDrag ? this.isTouch ? pointer.startValue : value : pointer.value;
                        this.gaugeAxisLayoutPanel['calculate' + pointer.type + 'Bounds'](axis, pointer);
                        this.axisRenderer['draw' + pointer.type + 'Pointer'](axis, axisIndex, pointer, pointerIndex, pointerElement.parentElement);
                    }
                    this.isProtectedOnChange = true;
                    pointer.startValue = pointer.currentValue;
                    pointer.currentValue = value;
                    pointer.value = value;
                    this.isProtectedOnChange = false;
                }
            }
        };
        LinearGauge.prototype.setAnnotationValue = function (annotationIndex, content, axisValue) {
            Eif (!this.isDestroyed) {
                var elementExist = helper_1.getElement(this.element.id + '_Annotation_' + annotationIndex) === null;
                var element = helper_1.getElement(this.element.id + '_AnnotationsGroup') ||
                    ej2_base_3.createElement('div', {
                        id: this.element.id + '_AnnotationsGroup'
                    });
                var annotation = this.annotations[annotationIndex];
                Eif (content !== null) {
                    helper_1.removeElement(this.element.id + '_Annotation_' + annotationIndex);
                    annotation.content = content;
                    annotation.axisValue = !ej2_base_3.isNullOrUndefined(axisValue) ? axisValue : annotation.axisValue;
                    this.annotationsModule.createAnnotationTemplate(element, annotationIndex, this);
                    if (!ej2_base_3.isNullOrUndefined(annotation.axisIndex)) {
                        var axis = this.axes[annotation.axisIndex];
                        var range = axis.visibleRange;
                        var annotationElement = helper_1.getElement(this.element.id + '_Annotation_' + annotationIndex);
                        Iif (!elementExist && annotation.axisValue >= range.min && annotation.axisValue <= range.max
                            && !ej2_base_3.isNullOrUndefined(annotationElement) && typeof (annotationElement) === 'object') {
                            element.appendChild(annotationElement);
                        }
                    }
                    else if (!elementExist) {
                        var annotationElement = helper_1.getElement(this.element.id + '_Annotation_' + annotationIndex);
                        if (!ej2_base_3.isNullOrUndefined(annotationElement) && typeof (annotationElement) === 'object') {
                            element.appendChild(annotationElement);
                        }
                    }
                }
            }
        };
        LinearGauge.prototype.isGradientVisible = function () {
            var isVisible = false;
            for (var _i = 0, _a = this.axes; _i < _a.length; _i++) {
                var axis = _a[_i];
                for (var _b = 0, _c = axis.pointers; _b < _c.length; _b++) {
                    var pointer = _c[_b];
                    if (!ej2_base_3.isNullOrUndefined(pointer.linearGradient) || !ej2_base_3.isNullOrUndefined(pointer.radialGradient)) {
                        isVisible = true;
                        break;
                    }
                }
                for (var _d = 0, _e = axis.ranges; _d < _e.length; _d++) {
                    var range = _e[_d];
                    if (!ej2_base_3.isNullOrUndefined(range.linearGradient) || !ej2_base_3.isNullOrUndefined(range.radialGradient)) {
                        isVisible = true;
                        break;
                    }
                }
            }
            return isVisible;
        };
        LinearGauge.prototype.requiredModules = function () {
            var modules = [];
            var annotationEnable = false;
            this.annotations.map(function (annotation) {
                Eif (!annotationEnable) {
                    annotationEnable = !ej2_base_3.isNullOrUndefined(annotation.content) && annotation.content.length !== 0;
                }
            });
            if (annotationEnable) {
                modules.push({
                    member: 'Annotations',
                    args: [this, annotations_1.Annotations],
                    name: 'Annotations'
                });
            }
            if (this.tooltip.enable) {
                modules.push({
                    member: 'Tooltip',
                    args: [this, tooltip_1.GaugeTooltip],
                    name: 'GaugeTooltip'
                });
            }
            if (this.allowPrint) {
                modules.push({
                    member: 'Print',
                    args: [this],
                    name: 'Print'
                });
            }
            if (this.allowImageExport) {
                modules.push({
                    member: 'ImageExport',
                    args: [this],
                    name: 'ImageExport'
                });
            }
            if (this.allowPdfExport) {
                modules.push({
                    member: 'PdfExport',
                    args: [this],
                    name: 'PdfExport'
                });
            }
            if (this.isGradientVisible()) {
                modules.push({
                    member: 'Gradient',
                    args: [this, gradient_1.Gradient],
                    name: 'Gradient'
                });
            }
            return modules;
        };
        LinearGauge.prototype.getPersistData = function () {
            var keyEntity = ['loaded'];
            return this.addOnPersist(keyEntity);
        };
        LinearGauge.prototype.getModuleName = function () {
            return 'lineargauge';
        };
        LinearGauge.prototype.onPropertyChanged = function (newProp, oldProp) {
            Eif (!this.isDestroyed) {
                var renderer = false;
                var refreshBounds = false;
                this.allowLoadingAnimation = this.animationDuration > 0 && !this.isOverAllAnimationComplete ? true : false;
                this.isPropertyChange = this.animationDuration > 0 && !this.isOverAllAnimationComplete ? false : true;
                this.gaugeResized = false;
                for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
                    var prop = _a[_i];
                    switch (prop) {
                        case 'height':
                        case 'width':
                        case 'margin':
                            this.createSvg();
                            refreshBounds = true;
                            break;
                        case 'title':
                            refreshBounds = (newProp.title === '' || oldProp.title === '');
                            renderer = !(newProp.title === '' || oldProp.title === '');
                            break;
                        case 'titleStyle':
                            if (newProp.titleStyle && newProp.titleStyle.size) {
                                refreshBounds = true;
                            }
                            else {
                                renderer = true;
                            }
                            break;
                        case 'border':
                            renderer = true;
                            break;
                        case 'background':
                            renderer = true;
                            break;
                        case 'container':
                            refreshBounds = true;
                            break;
                        case 'orientation':
                            this.isOverAllAnimationComplete = true;
                            this.isPointerAnimationInProgress = this.allowLoadingAnimation = false;
                            for (var i = 0; i < this.axes.length; i++) {
                                for (var j = 0; j < this.axes[i].pointers.length; j++) {
                                    this.axes[i].pointers[j]['startValue'] = this.axes[i].minimum;
                                    this.axes[i].pointers[j]['isPointerAnimation'] = true;
                                }
                            }
                            refreshBounds = true;
                            break;
                        case 'axes':
                            for (var x = 0; x < this.axes.length; x++) {
                                if (!ej2_base_3.isNullOrUndefined(newProp.axes[x])) {
                                    var collection = Object.keys(newProp.axes[x]);
                                    for (var _b = 0, collection_1 = collection; _b < collection_1.length; _b++) {
                                        var collectionProp = collection_1[_b];
                                        if (collectionProp === 'pointers') {
                                            var pointerPropertyLength = Object.keys(newProp.axes[x].pointers).length;
                                            for (var y = 0; y < pointerPropertyLength; y++) {
                                                var index = parseInt(Object.keys(newProp.axes[x].pointers)[y], 10);
                                                Eif (!isNaN(index) &&
                                                    !ej2_base_3.isNullOrUndefined(Object.keys(newProp.axes[x].pointers[index]))) {
                                                    this.allowLoadingAnimation = false;
                                                    this.isPointerAnimationInProgress = false;
                                                    this.axes[x].pointers[index]['startValue'] = this.axes[x].pointers[index]['currentValue'];
                                                    this.axes[x].pointers[index]['isPointerAnimation'] = Object.keys(newProp.axes[x].pointers[index]).indexOf('value') > -1;
                                                    Iif (this.pointerDrag) {
                                                        this.axes[x].pointers[index]['isPointerAnimation'] = false;
                                                        if (this.isTouchPointer &&
                                                            newProp.axes[x].pointers[index].text
                                                                !== oldProp.axes[x].pointers[index].text) {
                                                            var currentPointer = this.axes[x].pointers[index];
                                                            var pointerId = this.element.id + '_AxisIndex_' + x + '_' + currentPointer.type + 'Pointer' + '_' + index;
                                                            this.axisRenderer.updateTextPointer(pointerId, currentPointer, this.axes[x]);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            refreshBounds = true;
                            break;
                    }
                }
                Eif (!this.isTouchPointer && ej2_base_3.isNullOrUndefined(this.activePointer)) {
                    if (!refreshBounds && renderer) {
                        this.removeSvg();
                        this.renderGaugeElements();
                        this.renderAxisElements();
                    }
                    if (refreshBounds || this.allowLoadingAnimation) {
                        this.createSvg();
                        this.renderGaugeElements();
                        this.calculateBounds();
                        this.renderAxisElements();
                        if (this.allowLoadingAnimation) {
                            this.allowLoadingAnimation = this.animationDuration > 0 && !this.isOverAllAnimationComplete ? true : false;
                            this.renderAnimation();
                        }
                    }
                }
            }
        };
        __decorate([
            ej2_base_1.Property(null)
        ], LinearGauge.prototype, "width", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], LinearGauge.prototype, "allowMargin", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], LinearGauge.prototype, "height", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], LinearGauge.prototype, "animationDuration", void 0);
        __decorate([
            ej2_base_1.Property('Vertical')
        ], LinearGauge.prototype, "orientation", void 0);
        __decorate([
            ej2_base_1.Property('None')
        ], LinearGauge.prototype, "edgeLabelPlacement", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], LinearGauge.prototype, "allowPrint", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], LinearGauge.prototype, "allowImageExport", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], LinearGauge.prototype, "allowPdfExport", void 0);
        __decorate([
            ej2_base_3.Complex({}, base_1.Margin)
        ], LinearGauge.prototype, "margin", void 0);
        __decorate([
            ej2_base_3.Complex({ color: '', width: 0 }, base_1.Border)
        ], LinearGauge.prototype, "border", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], LinearGauge.prototype, "background", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], LinearGauge.prototype, "title", void 0);
        __decorate([
            ej2_base_3.Complex({ size: null, color: null, fontFamily: null, fontStyle: null, fontWeight: null }, base_1.Font)
        ], LinearGauge.prototype, "titleStyle", void 0);
        __decorate([
            ej2_base_3.Complex({}, base_1.Container)
        ], LinearGauge.prototype, "container", void 0);
        __decorate([
            ej2_base_3.Collection([{}], axis_1.Axis)
        ], LinearGauge.prototype, "axes", void 0);
        __decorate([
            ej2_base_3.Complex({}, base_1.TooltipSettings)
        ], LinearGauge.prototype, "tooltip", void 0);
        __decorate([
            ej2_base_3.Collection([{}], base_1.Annotation)
        ], LinearGauge.prototype, "annotations", void 0);
        __decorate([
            ej2_base_1.Property([])
        ], LinearGauge.prototype, "rangePalettes", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], LinearGauge.prototype, "useGroupingSeparator", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], LinearGauge.prototype, "description", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], LinearGauge.prototype, "tabIndex", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], LinearGauge.prototype, "format", void 0);
        __decorate([
            ej2_base_1.Property('Material')
        ], LinearGauge.prototype, "theme", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "loaded", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "load", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "animationComplete", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "axisLabelRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "dragStart", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "dragMove", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "dragEnd", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "annotationRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "tooltipRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "gaugeMouseMove", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "gaugeMouseLeave", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "gaugeMouseDown", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "gaugeMouseUp", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "valueChange", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "resized", void 0);
        __decorate([
            ej2_base_3.Event()
        ], LinearGauge.prototype, "beforePrint", void 0);
        LinearGauge = __decorate([
            ej2_base_1.NotifyPropertyChanges
        ], LinearGauge);
        return LinearGauge;
    }(ej2_base_1.Component));
    exports.LinearGauge = LinearGauge;
});