all files / circular-gauge/ circular-gauge.js

95.81% Statements 686/716
85.99% Branches 497/578
100% Functions 58/58
95.76% Lines 678/708
18 statements, 7 functions, 29 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  1× 1× 1× 1× 1× 1×   1× 1× 1× 1×       1× 1× 1× 1× 1×   1×   1× 1× 1× 1× 74× 74× 74× 74× 74× 74× 74× 74× 74× 74× 8×   74×   1× 1× 670× 670× 670× 670× 670× 670× 670×     1× 670× 670× 670× 670× 670×   670× 670× 670×     1× 670×   1× 1331× 1331× 1331× 1331× 1331× 1331× 1331×   1× 670× 670× 670× 670× 670× 670× 670× 670× 670×   1× 18× 18× 17×   18×   1× 55× 55× 55× 55× 55× 55× 55× 55× 55× 55×     55×   55× 54× 2× 1×     1×     52× 28×   54× 54× 54× 1× 1× 1× 1× 1×                   1× 1× 1× 1×   53× 23× 23× 23× 23× 23×               23× 23×       55× 55× 55×   1× 13× 13× 13× 13× 13× 13× 13× 13×   1× 1× 1× 1× 1×       1× 1× 1× 1× 1× 1× 1× 1×     1× 23× 23× 23× 23× 23× 22× 22× 22× 22× 22× 22× 22× 22× 22× 22× 22× 22×           1× 34× 34× 34× 34× 34× 34× 34× 34× 34× 5×     34× 34×     5× 5× 5× 5×     5×     5× 5× 5×                 5× 1×     29×     28× 28× 28× 28×     28× 28× 28×               28× 28×       34×   1× 8× 8× 8× 8× 8× 8×                                             8× 6× 6× 6× 6×               6× 6×   8×     8× 8× 8× 8× 1× 1×   8×   1× 110× 110× 110× 110× 110× 110×           1× 1× 1× 1×             1× 1× 1×     1× 1× 1× 1× 1× 1× 1× 1× 1×     1× 1×         1×   1× 670× 670× 670× 670× 670× 670× 670×   1× 670×   1× 685× 685×     685×     685× 685×           1× 1377× 1377× 1377× 715× 701× 2497×   701× 701×     715×       1377× 1377×     1× 670×       670× 670× 670×   1× 686× 686× 686× 686× 686× 686× 686× 686×   1× 709× 709× 709× 709× 709× 709× 709×   15×     694× 15× 4× 4×     11× 3× 3× 3× 3×   3×     8× 3× 3×     5×           679×     709× 709× 56× 56×   709× 15× 2× 2× 2× 2×   13× 3× 3×   3×       15×   15× 5×       15×     15× 15× 6× 6× 6×           694×   694×     709×   1× 703× 703× 703× 703× 703× 180×   703× 703× 703× 703× 703× 703× 703× 703× 703× 703×   15×   703× 9× 15×   15×     15× 15× 15× 15× 15×       694× 694×   703×   1× 710× 710× 710× 710× 710× 710× 710× 710×   1× 671× 13× 13×       1× 710× 660×   50× 50×     1× 710× 184×               184× 184× 5×   184× 184× 184× 184× 184× 184× 184× 184×     1× 710× 710× 710×     1× 973× 973× 973× 973× 973× 973× 972× 972× 972× 972× 972× 972× 972× 2904× 7× 7× 1×     6× 6×       2897× 964×   1933× 4×   1929× 964×   965× 1×   2897× 2880×       2880×       17×         972×         973× 973× 973× 973× 973×   1× 2× 2× 2× 2×       2× 2× 2× 2× 2× 2× 2× 1×         1× 42× 42×     1× 21× 21× 6×   21× 12× 12×     9× 9× 9×         1× 128× 128× 128× 128× 128× 43× 43× 43× 43×     85× 85× 85×   128× 128×   1× 8× 8× 8× 8× 8× 8× 8× 8× 8× 8× 8× 8× 8× 4× 4× 4× 4× 4× 4× 1×   4× 1× 1×   4× 1× 1×   4× 1×   4× 4× 4×     8× 8× 8× 8× 8×       8×   8× 8×       8×   8× 8× 8× 8×         1× 661× 661×   661× 137×   661× 653× 653×   653× 653× 653× 653× 653× 653× 653× 653× 653× 653× 653× 653× 653× 653×   1× 1187× 1187× 1187× 1187× 1262× 1465× 1235×       1187× 156×           1187× 209×           1187× 45×           1187× 45×           1187× 45×           1187× 106×           1187×         1187×   1× 5×   1× 48× 48× 48× 48× 48× 48× 48×   48× 55× 55×           14× 14× 14×   1× 1×   3× 3× 3×   4× 3×     1×   4×   3× 3×   3× 3×   1× 1×   22× 22× 22× 18× 18× 25× 25× 5× 5× 8× 8× 8× 8× 8× 8× 8×             22× 22×     48× 42× 7× 7×   42× 15× 15× 15× 15× 1× 1×     42× 17× 17× 17×     48×     1× 392×   1× 1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×     1×   1×    
/* 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;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (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", "@syncfusion/ej2-base", "@syncfusion/ej2-svg-base", "./utils/helper-common", "./utils/helper-circular-gauge", "./model/base", "./axes/axis", "./annotations/annotations", "./user-interaction/tooltip", "./model/constants", "./model/constants", "./model/constants", "./axes/axis-panel", "./model/theme", "./utils/helper-legend", "./legend/legend", "./model/pdf-export", "./model/image-export", "./model/print", "./axes/gradient"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_base_4, ej2_svg_base_1, helper_common_1, helper_circular_gauge_1, base_1, axis_1, annotations_1, tooltip_1, constants_1, constants_2, constants_3, axis_panel_1, theme_1, helper_legend_1, legend_1, pdf_export_1, image_export_1, print_1, gradient_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CircularGauge = (function (_super) {
        __extends(CircularGauge, _super);
        function CircularGauge(options, element) {
            var _this = _super.call(this, options, element) || this;
            _this.allowLoadingAnimation = false;
            _this.isRangeUpdate = false;
            _this.isAnimationProgress = true;
            _this.isResize = false;
            _this.isOverAllAnimationComplete = false;
            _this.isDrag = false;
            _this.gradientCount = 0;
            CircularGauge_1.Inject(gradient_1.Gradient);
            if (element) {
                _this.appendTo(element);
            }
            return _this;
        }
        CircularGauge_1 = CircularGauge;
        CircularGauge.prototype.preRender = function () {
            Eif (!ej2_base_2.isNullOrUndefined(this.element)) {
                this.unWireEvents();
                this.trigger(constants_1.load, { gauge: this });
                this.initPrivateVariable();
                this.setCulture();
                this.createSvg();
                this.wireEvents();
            }
        };
        CircularGauge.prototype.render = function () {
            Eif (!ej2_base_2.isNullOrUndefined(this.element)) {
                this.setTheme();
                this.calculateBounds();
                this.isPropertyChange = false;
                this.allowLoadingAnimation = ((this.animationDuration === 0 && ej2_base_1.animationMode === 'Enable') || this.animationDuration > 0)
                    && !this.isOverAllAnimationComplete;
                this.renderElements(true);
                this.renderAnimation();
                this.renderComplete();
            }
        };
        CircularGauge.prototype.setTheme = function () {
            this.themeStyle = theme_1.getThemeStyle(this.theme);
        };
        CircularGauge.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, 'click', this.gaugeOnMouseClick);
            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);
        };
        CircularGauge.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, 'click', this.gaugeOnMouseClick, 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);
            window.addEventListener((ej2_base_2.Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeEvent);
            this.setGaugeStyle(this.element);
        };
        CircularGauge.prototype.gaugeOnMouseClick = function (e) {
            this.setMouseXY(e);
            if (this.legendModule && this.legendSettings.visible) {
                this.legendModule.click(e);
            }
            return false;
        };
        CircularGauge.prototype.mouseMove = function (e) {
            var _this = this;
            this.setMouseXY(e);
            var args = this.getMouseArgs(e, 'touchmove', constants_1.gaugeMouseMove);
            this.trigger('gaugeMouseMove', args, function (observedArgs) {
                var dragArgs;
                var pointerDrag = false;
                Eif ((!ej2_base_2.isNullOrUndefined(_this.activePointer) ? _this.activePointer.pathElement.some(function (el) { return el.id === args.target.id; }) : true)) {
                    var pointerIndex = args.target.id.indexOf('_Pointer_') > -1 ? parseInt(args.target.id.slice(-1), 10) : null;
                    var axisIndex = args.target.id.indexOf('_Axis_') > -1 ? parseInt(args.target.id.split('_Axis_')[1], 10) : null;
                    pointerDrag = (_this.allowPointerDrag && !ej2_base_2.isNullOrUndefined(axisIndex) && !ej2_base_2.isNullOrUndefined(pointerIndex))
                        ? _this.axes[axisIndex].pointers[pointerIndex].enableDrag
                        : _this.enablePointerDrag;
                    _this.isPointerDragged = pointerDrag;
                }
                if (!args.cancel) {
                    if ((_this.isPointerDragged || _this.enableRangeDrag) && _this.svgObject.getAttribute('cursor') !== 'grabbing') {
                        if ((args.target.id.indexOf('_Pointer_') !== -1 && _this.isPointerDragged) || (_this.enableRangeDrag && args.target.id.indexOf('_Range_') !== -1)) {
                            _this.svgObject.setAttribute('cursor', 'pointer');
                        }
                        else {
                            _this.svgObject.setAttribute('cursor', 'auto');
                        }
                    }
                    else if (_this.svgObject.getAttribute('cursor') !== 'grabbing') {
                        _this.svgObject.setAttribute('cursor', 'auto');
                    }
                    var svgElement = helper_common_1.getElement(_this.element.id + '_svg');
                    var extraWidth = _this.element.getBoundingClientRect().left - svgElement.getBoundingClientRect().left;
                    if (_this.isPointerDragged && _this.activePointer) {
                        _this.isDrag = true;
                        e.preventDefault();
                        var dragPointInd = parseInt(_this.activePointer.pathElement[0].id.slice(-1), 10);
                        var dragAxisInd = parseInt(_this.activePointer.pathElement[0].id.split('_Axis_')[1], 10);
                        dragArgs = {
                            axis: _this.activeAxis,
                            pointer: _this.activePointer,
                            previousValue: _this.activePointer.currentValue,
                            name: constants_3.dragMove,
                            type: constants_1.pointerMove,
                            currentValue: null,
                            axisIndex: dragAxisInd,
                            pointerIndex: dragPointInd
                        };
                        _this.pointerDrag(new helper_common_1.GaugeLocation(args.x + extraWidth, args.y), dragAxisInd, dragPointInd);
                        dragArgs.currentValue = _this.activePointer.currentValue;
                        _this.trigger(constants_3.dragMove, dragArgs);
                        _this.activeRange = null;
                    }
                    else if (_this.enableRangeDrag && _this.activeRange) {
                        _this.isDrag = true;
                        e.preventDefault();
                        var dragAxisInd = parseInt(_this.activeRange.pathElement[0].id.split('_Axis_')[1], 10);
                        var dragRangeInd = parseInt(_this.activeRange.pathElement[0].id.split('Range_')[1], 10);
                        dragArgs = {
                            axis: _this.activeAxis,
                            name: constants_3.dragMove,
                            type: constants_2.rangeMove,
                            range: _this.activeRange,
                            axisIndex: dragAxisInd,
                            rangeIndex: dragRangeInd
                        };
                        _this.rangeDrag(new helper_common_1.GaugeLocation(args.x + extraWidth, args.y), dragAxisInd, dragRangeInd);
                        _this.trigger(constants_3.dragMove, dragArgs);
                    }
                }
            });
            this.notify(ej2_base_2.Browser.touchMoveEvent, e);
            helper_legend_1.titleTooltip(e, e.clientX, e.clientY, this, false);
            return false;
        };
        CircularGauge.prototype.mouseLeave = function (e) {
            this.setMouseXY(e);
            this.activeAxis = null;
            this.activePointer = null;
            this.activeRange = null;
            this.svgObject.setAttribute('cursor', 'auto');
            var args = this.getMouseArgs(e, 'touchmove', constants_1.gaugeMouseLeave);
            this.trigger(constants_1.gaugeMouseLeave, args);
            return false;
        };
        CircularGauge.prototype.gaugeRightClick = function (event) {
            Eif (event.buttons === 2 || event.pointerType === 'touch') {
                event.preventDefault();
                event.stopPropagation();
                return false;
            }
            return true;
        };
        CircularGauge.prototype.pointerDrag = function (location, axisIndex, pointerIndex) {
            var axis = this.activeAxis;
            var range = axis.visibleRange;
            var value = helper_circular_gauge_1.getValueFromAngle(helper_common_1.getAngleFromLocation(this.midPoint, location), range.max, range.min, axis.startAngle, axis.endAngle, axis.direction === 'ClockWise');
            Eif (value >= range.min && value <= range.max) {
                this.axes[axisIndex].pointers[pointerIndex].value = value;
                this.activePointer.currentValue = value;
                this.gaugeAxisLayoutPanel.pointerRenderer.setPointerValue(axis, this.activePointer, value);
            }
        };
        CircularGauge.prototype.rangeDrag = function (location, axisIndex, rangeIndex) {
            Eif (this.activeAxis) {
                var axis = this.activeAxis;
                var range = axis.visibleRange;
                var value = helper_circular_gauge_1.getValueFromAngle(helper_common_1.getAngleFromLocation(this.midPoint, location), range.max, range.min, axis.startAngle, axis.endAngle, axis.direction === 'ClockWise');
                if (value >= range.min && value <= range.max) {
                    var previousValue1 = this.activeRange.currentValue;
                    this.activeRange.currentValue = value;
                    var add = (this.activeRange.end - this.activeRange.start);
                    var div = add / 2;
                    var avg = parseFloat(this.activeRange.start.toString()) + div;
                    var start = typeof this.activeRange.start === 'string' ? parseFloat(this.activeRange.start) : this.activeRange.start;
                    var end = typeof this.activeRange.end === 'string' ? parseFloat(this.activeRange.end) : this.activeRange.end;
                    this.startValue = (value < avg) ? value : ((previousValue1 < avg) ? previousValue1 : ((start < end) ? this.activeRange.start : this.activeRange.end));
                    this.endValue = (value < avg) ? ((previousValue1 > avg) ? previousValue1 : ((start < end) ? this.activeRange.end : this.activeRange.start)) : value;
                    this.axes[axisIndex].ranges[rangeIndex].start = this.startValue;
                    this.axes[axisIndex].ranges[rangeIndex].end = this.endValue;
                    Iif (this.isTouch) {
                        this.setRangeValue(axisIndex, rangeIndex, this.startValue, this.endValue);
                    }
                }
            }
        };
        CircularGauge.prototype.gaugeOnMouseDown = function (e) {
            var _this = this;
            this.setMouseXY(e);
            var currentPointer;
            var currentRange;
            var args = this.getMouseArgs(e, 'touchstart', constants_1.gaugeMouseDown);
            var pointerDrag = false;
            var pointerIndex = args.target.id.indexOf('_Pointer_') > -1 ? parseInt(args.target.id.slice(-1), 10) : null;
            var axisIndex = args.target.id.indexOf('_Axis_') > -1 ? parseInt(args.target.id.split('_Axis_')[1], 10) : null;
            if (!ej2_base_2.isNullOrUndefined(axisIndex) && !ej2_base_2.isNullOrUndefined(pointerIndex)) {
                pointerDrag = this.allowPointerDrag ? this.axes[axisIndex].pointers[pointerIndex].enableDrag
                    : this.enablePointerDrag;
            }
            this.trigger('gaugeMouseDown', args, function (observedArgs) {
                if (!args.cancel &&
                    args.target.id.indexOf(_this.element.id + '_Axis_') >= 0 &&
                    args.target.id.indexOf('_Pointer_') >= 0) {
                    currentPointer = helper_common_1.getPointer(args.target.id, _this);
                    _this.activeAxis = _this.axes[currentPointer.axisIndex];
                    _this.activePointer = _this.activeAxis.pointers[currentPointer.pointerIndex];
                    Iif (ej2_base_2.isNullOrUndefined(_this.activePointer.pathElement)) {
                        _this.activePointer.pathElement = [e.target];
                    }
                    Iif (_this.activePointer.type === 'Marker' && _this.activePointer.markerShape === 'Text' && _this.activePointer.pathElement.length === 0) {
                        _this.activePointer.pathElement = [e.target];
                    }
                    var pointInd = parseInt(_this.activePointer.pathElement[0].id.slice(-1), 10);
                    var axisInd = parseInt(_this.activePointer.pathElement[0].id.split('_Axis_')[1], 10);
                    _this.trigger(constants_3.dragStart, {
                        axis: _this.activeAxis,
                        name: constants_3.dragStart,
                        type: constants_2.pointerStart,
                        pointer: _this.activePointer,
                        currentValue: _this.activePointer.currentValue,
                        pointerIndex: pointInd,
                        axisIndex: axisInd
                    });
                    if (pointerDrag) {
                        _this.svgObject.setAttribute('cursor', 'grabbing');
                    }
                }
                else if (!args.cancel &&
                    args.target.id.indexOf(_this.element.id + '_Axis_') >= 0 &&
                    args.target.id.indexOf('_Range_') >= 0) {
                    currentRange = helper_circular_gauge_1.getRange(args.target.id, _this);
                    _this.activeAxis = _this.axes[currentRange.axisIndex];
                    _this.activeRange = _this.activeAxis.ranges[currentRange.rangeIndex];
                    Iif (ej2_base_2.isNullOrUndefined(_this.activeRange.pathElement)) {
                        _this.activeRange.pathElement = [e.target];
                    }
                    var rangeInd = parseInt(_this.activeRange.pathElement[0].id.split('Range_')[1], 10);
                    var axisInd = parseInt(_this.activeRange.pathElement[0].id.split('_Axis_')[1], 10);
                    _this.trigger(constants_3.dragStart, {
                        axis: _this.activeAxis,
                        name: constants_3.dragStart,
                        type: constants_2.rangeStart,
                        range: _this.activeRange,
                        axisIndex: axisInd,
                        rangeIndex: rangeInd
                    });
                    Eif (_this.enableRangeDrag) {
                        _this.svgObject.setAttribute('cursor', 'grabbing');
                    }
                }
            });
            return false;
        };
        CircularGauge.prototype.mouseEnd = function (e) {
            this.setMouseXY(e);
            var args = this.getMouseArgs(e, 'touchend', constants_3.gaugeMouseUp);
            this.isTouch = e.pointerType === 'touch' || e.pointerType === '2' || e.type === 'touchend';
            this.trigger(constants_3.gaugeMouseUp, args);
            var pointerDrag = false;
            Iif (this.activeAxis && this.activePointer) {
                var pointerIndex = parseInt(this.activePointer.pathElement[0].id.slice(-1), 10);
                var axisIndex = parseInt(this.activePointer.pathElement[0].id.split('_Axis_')[1], 10);
                if (!ej2_base_2.isNullOrUndefined(axisIndex) && !ej2_base_2.isNullOrUndefined(pointerIndex)) {
                    pointerDrag = this.allowPointerDrag ? this.axes[axisIndex].pointers[pointerIndex].enableDrag
                        : this.enablePointerDrag;
                }
                if (pointerDrag) {
                    this.svgObject.setAttribute('cursor', 'auto');
                    this.trigger(constants_3.dragEnd, {
                        name: constants_3.dragEnd,
                        type: constants_2.pointerEnd,
                        axis: this.activeAxis,
                        pointer: this.activePointer,
                        currentValue: this.activePointer.currentValue,
                        axisIndex: axisIndex,
                        pointerIndex: pointerIndex
                    });
                    this.activeAxis = null;
                    this.activePointer = null;
                    this.isPointerDragged = false;
                }
            }
            else if (this.activeAxis && this.activeRange && this.enableRangeDrag) {
                this.svgObject.setAttribute('cursor', 'auto');
                var rangeInd = parseInt(this.activeRange.pathElement[0].id.slice(-1), 10);
                var axisInd = parseInt(this.activeRange.pathElement[0].id.split('_Axis_')[1], 10);
                this.trigger(constants_3.dragEnd, {
                    name: constants_3.dragEnd,
                    type: constants_2.rangeEnd,
                    axis: this.activeAxis,
                    range: this.activeRange,
                    axisIndex: axisInd,
                    rangeIndex: rangeInd
                });
                this.activeAxis = null;
                this.activeRange = null;
            }
            Iif (!ej2_base_2.isNullOrUndefined(this.activePointer)) {
                this.activePointer = null;
            }
            this.isDrag = false;
            this.svgObject.setAttribute('cursor', 'auto');
            this.notify(ej2_base_2.Browser.touchEndEvent, e);
            if (e.type.indexOf('touch') > -1 && (args.target.id === (this.element.id + '_CircularGaugeTitle') || args.target.id.indexOf('_gauge_legend_') > -1)) {
                var touchArg = e;
                helper_legend_1.titleTooltip(e, touchArg.changedTouches[0].pageX, touchArg.changedTouches[0].pageY, this, true);
            }
            return false;
        };
        CircularGauge.prototype.getMouseArgs = function (e, type, name) {
            var rect = this.element.getBoundingClientRect();
            var location = new helper_common_1.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,
                x: location.x, y: location.y,
                target: isTouch ? e.target : e.target
            };
        };
        CircularGauge.prototype.gaugeResize = function (e) {
            var _this = this;
            Eif (!this.isDestroyed) {
                var args = {
                    gauge: this,
                    previousSize: this.availableSize,
                    name: constants_3.resized,
                    cancel: false,
                    currentSize: this.calculateSvgSize()
                };
                this.trigger(constants_3.resized, args);
                Eif (!args.cancel) {
                    Iif (this.resizeTo) {
                        clearTimeout(this.resizeTo);
                    }
                    Eif (!ej2_base_2.isNullOrUndefined(this.element) && this.element.classList.contains('e-circulargauge')) {
                        this.animatePointer = false;
                        this.resizeTo = window.setTimeout(function () {
                            _this.isResize = true;
                            _this.isPropertyChange = true;
                            _this.createSvg();
                            _this.calculateBounds();
                            _this.allowLoadingAnimation = false;
                            Iif (_this.isOverAllAnimationComplete) {
                                _this.loadingAnimationDuration = [];
                            }
                            _this.renderElements();
                            _this.isResize = false;
                        }, 500);
                    }
                }
            }
            return false;
        };
        CircularGauge.prototype.setGaugeStyle = 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';
            element.style.overflow = 'hidden';
        };
        CircularGauge.prototype.setCulture = function () {
            this.intl = new ej2_base_3.Internationalization();
        };
        CircularGauge.prototype.createSvg = function () {
            this.removeSvg();
            Iif (ej2_base_2.isNullOrUndefined(this.renderer)) {
                this.renderer = new ej2_svg_base_1.SvgRenderer(this.element.id);
            }
            Iif (ej2_base_2.isNullOrUndefined(this.gaugeAxisLayoutPanel)) {
                this.gaugeAxisLayoutPanel = new axis_panel_1.AxisLayoutPanel(this);
            }
            this.availableSize = this.calculateSvgSize();
            this.svgObject = this.renderer.createSvg({
                id: this.element.id + '_svg',
                width: this.availableSize.width,
                height: this.availableSize.height
            });
        };
        CircularGauge.prototype.removeSvg = function () {
            Eif (!ej2_base_2.isNullOrUndefined(this.element)) {
                helper_common_1.removeElement(this.element.id + '_Secondary_Element');
                if (this.svgObject) {
                    while (this.svgObject.childNodes.length > 0) {
                        while (this.svgObject.childNodes.length > 0) {
                            this.svgObject.removeChild(this.svgObject.firstChild);
                        }
                        Eif (!this.svgObject.hasChildNodes() && this.svgObject.parentNode) {
                            ej2_base_4.remove(this.svgObject);
                        }
                    }
                    Iif (!this.svgObject.hasChildNodes() && this.svgObject.parentNode) {
                        ej2_base_4.remove(this.svgObject);
                    }
                }
                helper_common_1.removeElement(this.element.id + '_svg');
                this.clearTemplate();
            }
        };
        CircularGauge.prototype.initPrivateVariable = function () {
            Iif (this.element.id === '') {
                var collection = document.getElementsByClassName('e-circulargauge').length;
                this.element.id = 'circulargauge_control_' + collection;
            }
            this.renderer = new ej2_svg_base_1.SvgRenderer(this.element.id);
            this.gaugeAxisLayoutPanel = new axis_panel_1.AxisLayoutPanel(this);
            this.animatePointer = true;
        };
        CircularGauge.prototype.calculateSvgSize = function () {
            var containerWidth = this.element.offsetWidth;
            var containerHeight = this.element.offsetHeight;
            var borderWidth = parseInt(this.element.style.borderWidth.split('px').join(''), 10) * 2;
            var width = helper_common_1.stringToNumber(this.width, containerWidth) || containerWidth || 600;
            var height = helper_common_1.stringToNumber(this.height, containerHeight) || containerHeight || 450;
            width = !isNaN(borderWidth) ? (width - borderWidth) : width;
            height = !isNaN(borderWidth) ? (height - borderWidth) : height;
            return new helper_common_1.Size(width, height);
        };
        CircularGauge.prototype.radiusAndCenterCalculation = function (top, left, width, height, radius, titleHeight, isUpperAngle, isLowerAngle, isFullPercent, radiusPercent, isUpper, isLower) {
            var rect;
            var bottom = this.margin.bottom + this.border.width;
            var minRadius;
            var widthRadius;
            var centerX;
            var centerY;
            if (this.moveToCenter && this.axes.length === 1 &&
                ej2_base_2.isNullOrUndefined(this.centerXpoint) && ej2_base_2.isNullOrUndefined(this.centerYpoint)) {
                rect = new helper_common_1.Rect(left, top, width, height);
            }
            else {
                if (!this.allowMargin) {
                    if (!ej2_base_2.isNullOrUndefined(this.legendModule) && (width > height) && (this.legendSettings.position === 'Top' || this.legendSettings.position === 'Bottom')) {
                        minRadius = Math.min(width, height) / 2;
                        rect = new helper_common_1.Rect((left + (width / 2) - minRadius), (top + (height / 2) - minRadius), minRadius * 2, minRadius * 2);
                    }
                    else {
                        if (width > height && (isLowerAngle && isLower || isUpperAngle && isUpper)) {
                            widthRadius = ((width) / 2);
                            var heightValue = isUpper && isLower ? (height / 2) : (height * (3 / 4));
                            Eif (widthRadius > heightValue) {
                                widthRadius = heightValue;
                            }
                            rect = new helper_common_1.Rect((left + (width / 2) - widthRadius), (top + (height / 2) - widthRadius), widthRadius * 2, widthRadius * 2);
                        }
                        else {
                            if (height > width) {
                                var heightRadius = height / 2;
                                rect = new helper_common_1.Rect((left + (width / 2) - radius), (top + (height / 2) - heightRadius), radius * 2, heightRadius * 2);
                            }
                            else {
                                rect = new helper_common_1.Rect((left + (width / 2) - radius), (top + (height / 2) - radius), radius * 2, radius * 2);
                            }
                        }
                    }
                }
                else {
                    rect = new helper_common_1.Rect((left + (width / 2) - radius), (top + (height / 2) - radius), radius * 2, radius * 2);
                }
            }
            this.gaugeRect = rect;
            if (this.legendModule && this.legendSettings.visible) {
                this.legendModule.getLegendOptions(this.axes);
                this.legendModule.calculateLegendBounds(this.gaugeRect, this.availableSize);
            }
            if (!this.allowMargin) {
                if (!ej2_base_2.isNullOrUndefined(this.legendModule) && (isUpperAngle || isLowerAngle) && (width > height) && (this.legendSettings.position === 'Top' || this.legendSettings.position === 'Bottom')) {
                    var difference = height - this.gaugeRect.height;
                    this.gaugeRect.width = width - ((this.availableSize.width - this.gaugeRect.width) / 2);
                    this.gaugeRect.y = this.gaugeRect.y - difference;
                    this.gaugeRect.height = this.gaugeRect.height + difference + ((this.availableSize.height - this.gaugeRect.height) / 2);
                }
                else if (!ej2_base_2.isNullOrUndefined(this.legendModule) && (isUpperAngle || isLowerAngle) && (width > height) && (this.legendSettings.position === 'Left' || this.legendSettings.position === 'Right')) {
                    var difference = this.gaugeRect.height - this.gaugeRect.width;
                    this.gaugeRect.x = this.legendSettings.position === 'Right'
                        ? this.gaugeRect.x + this.margin.right : this.gaugeRect.x;
                    this.gaugeRect.width = this.legendSettings.position === 'Left' ?
                        Math.abs(width - ((this.availableSize.width - this.gaugeRect.width + difference) / 2))
                        : Math.abs(width - ((this.availableSize.width - this.gaugeRect.width) / 2) - 10);
                }
                centerX = this.centerXpoint !== null ?
                    helper_common_1.stringToNumber(this.centerXpoint, this.availableSize.width) : this.gaugeRect.x + (this.gaugeRect.width / 2);
                if ((isUpperAngle || isLowerAngle) && !ej2_base_2.isNullOrUndefined(this.legendModule)) {
                    centerX = (this.legendSettings.position === 'Top' || this.legendSettings.position === 'Bottom')
                        ? this.availableSize.width / 2 : this.legendSettings.position === 'Right' ? (this.gaugeRect.width / 2) + this.margin.right :
                        centerX;
                }
                centerY = ((isUpperAngle || isLowerAngle) ? (isUpperAngle ?
                    (((this.gaugeRect.height * (3 / 4) + this.gaugeRect.y) - bottom))
                    : (((this.gaugeRect.height * (1 / 4)) + (this.gaugeRect.y)))) : this.gaugeRect.y + (this.gaugeRect.height / 2));
                centerY = !isFullPercent && (isUpperAngle || isLowerAngle) ? (this.gaugeRect.height / 2) + this.gaugeRect.y + (radiusPercent * (3 / 4) * (1 / 2)) : centerY;
                if (!ej2_base_2.isNullOrUndefined(this.axes) && this.axes.length > 1 && !ej2_base_2.isNullOrUndefined(this.midPoint)) {
                    isUpper = isUpperAngle ? isUpperAngle : isUpper;
                    isLower = isLowerAngle ? isLowerAngle : isLower;
                    Iif (isUpper && isLower) {
                        centerY = (this.availableSize.height / 2) - bottom;
                    }
                }
            }
            else {
                centerX = this.centerXpoint !== null ?
                    helper_common_1.stringToNumber(this.centerXpoint, this.availableSize.width) : this.gaugeRect.x + (this.gaugeRect.width / 2);
                centerY = this.centerYpoint !== null ?
                    helper_common_1.stringToNumber(this.centerYpoint, this.availableSize.height) : this.gaugeRect.y + (this.gaugeRect.height / 2);
            }
            this.midPoint = new helper_common_1.GaugeLocation(centerX, centerY);
        };
        CircularGauge.prototype.calculateBounds = function () {
            var padding = 5;
            var rect;
            var margin = this.margin;
            var titleHeight = 0;
            if (this.title) {
                titleHeight = helper_common_1.measureText(this.title, this.titleStyle).height + padding;
            }
            var top = margin.top + titleHeight + this.border.width;
            var left = margin.left + this.border.width;
            var isUpper = false;
            var isLower = false;
            var width = this.availableSize.width - left - margin.right - this.border.width;
            var height = this.availableSize.height - top - this.border.width - margin.bottom;
            var radius = Math.min(width, height) / 2;
            this.centerXpoint = (this.centerX === '') ? null : this.centerX;
            this.centerYpoint = (this.centerY === '') ? null : this.centerY;
            if (this.moveToCenter && this.axes.length === 1 &&
                ej2_base_2.isNullOrUndefined(this.centerXpoint) && ej2_base_2.isNullOrUndefined(this.centerYpoint)) {
                rect = new helper_common_1.Rect(left, top, width, height);
            }
            if (!this.allowMargin) {
                for (var j = 0; j < this.axes.length; j++) {
                    var isUpperAngle = 270 <= this.axes[j].startAngle && this.axes[j].startAngle <= 360 &&
                        0 <= this.axes[j].endAngle && this.axes[j].endAngle <= 90;
                    var isLowerAngle = 90 >= this.axes[j].startAngle && this.axes[j].startAngle <= 180 &&
                        180 <= this.axes[j].endAngle && 270 <= this.axes[j].endAngle && 0 !== this.axes[j].startAngle &&
                        360 !== this.axes[j].endAngle;
                    isUpper = isUpperAngle ? isUpperAngle : isUpper;
                    isLower = isLowerAngle ? isLowerAngle : isLower;
                    var isFullPercent = this.axes[j].radius !== null ? parseInt(this.axes[0].radius.split('%')[0], 10) >= 100 : true;
                    var radiusPercent = this.axes[j].radius !== null ? radius * (parseInt(this.axes[0].radius.split('%')[0], 10) / 100) : radius;
                    this.radiusAndCenterCalculation(top, left, width, height, radius, titleHeight, isUpperAngle, isLowerAngle, isFullPercent, radiusPercent, isUpper, isLower);
                }
            }
            else {
                rect = new helper_common_1.Rect((left + (width / 2) - radius), (top + (height / 2) - radius), radius * 2, radius * 2);
                this.radiusAndCenterCalculation(top, left, width, height, radius, titleHeight, false, false, null, null, false, false);
            }
            this.gaugeAxisLayoutPanel.measureAxis(this.gaugeRect);
        };
        CircularGauge.prototype.renderElements = function (animate) {
            if (animate === void 0) { animate = true; }
            this.renderBorder();
            this.renderTitle();
            this.gaugeAxisLayoutPanel.renderAxes(animate);
            this.renderLegend();
            this.element.appendChild(this.svgObject);
            this.trigger(constants_1.loaded, { gauge: this });
            helper_common_1.removeElement('gauge-measuretext');
        };
        CircularGauge.prototype.renderAnimation = function () {
            if (this.allowLoadingAnimation) {
                for (var i = 0; i < this.axes.length; i++) {
                    this.gaugeAxisLayoutPanel.axisLineAnimation(i, this.loadingAnimationDuration[i], this);
                }
            }
        };
        CircularGauge.prototype.renderLegend = function () {
            if (!this.legendModule || !this.legendSettings.visible) {
                return null;
            }
            Eif (this.legendModule.legendCollection.length) {
                this.legendModule.renderLegend(this.legendSettings, this.legendModule.legendBounds);
            }
        };
        CircularGauge.prototype.renderTitle = function () {
            if (this.title) {
                var style = {
                    color: this.titleStyle.color,
                    size: this.titleStyle.size || this.themeStyle.titleFontSize,
                    fontFamily: this.titleStyle.fontFamily || this.themeStyle.fontFamily,
                    fontStyle: this.titleStyle.fontStyle,
                    fontWeight: this.titleStyle.fontWeight || this.themeStyle.titleFontWeight,
                    opacity: this.titleStyle.opacity
                };
                var titleSize = style.size;
                if (!isNaN(Number(titleSize))) {
                    style.size = titleSize + 'px';
                }
                var width = Math.abs((this.margin.left + this.margin.right) - this.availableSize.width);
                var trimmedTitle = helper_legend_1.textTrim(width, this.title, style);
                var size = helper_common_1.measureText(trimmedTitle, style);
                var options = new helper_common_1.TextOption(this.element.id + '_CircularGaugeTitle', this.availableSize.width / 2, this.margin.top + 3 * (size.height / 4), 'middle', trimmedTitle);
                var element = helper_common_1.textElement(options, style, style.color || this.themeStyle.titleFontColor, this.svgObject, '');
                element.setAttribute('aria-label', this.description || this.title);
                element.setAttribute('role', 'region');
                element.setAttribute('tabindex', this.tabIndex.toString());
            }
        };
        CircularGauge.prototype.renderBorder = function () {
            var borderWidth = this.border.width;
            Eif (borderWidth > 0 || (this.background || this.themeStyle.backgroundColor)) {
                this.svgObject.appendChild(this.renderer.drawRectangle(new helper_common_1.RectOption(this.element.id + '_CircularGaugeBorder', this.background || this.themeStyle.backgroundColor, this.border, null, new helper_common_1.Rect(borderWidth / 2, borderWidth / 2, this.availableSize.width - borderWidth, this.availableSize.height - borderWidth))));
            }
        };
        CircularGauge.prototype.setPointerValue = function (axisIndex, pointerIndex, value) {
            var _this = this;
            var axis = this.axes[axisIndex];
            var pointer = axis.pointers[pointerIndex];
            var pointerRadius = pointer.currentRadius;
            this.allowLoadingAnimation = false;
            if (!this.isDestroyed && pointer.currentValue !== value) {
                var enableAnimation_1 = pointer.animation.enable || ej2_base_1.animationMode === 'Enable';
                value = value < axis.visibleRange.min ? axis.visibleRange.min : value;
                value = value > axis.visibleRange.max ? axis.visibleRange.max : value;
                pointer['isPointerAnimation'] = true;
                document.getElementById(this.element.id + '_Axis_' + axisIndex + '_Pointer_' + pointerIndex).style.visibility = 'visible';
                Eif (!ej2_base_2.isNullOrUndefined(pointer.pathElement)) {
                    pointer.pathElement.map(function (element) {
                        if (pointer.type === 'RangeBar') {
                            helper_circular_gauge_1.setStyles(element, pointer.color, pointer.border);
                            if (enableAnimation_1) {
                                _this.gaugeAxisLayoutPanel.pointerRenderer.performRangeBarAnimation(element, pointer.currentValue, value, axis, pointer, axisIndex);
                            }
                            else {
                                _this.isAnimationProgress = false;
                                _this.gaugeAxisLayoutPanel.pointerRenderer.setPointerValue(axis, pointer, value);
                            }
                        }
                        else {
                            if (element.id.indexOf('_Pointer_NeedleCap_') >= 0) {
                                helper_circular_gauge_1.setStyles(element, pointer.cap.color, pointer.cap.border);
                            }
                            else if (element.id.indexOf('_Pointer_NeedleTail_') >= 0) {
                                helper_circular_gauge_1.setStyles(element, pointer.needleTail.color, pointer.needleTail.border);
                            }
                            else if (element.id.indexOf('_Pointer_NeedleRect_') >= 0) {
                                helper_circular_gauge_1.setStyles(element, 'transparent', { color: 'transparent', width: 0 });
                            }
                            else if (pointer.type === 'Marker' && pointer.markerShape !== 'Text') {
                                helper_circular_gauge_1.setStyles(element, pointer.color, pointer.border);
                            }
                            if (enableAnimation_1) {
                                Iif (pointer.type === 'Marker' && pointer.markerShape === 'Text') {
                                    _this.gaugeAxisLayoutPanel.pointerRenderer.performTextAnimation(element, pointer.currentValue, value, axis, pointer, axisIndex);
                                }
                                else {
                                    _this.gaugeAxisLayoutPanel.pointerRenderer.performNeedleAnimation(element, pointer.currentValue, value, axis, pointer, axisIndex);
                                }
                            }
                            else {
                                _this.gaugeAxisLayoutPanel.pointerRenderer.setPointerValue(axis, pointer, value);
                            }
                        }
                    });
                }
                Iif (this.allowLoadingAnimation && !pointer.animation.enable) {
                    this.allowLoadingAnimation = false;
                    pointer.value = value;
                }
            }
            this.isProtectedOnChange = true;
            pointer.previousValue = pointer.currentValue;
            pointer.currentValue = value;
            pointer.value = value;
            this.isProtectedOnChange = false;
        };
        CircularGauge.prototype.setAnnotationValue = function (axisIndex, annotationIndex, content) {
            Eif (!this.isDestroyed) {
                this.allowLoadingAnimation = false;
                var isElementExist = helper_common_1.getElement(this.element.id + '_Annotations_' + axisIndex) !== null;
                var element = helper_common_1.getElement(this.element.id + '_Annotations_' + axisIndex) ||
                    ej2_base_4.createElement('div', {
                        id: this.element.id + '_Annotations_' + axisIndex, styles: this.animationDuration > 0 ? 'opacity: 0' : 'opacity: 1'
                    });
                var annotation = this.axes[axisIndex].annotations[annotationIndex];
                Eif (content !== null) {
                    helper_common_1.removeElement(this.element.id + '_Axis_' + axisIndex + '_Annotation_' + annotationIndex);
                    annotation.content = content;
                    this.annotationsModule.createTemplate(element, annotationIndex, axisIndex, this);
                    var secondaryElement = helper_common_1.getElement(this.element.id + '_Secondary_Element');
                    if (!isElementExist && !ej2_base_2.isNullOrUndefined(secondaryElement)) {
                        secondaryElement.appendChild(element);
                    }
                }
            }
        };
        CircularGauge.prototype.print = function (id) {
            Eif (this.allowPrint && this.printModule) {
                this.printModule.print(this, id);
            }
        };
        CircularGauge.prototype.export = function (type, fileName, orientation, allowDownload) {
            var _this = this;
            if (ej2_base_2.isNullOrUndefined(allowDownload)) {
                allowDownload = true;
            }
            if (type === 'PDF' && this.allowPdfExport && this.pdfExportModule) {
                return new Promise(function (resolve, reject) {
                    resolve(_this.pdfExportModule.export(_this, type, fileName, orientation, allowDownload));
                });
            }
            else Eif (this.allowImageExport && (type !== 'PDF') && this.imageExportModule) {
                return new Promise(function (resolve, reject) {
                    resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
                });
            }
            return null;
        };
        CircularGauge.prototype.setMouseXY = function (e) {
            var pageX;
            var pageY;
            var svgRect = helper_common_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);
        };
        CircularGauge.prototype.setRangeValue = function (axisIndex, rangeIndex, start, end) {
            this.allowLoadingAnimation = false;
            var element = helper_common_1.getElement(this.element.id + '_Axis_' + axisIndex + '_Range_' + rangeIndex);
            var axis = this.axes[axisIndex];
            var range = axis.ranges[rangeIndex];
            var axisRange = axis.visibleRange;
            var isClockWise = axis.direction === 'ClockWise';
            var startValue = Math.min(Math.max(start, axisRange.min), end);
            var endValue = Math.min(Math.max(start, end), axisRange.max);
            var oldRangeStart = range.start;
            var oldRangeEnd = range.end;
            range.start = start;
            range.end = end;
            if (range.start !== range.end && oldRangeStart === oldRangeEnd && this.legendModule && this.legendSettings.visible) {
                this.legendModule.getLegendOptions(this.axes);
                var height = this.legendModule.legendBounds.height + this.legendSettings.margin.top + this.legendSettings.margin.bottom + this.legendSettings.border.width;
                var width = this.legendModule.legendBounds.width + this.legendSettings.margin.left + this.legendSettings.margin.right + this.legendSettings.border.width;
                var rect = this.gaugeRect;
                var position = this.legendModule.position;
                if (position === 'Bottom') {
                    rect.height = rect.height + height;
                }
                if (position === 'Top') {
                    rect.height = rect.height + height;
                    rect.y = rect.y - height;
                }
                if (position === 'Left') {
                    rect.width = rect.width + width;
                    rect.x = rect.x - width;
                }
                if (position === 'Right') {
                    rect.width = rect.width + width;
                }
                this.legendModule.calculateLegendBounds(rect, this.availableSize);
                Eif (this.legendModule.legendCollection.length) {
                    this.legendModule.renderLegend(this.legendSettings, this.legendModule.legendBounds);
                }
            }
            this.isRangeUpdate = true;
            var startAngle = helper_common_1.getAngleFromValue(startValue, axisRange.max, axisRange.min, axis.startAngle, axis.endAngle, isClockWise);
            var endAngle = helper_common_1.getAngleFromValue(endValue, axisRange.max, axisRange.min, axis.startAngle, axis.endAngle, isClockWise);
            var startWidth;
            Iif (!ej2_base_2.isNullOrUndefined(range.startWidth) && range.startWidth.length > 0) {
                startWidth = helper_common_1.toPixel(range.startWidth, range.currentRadius);
            }
            else {
                startWidth = range.startWidth;
            }
            var endWidth;
            Iif (!ej2_base_2.isNullOrUndefined(range.endWidth) && range.endWidth.length > 0) {
                endWidth = helper_common_1.toPixel(range.endWidth, range.currentRadius);
            }
            else {
                endWidth = range.endWidth;
            }
            endAngle = isClockWise ? endAngle : [startAngle, startAngle = endAngle][0];
            endWidth = isClockWise ? endWidth : [startWidth, startWidth = endWidth][0];
            element.setAttribute('d', helper_common_1.getPathArc(this.midPoint, Math.round(startAngle), Math.round(endAngle), range.currentRadius, startWidth, endWidth, range, axis));
            helper_circular_gauge_1.setStyles(element, (range.color ? range.color : range.rangeColor), {
                color: (range.color ? range.color : range.rangeColor),
                width: 0
            });
        };
        CircularGauge.prototype.destroy = function () {
            Eif (!ej2_base_2.isNullOrUndefined(this.element)) {
                this.unWireEvents();
            }
            if (!ej2_base_2.isNullOrUndefined(this.tooltipModule)) {
                this.tooltipModule.removeEventListener();
            }
            _super.prototype.destroy.call(this);
            Eif (!ej2_base_2.isNullOrUndefined(this.gaugeAxisLayoutPanel)) {
                this.gaugeAxisLayoutPanel.destroy();
            }
            this.availableSize = null;
            this.midPoint = null;
            this.activePointer = null;
            this.activeAxis = null;
            this.activeRange = null;
            this.gaugeRect = null;
            this.gaugeAxisLayoutPanel = null;
            this.themeStyle = null;
            this.loadingAnimationDuration = null;
            this.intl = null;
            this.removeSvg();
            this.resizeEvent = null;
            this.svgObject = null;
            this.renderer = null;
        };
        CircularGauge.prototype.requiredModules = function () {
            var modules = [];
            var annotationEnable = false;
            var axes = this.axes;
            axes.map(function (axis) {
                axis.annotations.map(function (annotation) {
                    if (!annotationEnable) {
                        annotationEnable = ((!ej2_base_2.isNullOrUndefined(annotation.content) && annotation.content.length !== 0) || typeof (annotation.content) === 'function');
                    }
                });
            });
            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, print_1.Print],
                    name: 'Print'
                });
            }
            if (this.allowImageExport) {
                modules.push({
                    member: 'ImageExport',
                    args: [this, image_export_1.ImageExport],
                    name: 'ImageExport'
                });
            }
            if (this.allowPdfExport) {
                modules.push({
                    member: 'PdfExport',
                    args: [this, pdf_export_1.PdfExport],
                    name: 'PdfExport'
                });
            }
            if (this.legendSettings.visible) {
                modules.push({
                    member: 'Legend',
                    args: [this, legend_1.Legend],
                    name: 'Legend'
                });
            }
            modules.push({
                member: 'Gradient',
                args: [this, gradient_1.Gradient],
                name: 'Gradient'
            });
            return modules;
        };
        CircularGauge.prototype.getPersistData = function () {
            return this.addOnPersist([]);
        };
        CircularGauge.prototype.onPropertyChanged = function (newProp, oldProp) {
            Eif (!this.isDestroyed) {
                this.isPropertyChange = true;
                var renderer = false;
                this.allowLoadingAnimation = this.animationDuration > 0 && !this.isOverAllAnimationComplete ? true : false;
                var refreshBounds = false;
                var refreshWithoutAnimation = false;
                var isPointerValueSame = (Object.keys(newProp).length === 1 && newProp instanceof Object &&
                    !ej2_base_2.isNullOrUndefined(this.activePointer));
                for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
                    var prop = _a[_i];
                    switch (prop) {
                        case 'height':
                        case 'width':
                        case 'centerX':
                        case 'centerY':
                        case 'margin':
                            this.createSvg();
                            refreshBounds = true;
                            break;
                        case 'animationDuration':
                            this.allowLoadingAnimation = 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 'legendSettings':
                            refreshWithoutAnimation = true;
                            break;
                        case 'axes':
                            var axesPropertyLength = this.axes.length;
                            for (var x = 0; x < axesPropertyLength; x++) {
                                if (!ej2_base_2.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 (!ej2_base_2.isNullOrUndefined(Object.keys(newProp.axes[x].pointers[index]))) {
                                                    this.allowLoadingAnimation = false;
                                                    this.loadingAnimationDuration = [];
                                                    this.isAnimationProgress = this.axes[x].pointers[index].animation.enable;
                                                    this.axes[x].pointers[index]['previousValue'] = this.axes[x].pointers[index]['currentValue'];
                                                    this.axes[x].pointers[index]['isPointerAnimation'] = Object.keys(newProp.axes[x].pointers[index]).indexOf('value') > -1;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            refreshWithoutAnimation = true;
                            break;
                    }
                }
                if (!isPointerValueSame && !this.isRangeUpdate) {
                    if (!refreshBounds && renderer) {
                        this.removeSvg();
                        this.renderElements();
                    }
                    if (refreshBounds || this.allowLoadingAnimation) {
                        this.removeSvg();
                        this.calculateBounds();
                        this.renderElements();
                        if (this.allowLoadingAnimation) {
                            this.allowLoadingAnimation = this.animationDuration > 0 && !this.isOverAllAnimationComplete ? true : false;
                            this.renderAnimation();
                        }
                    }
                    if (refreshWithoutAnimation && !renderer && !refreshBounds && !this.allowLoadingAnimation) {
                        this.removeSvg();
                        this.calculateBounds();
                        this.renderElements(false);
                    }
                }
                this.isRangeUpdate = false;
            }
        };
        CircularGauge.prototype.getModuleName = function () {
            return 'circulargauge';
        };
        var CircularGauge_1;
        __decorate([
            ej2_base_1.Property(null)
        ], CircularGauge.prototype, "width", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularGauge.prototype, "height", void 0);
        __decorate([
            ej2_base_2.Complex({ color: 'transparent', width: 0 }, base_1.Border)
        ], CircularGauge.prototype, "border", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularGauge.prototype, "background", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularGauge.prototype, "title", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], CircularGauge.prototype, "animationDuration", void 0);
        __decorate([
            ej2_base_2.Complex({ size: null, color: null, fontWeight: null, fontFamily: null }, base_1.Font)
        ], CircularGauge.prototype, "titleStyle", void 0);
        __decorate([
            ej2_base_2.Complex({}, base_1.Margin)
        ], CircularGauge.prototype, "margin", void 0);
        __decorate([
            ej2_base_3.Collection([{}], axis_1.Axis)
        ], CircularGauge.prototype, "axes", void 0);
        __decorate([
            ej2_base_2.Complex({}, base_1.TooltipSettings)
        ], CircularGauge.prototype, "tooltip", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "enablePointerDrag", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "enableRangeDrag", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "allowPrint", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "allowImageExport", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "allowPdfExport", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], CircularGauge.prototype, "allowRangePreRender", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularGauge.prototype, "centerX", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularGauge.prototype, "centerY", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "moveToCenter", void 0);
        __decorate([
            ej2_base_1.Property('Material')
        ], CircularGauge.prototype, "theme", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularGauge.prototype, "useGroupingSeparator", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularGauge.prototype, "description", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], CircularGauge.prototype, "tabIndex", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], CircularGauge.prototype, "allowMargin", void 0);
        __decorate([
            ej2_base_2.Complex({}, base_1.LegendSettings)
        ], CircularGauge.prototype, "legendSettings", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "loaded", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "load", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "animationComplete", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "axisLabelRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "radiusCalculate", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "annotationRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "legendRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "tooltipRender", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "dragStart", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "dragMove", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "dragEnd", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "gaugeMouseMove", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "gaugeMouseLeave", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "gaugeMouseDown", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "gaugeMouseUp", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "resized", void 0);
        __decorate([
            ej2_base_3.Event()
        ], CircularGauge.prototype, "beforePrint", void 0);
        CircularGauge = CircularGauge_1 = __decorate([
            ej2_base_1.NotifyPropertyChanges
        ], CircularGauge);
        return CircularGauge;
    }(ej2_base_1.Component));
    exports.CircularGauge = CircularGauge;
});