all files / linear-gauge/axes/ axis-renderer.js

91.04% Statements 315/346
87.69% Branches 285/325
95.83% Functions 23/24
90.96% Lines 312/343
11 statements, 6 functions, 9 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          498×   549× 549× 549× 549× 549× 549× 549× 26×   549×       549× 549× 614× 614× 614× 614× 614× 16×     16×   16× 16×     614× 614× 614× 614× 614× 614× 614×   549× 614×   549× 549× 16×     16× 16× 16× 16× 16× 20× 19×               17× 15×               614× 614× 614× 614× 614× 596×   596× 596× 596× 13×   596×     1228× 1228× 1228× 1228× 1228× 1228× 1228× 1228× 1228× 1228× 1228× 23239× 23239× 8688× 8688× 8688×     14551× 14551× 14551×       1228× 1228× 1228× 32×   1228×   614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 614× 6446× 6446× 6446× 6446× 2878× 2878× 2878× 2878× 2878×     3568× 16×                 12×                                                             16× 16× 16× 16× 16×     3552× 3552× 3552× 3552× 3552× 3552×     6446×               6446× 6446× 6446× 6446× 6446× 6446× 6446×   614× 16×   614×   614× 614× 614× 614× 614× 706× 706× 706× 706×     706× 121×   706× 65× 65× 17×     706× 706×     614× 614×   1394× 1394× 1394× 1394× 1394× 1394× 1394× 1394× 1394× 1394× 26×   1394×     1394× 1394× 1394×   1258×           1394× 1394× 1394× 28× 28× 28×             1394×     1394× 20×   1394× 1394× 20× 20× 20×   1394× 1352×   1394× 1394×   117× 117× 117× 117× 117× 117× 117× 117× 117× 117× 13×   117×     117× 92×   92× 92×     25× 25× 25× 25×   117×                         117×   117× 117× 117×   117× 20× 20×   20× 16× 16×     117× 96×     16× 18× 18×       13× 13× 12×           614× 614× 614× 614× 16×   614× 771× 771× 755× 755×     614×                     468× 468× 468× 468×        
/* 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 __());
    };
})();
define(["require", "exports", "@syncfusion/ej2-base", "./animation", "../utils/helper", "../utils/helper"], function (require, exports, ej2_base_1, animation_1, helper_1, helper_2) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var AxisRenderer = (function (_super) {
        __extends(AxisRenderer, _super);
        function AxisRenderer(gauge) {
            return _super.call(this, gauge) || this;
        }
        AxisRenderer.prototype.renderAxes = function () {
            var _this = this;
            var axis;
            var major;
            var minor;
            this.axisElements = [];
            var gaugeAxesG = this.gauge.svgObject.querySelector('#' + this.gauge.element.id + '_Axis_Collections');
            if (gaugeAxesG) {
                ej2_base_1.remove(gaugeAxesG);
            }
            this.axisObject = this.gauge.renderer.createGroup({
                id: this.gauge.element.id + '_Axis_Collections',
                transform: 'translate( 0, 0 )'
            });
            this.gauge.splitUpCount = 0;
            for (var i = 0; i < this.gauge.axes.length; i++) {
                axis = this.gauge.axes[i];
                major = axis.majorTicks;
                minor = axis.minorTicks;
                this.htmlObject = this.gauge.renderer.createGroup({ id: this.gauge.element.id + '_Axis_Group_' + i });
                if (this.gauge.allowLoadingAnimation) {
                    Eif (this.gauge.splitUpCount === 0 && (axis.line.width > 0 || (axis.majorTicks.height > 0 && axis.majorTicks.width > 0) ||
                        (axis.minorTicks.height > 0 && axis.minorTicks.width > 0) || this.gauge.container.width > 0 || (axis.ranges.length > 0
                        && !(axis.ranges.length === 1 && axis.ranges[0].start === axis.ranges[0].end && axis.ranges[0].start === 0)))) {
                        this.gauge.splitUpCount++;
                    }
                    Eif (this.gauge.splitUpCount === 0 || this.gauge.splitUpCount === 1) {
                        this.gauge.splitUpCount = axis.pointers.length > 0 ? this.gauge.splitUpCount + 1 : this.gauge.splitUpCount;
                    }
                }
                this.drawAxisLine(axis, this.htmlObject, i);
                this.drawRanges(axis, this.htmlObject, i);
                this.drawTicks(axis, major, this.htmlObject, 'MajorTicks', axis.majorTickBounds, i);
                this.drawTicks(axis, minor, this.htmlObject, 'MinorTicks', axis.minorTickBounds, i);
                this.drawAxisLabels(axis, this.htmlObject, i);
                this.drawPointers(axis, this.htmlObject, i);
                this.axisElements.push(this.htmlObject);
            }
            this.axisElements.forEach(function (axisElement) {
                _this.axisObject.appendChild(axisElement);
            });
            this.gauge.svgObject.appendChild(this.axisObject);
            if (this.gauge.nearSizes.length !== this.gauge.farSizes.length && this.gauge.axes.length > 1) {
                this.axisAlign(this.gauge.axes);
            }
        };
        AxisRenderer.prototype.axisAlign = function (axes) {
            var nearAxisWidth = 0;
            var farAxisWidth = 0;
            var tranX;
            var transY;
            if (this.gauge.orientation === 'Vertical') {
                axes.forEach(function (axis) {
                    if (!axis.opposedPosition) {
                        nearAxisWidth += axis.bounds.width;
                    }
                    else {
                        farAxisWidth += axis.bounds.width;
                    }
                });
                nearAxisWidth += this.gauge.containerBounds.width / 2;
                farAxisWidth += this.gauge.containerBounds.width / 2;
                tranX = (nearAxisWidth / 2) - (farAxisWidth / 2);
                this.axisObject.setAttribute('transform', 'translate(' + tranX + ',0)');
                if (!(ej2_base_1.isNullOrUndefined(this.gauge.containerObject))) {
                    this.gauge.containerObject.setAttribute('transform', 'translate(' + tranX + ',0)');
                }
            }
            else {
                axes.forEach(function (axis) {
                    if (!axis.opposedPosition) {
                        nearAxisWidth += axis.bounds.height;
                    }
                    else {
                        farAxisWidth += axis.bounds.height;
                    }
                });
                nearAxisWidth += (this.gauge.containerBounds.height / 2);
                farAxisWidth += (this.gauge.containerBounds.height / 2);
                transY = (nearAxisWidth / 2) - (farAxisWidth / 2);
                this.axisObject.setAttribute('transform', 'translate(0,' + transY + ')');
                if (!(ej2_base_1.isNullOrUndefined(this.gauge.containerObject))) {
                    this.gauge.containerObject.setAttribute('transform', 'translate(0,' + transY + ')');
                }
            }
        };
        AxisRenderer.prototype.drawAxisLine = function (axis, axisObject, axisIndex) {
            var options;
            var rect = axis.lineBounds;
            var path = '';
            var color = axis.line.color || this.gauge.themeStyle.lineColor;
            if (axis.line.width > 0) {
                path = 'M' + rect.x + ' ' + rect.y + ' L ' + (this.gauge.orientation === 'Vertical' ? rect.x : rect.x + rect.width) +
                    ' ' + (this.gauge.orientation === 'Vertical' ? rect.y + rect.height : rect.y) + 'z';
                options = new helper_1.PathOption(this.gauge.element.id + '_AxisLine_' + axisIndex, color, axis.line.width, color, 1, axis.line.dashArray, path);
                var axisElement = this.gauge.renderer.drawPath(options);
                if (this.gauge.allowLoadingAnimation) {
                    axisElement.classList.add(this.gauge.element.id + 'animation');
                }
                axisObject.appendChild(axisElement);
            }
        };
        AxisRenderer.prototype.drawTicks = function (axis, ticks, axisObject, tickID, tickBounds, axisIndex) {
            var tickPath = '';
            var pointY;
            var pointX;
            var range = axis.visibleRange;
            var line = axis.lineBounds;
            var majorTickColor = axis.majorTicks.color || this.gauge.themeStyle.majorTickColor;
            var minorTickColor = axis.minorTicks.color || this.gauge.themeStyle.minorTickColor;
            var tickColor = (tickID === 'MajorTicks') ? majorTickColor : minorTickColor;
            var interval = ((tickID === 'MajorTicks') ? axis.majorInterval : axis.minorInterval);
            var tickHeight = (axis.minimum !== axis.maximum) ? ticks.height : 0;
            for (var i = range.min; (i <= range.max && interval > 0); i += interval) {
                Eif ((tickID === 'MajorTicks') || (tickID === 'MinorTicks')) {
                    if (this.gauge.orientation === 'Vertical') {
                        pointX = tickBounds.x;
                        pointY = (helper_1.valueToCoefficient(i, axis, this.gauge.orientation, range) * line.height) + line.y;
                        tickPath = tickPath.concat('M' + pointX + ' ' + pointY + ' ' + 'L' + (pointX + tickHeight) + ' ' + pointY + ' ');
                    }
                    else {
                        pointX = (helper_1.valueToCoefficient(i, axis, this.gauge.orientation, range) * line.width) + line.x;
                        pointY = tickBounds.y;
                        tickPath = tickPath.concat('M' + pointX + ' ' + pointY + ' ' + 'L' + pointX + ' ' + (pointY + tickHeight) + ' ');
                    }
                }
            }
            var options = new helper_1.PathOption(this.gauge.element.id + '_' + tickID + 'Line_' + axisIndex, tickColor, ticks.width, tickColor, 1, null, tickPath);
            var tickElement = this.gauge.renderer.drawPath(options);
            if (this.gauge.allowLoadingAnimation) {
                tickElement.classList.add(this.gauge.element.id + 'animation');
            }
            axisObject.appendChild(tickElement);
        };
        AxisRenderer.prototype.drawAxisLabels = function (axis, axisObject, axisIndex) {
            var options;
            var pointX;
            var pointY;
            var rect = axis.lineBounds;
            var bounds = axis.labelBounds;
            var tick = axis.majorTickBounds;
            var labelSize;
            var range = axis.visibleRange;
            var anchor;
            var baseline;
            var padding = 5;
            var fontColor = this.gauge.themeStyle.labelColor;
            var labelColor;
            var offset = axis.labelStyle.offset;
            var labelLength = axis.visibleLabels.length - 1;
            var labelElement = this.gauge.renderer.createGroup({ id: this.gauge.element.id + '_AxisLabelsGroup_' + axisIndex });
            for (var i = 0; i < axis.visibleLabels.length; i++) {
                labelSize = axis.visibleLabels[i].size;
                labelColor = axis.labelStyle.useRangeColor ? helper_2.getRangeColor(axis.visibleLabels[i].value, axis.ranges) : null;
                labelColor = ej2_base_1.isNullOrUndefined(labelColor) ? (axis.labelStyle.font.color || fontColor) : labelColor;
                if (this.gauge.orientation === 'Vertical') {
                    pointY = (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.height) + rect.y;
                    pointX = axis.labelStyle.position === 'Auto' ? (!axis.opposedPosition ? (tick.x - labelSize.width - padding) + offset : bounds.x) : bounds.x;
                    pointY += (labelSize.height / 4);
                    axis.visibleLabels[i].x = pointX;
                    axis.visibleLabels[i].y = pointY;
                }
                else {
                    if ((i === 0 || i === labelLength) && this.gauge.edgeLabelPlacement !== 'None') {
                        if (this.gauge.edgeLabelPlacement === 'Shift') {
                            pointX = i === 0 ? (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x + (!axis.isInversed ? (axis.visibleLabels[i].size.width / 2) : (-axis.visibleLabels[i].size.width / 2))
                                : (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x - (!axis.isInversed ? (axis.visibleLabels[i].size.width / 2) : (-axis.visibleLabels[i].size.width / 2));
                            Eif (this.gauge.allowMargin) {
                                if (i === labelLength) {
                                    Iif (!axis.isInversed && (pointX - (axis.visibleLabels[i].size.width / 2)) < (axis.visibleLabels[i - 1].x + (axis.visibleLabels[i - 1].size.width / 2))) {
                                        pointX += (axis.visibleLabels[i].size.width / 2);
                                    }
                                    else Iif (axis.isInversed && (pointX + (axis.visibleLabels[i].size.width / 2)) > (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2))) {
                                        pointX -= (axis.visibleLabels[i].size.width / 2);
                                    }
                                }
                            }
                        }
                        else if (this.gauge.edgeLabelPlacement === 'Trim') {
                            pointX = (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x;
                            if (i === labelLength) {
                                if (!this.gauge.allowMargin) {
                                    if (!axis.isInversed && this.gauge.margin.right <= 10) {
                                        var maxWidth = axis.visibleLabels[i].size.width * 0.75;
                                        axis.visibleLabels[i].text = helper_1.textTrim(maxWidth, axis.visibleLabels[i].text, axis.labelStyle.font);
                                    }
                                    else Eif (axis.isInversed && (pointX + (axis.visibleLabels[i].size.width / 2)) > (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2))) {
                                        var maxWidth = axis.visibleLabels[i].size.width - ((pointX + (axis.visibleLabels[i].size.width / 2)) - (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2)) + 2);
                                        axis.visibleLabels[i].text = helper_1.textTrim(maxWidth, axis.visibleLabels[i].text, axis.labelStyle.font);
                                    }
                                }
                                else {
                                    Iif (axis.isInversed && (pointX + (axis.visibleLabels[i].size.width / 2)) > (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2))) {
                                        var width = axis.visibleLabels[i].size.width - ((pointX + (axis.visibleLabels[i].size.width / 2)) - (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2)) + 2);
                                        axis.visibleLabels[i].text = helper_1.textTrim(width, axis.visibleLabels[i].text, axis.labelStyle.font);
                                    }
                                    else Iif (!axis.isInversed && (pointX - (axis.visibleLabels[i].size.width / 2)) < (axis.visibleLabels[i - 1].x + (axis.visibleLabels[i - 1].size.width / 2))) {
                                        var width = axis.visibleLabels[i].size.width - ((axis.visibleLabels[i - 1].x + (axis.visibleLabels[i - 1].size.width / 2)) - (pointX - (axis.visibleLabels[i].size.width / 2)) + 2);
                                        axis.visibleLabels[i].text = helper_1.textTrim(width, axis.visibleLabels[i].text, axis.labelStyle.font);
                                    }
                                }
                            }
                        }
                        else Eif (this.gauge.edgeLabelPlacement === 'Auto') {
                            if (!this.gauge.allowMargin) {
                                pointX = i === labelLength ? (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x - (!axis.isInversed ? (axis.visibleLabels[i].size.width / 2) : (-axis.visibleLabels[i].size.width / 2)) :
                                    (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x + (!axis.isInversed ? (axis.visibleLabels[i].size.width / 2) : (-axis.visibleLabels[i].size.width / 2));
                                if (i === labelLength) {
                                    Iif (!axis.isInversed && (pointX - (axis.visibleLabels[i].size.width / 2)) < (axis.visibleLabels[i - 1].x + (axis.visibleLabels[i - 1].size.width / 2))) {
                                        pointX += (axis.visibleLabels[i].size.width / 2);
                                        var maxWidth = axis.visibleLabels[i].size.width * 0.75;
                                        axis.visibleLabels[i].text = helper_1.textTrim(maxWidth, axis.visibleLabels[i].text, axis.labelStyle.font);
                                    }
                                    else Iif (axis.isInversed && (pointX + (axis.visibleLabels[i].size.width / 2)) > (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2))) {
                                        pointX -= (axis.visibleLabels[i].size.width / 2);
                                        var widthValue = axis.visibleLabels[i].size.width - ((pointX + (axis.visibleLabels[i].size.width / 2)) - (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2)) + 2);
                                        axis.visibleLabels[i].text = helper_1.textTrim(widthValue, axis.visibleLabels[i].text, axis.labelStyle.font);
                                    }
                                }
                            }
                            else {
                                pointX = (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x;
                                Iif (i === labelLength && axis.isInversed && (pointX + (axis.visibleLabels[i].size.width / 2)) > (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2))) {
                                    var labelWidth = axis.visibleLabels[i].size.width - ((pointX + (axis.visibleLabels[i].size.width / 2)) - (axis.visibleLabels[i - 1].x - (axis.visibleLabels[i - 1].size.width / 2)) + 2);
                                    axis.visibleLabels[i].text = helper_1.textTrim(labelWidth, axis.visibleLabels[i].text, axis.labelStyle.font);
                                }
                            }
                        }
                        pointY = bounds.y;
                        axis.visibleLabels[i].x = pointX;
                        axis.visibleLabels[i].y = pointY;
                        anchor = 'middle';
                        baseline = '';
                    }
                    else {
                        pointX = (helper_1.valueToCoefficient(axis.visibleLabels[i].value, axis, this.gauge.orientation, range) * rect.width) + rect.x;
                        pointY = bounds.y;
                        anchor = 'middle';
                        baseline = '';
                        axis.visibleLabels[i].x = pointX;
                        axis.visibleLabels[i].y = pointY;
                    }
                }
                var style = {
                    size: axis.labelStyle.font.size,
                    color: axis.labelStyle.font.color,
                    fontFamily: axis.labelStyle.font.fontFamily,
                    fontWeight: axis.labelStyle.font.fontWeight,
                    fontStyle: axis.labelStyle.font.fontStyle,
                    opacity: axis.labelStyle.font.opacity
                };
                style.fontFamily = style.fontFamily || this.gauge.themeStyle.labelFontFamily;
                style.fontStyle = style.fontStyle || this.gauge.themeStyle.labelStyle;
                style.fontWeight = style.fontWeight || this.gauge.themeStyle.labelWeight;
                options = new helper_2.TextOption(this.gauge.element.id + '_Axis_' + axisIndex + '_Label_' + i, pointX, pointY, anchor, axis.visibleLabels[i].text, null, baseline);
                var axisLabelsElement = helper_1.textElement(options, style, labelColor, null, labelElement);
                axisLabelsElement.setAttribute('aria-label', axis.visibleLabels[i].text);
                axisLabelsElement.setAttribute('role', 'region');
            }
            if (this.gauge.allowLoadingAnimation) {
                labelElement.classList.add(this.gauge.element.id + 'animation');
            }
            axisObject.appendChild(labelElement);
        };
        AxisRenderer.prototype.drawPointers = function (axis, axisObject, axisIndex) {
            var pointer;
            var clipId;
            var pointerClipRectGroup;
            var pointesGroup = this.gauge.renderer.createGroup({ id: this.gauge.element.id + '_PointersGroup_' + axisIndex });
            for (var i = 0; i < axis.pointers.length; i++) {
                pointer = axis.pointers[i];
                clipId = 'url(#' + this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + '_' + pointer.type + 'ClipRect_' + i + ')';
                Eif (!(ej2_base_1.isNullOrUndefined(pointer.bounds))) {
                    pointerClipRectGroup = this.gauge.renderer.createGroup({
                        'id': this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + pointer.type + 'PointerGroup_' + i
                    });
                    if (ej2_base_1.isNullOrUndefined(pointer.startValue)) {
                        pointer.startValue = axis.visibleRange.min;
                    }
                    if ((ej2_base_1.animationMode === 'Enable' || pointer.animationDuration > 0 || this.gauge.allowLoadingAnimation) && (!this.gauge.isPropertyChange || pointer['isPointerAnimation']) && !this.gauge.gaugeResized) {
                        pointer.startValue = !this.gauge.isPropertyChange ? axis.minimum : pointer.startValue;
                        if (this.gauge.container.type === 'Thermometer' && pointer.startValue === 0) {
                            pointerClipRectGroup.setAttribute('clip-path', clipId);
                        }
                    }
                    this['draw' + pointer.type + 'Pointer'](axis, axisIndex, pointer, i, pointerClipRectGroup);
                    pointesGroup.appendChild(pointerClipRectGroup);
                }
            }
            this.gauge.gradientCount = 0;
            axisObject.appendChild(pointesGroup);
        };
        AxisRenderer.prototype.drawMarkerPointer = function (axis, axisIndex, pointer, pointerIndex, parentElement) {
            var options;
            var textOptions;
            var style = {};
            var pointerID = this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + pointer.type + 'Pointer' + '_' + pointerIndex;
            var transform = 'translate( 0, 0 )';
            var x;
            var y;
            var pointerElement;
            var gradientMarkerColor;
            if (this.gauge.gradientModule) {
                gradientMarkerColor = this.gauge.gradientModule.getGradientColorString(pointer);
            }
            Iif (helper_1.getElement(pointerID) && helper_1.getElement(pointerID).childElementCount > 0) {
                ej2_base_1.remove(helper_1.getElement(pointerID));
            }
            var pointerColor = pointer.color || this.gauge.themeStyle.pointerColor;
            var shapeBasedOnPosition = pointer.markerType;
            if (!ej2_base_1.isNullOrUndefined(pointer.position) && (pointer.markerType === 'InvertedTriangle' ||
                pointer.markerType === 'Triangle')) {
                shapeBasedOnPosition = (((pointer.position === 'Outside' && !axis.opposedPosition) ||
                    (pointer.position === 'Inside' && axis.opposedPosition) || pointer.position === 'Cross')
                    && pointer.markerType === 'Triangle' ? 'InvertedTriangle' :
                    (((pointer.position === 'Inside' && !axis.opposedPosition) || (pointer.position === 'Outside' && axis.opposedPosition)) &&
                        pointer.markerType === 'InvertedTriangle' ? 'Triangle' : pointer.markerType));
            }
            options = new helper_1.PathOption(pointerID, (gradientMarkerColor) ? gradientMarkerColor : pointerColor, pointer.border.width, pointer.border.color, pointer.opacity, pointer.border.dashArray, null, transform);
            options = helper_2.calculateShapes(pointer.bounds, shapeBasedOnPosition, new helper_1.Size(pointer.width, pointer.height), pointer.imageUrl, options, this.gauge.orientation, axis, pointer);
            if (pointer.markerType === 'Text') {
                textOptions = new helper_2.TextOption(pointerID, x, y, 'start', pointer.text, null, 'auto');
                textOptions = helper_2.calculateTextPosition(pointer.bounds, shapeBasedOnPosition, textOptions, this.gauge.orientation, axis, pointer);
                style = {
                    size: pointer.textStyle.size,
                    fontFamily: pointer.textStyle.fontFamily || this.gauge.themeStyle.labelFontFamily,
                    fontWeight: pointer.textStyle.fontWeight,
                    fontStyle: pointer.textStyle.fontStyle
                };
            }
            pointerElement = ((pointer.markerType === 'Circle' ? this.gauge.renderer.drawCircle(options)
                : (pointer.markerType === 'Image') ? this.gauge.renderer.drawImage(options) : (pointer.markerType === 'Text') && !ej2_base_1.isNullOrUndefined(pointer.text) ? helper_1.textElement(textOptions, style, (gradientMarkerColor) ? gradientMarkerColor : pointerColor, pointer.opacity, parentElement) :
                    this.gauge.renderer.drawPath(options)));
            if (this.gauge.allowLoadingAnimation) {
                pointerElement.style.visibility = 'hidden';
            }
            parentElement.appendChild(pointerElement);
            if ((((pointer.animationDuration > 0 || ej2_base_1.animationMode === 'Enable') && (!this.gauge.allowLoadingAnimation || this.gauge.isPropertyChange)) && (!this.gauge.isPropertyChange || pointer['isPointerAnimation']) && pointer['startValue'] !== pointer.currentValue) && !this.gauge.isPointerAnimationInProgress) {
                pointer.startValue = !this.gauge.isPropertyChange ? axis.minimum : pointer.startValue;
                pointer.animationComplete = false;
                this.performMarkerAnimation(pointerElement, axis, pointer);
            }
            if (!this.gauge.allowLoadingAnimation && pointer.animationDuration === 0) {
                pointer.startValue = pointer.currentValue;
            }
            pointerElement.setAttribute('aria-label', pointer.description || 'Pointer:' + Number(pointer.currentValue).toString());
            pointerElement.setAttribute('role', 'region');
        };
        AxisRenderer.prototype.drawBarPointer = function (axis, axisIndex, pointer, pointerIndex, parentElement) {
            var rectOptions;
            var clipRectElement;
            var pointerElement;
            var path = '';
            var options;
            var box;
            var size = new helper_1.Size(this.gauge.availableSize.width, this.gauge.availableSize.height);
            var pointerID = this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + pointer.type + 'Pointer' + '_' + pointerIndex;
            var gradientBarColor;
            if (this.gauge.gradientModule) {
                gradientBarColor = this.gauge.gradientModule.getGradientColorString(pointer);
            }
            Iif (helper_1.getElement(pointerID) && helper_1.getElement(pointerID).childElementCount > 0) {
                ej2_base_1.remove(helper_1.getElement(pointerID));
            }
            if (this.gauge.container.type === 'Normal' || this.gauge.container.width === 0) {
                rectOptions = new helper_2.RectOption(pointerID, (gradientBarColor) ?
                    gradientBarColor : pointer.color || this.gauge.themeStyle.pointerColor, pointer.border, pointer.opacity, pointer.bounds);
                box = pointer.bounds;
                pointerElement = this.gauge.renderer.drawRectangle(rectOptions);
            }
            else {
                path = pointer.value > axis.minimum || this.gauge.container.type === 'Thermometer' ? helper_2.getBox(pointer.bounds, this.gauge.container.type, this.gauge.orientation, new helper_1.Size(pointer.bounds.width, pointer.bounds.height), 'bar', this.gauge.container.width, axis, pointer.roundedCornerRadius) : '';
                options = new helper_1.PathOption(pointerID, (gradientBarColor) ? gradientBarColor : pointer.color || this.gauge.themeStyle.pointerColor, pointer.border.width, pointer.border.color, pointer.opacity, pointer.border.dashArray, path);
                pointerElement = this.gauge.renderer.drawPath(options);
                box = helper_2.getPathToRect(pointerElement.cloneNode(true), size, this.gauge.element);
            }
            Iif (helper_1.getElement(pointerID) && helper_1.getElement(pointerID).childElementCount > 0) {
                var element = helper_1.getElement(pointerID).firstElementChild;
                if (this.gauge.container.type === 'Normal') {
                    element.setAttribute('x', rectOptions.x + '');
                    element.setAttribute('y', rectOptions.y + '');
                    element.setAttribute('width', rectOptions.width + '');
                    element.setAttribute('height', rectOptions.height + '');
                }
                else {
                    element.setAttribute('d', options.d);
                }
            }
            else {
                parentElement.appendChild(pointerElement);
            }
            pointerElement.setAttribute('aria-label', pointer.description || 'Pointer:' + Number(pointer.currentValue).toString());
            pointerElement.setAttribute('role', 'region');
            if (this.gauge.allowLoadingAnimation) {
                pointerElement.style.visibility = 'hidden';
            }
            if (((pointer.animationDuration > 0 || this.gauge.allowLoadingAnimation || ej2_base_1.animationMode === 'Enable') && (!this.gauge.isPropertyChange || pointer['isPointerAnimation']) && pointer['startValue'] !== pointer.currentValue) && !this.gauge.isPointerAnimationInProgress) {
                pointer.startValue = !this.gauge.isPropertyChange ? axis.minimum : pointer.startValue;
                if (this.gauge.container.type === 'Thermometer' && pointer.startValue === 0 && this.gauge.container.width > 0) {
                    clipRectElement = this.gauge.renderer.drawClipPath(new helper_2.RectOption(this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + '_' + pointer.type + 'ClipRect_' + pointerIndex, 'transparent', { width: 1, color: 'Gray' }, 1, box));
                    parentElement.appendChild(clipRectElement);
                }
                if (!this.gauge.allowLoadingAnimation || this.gauge.isPropertyChange) {
                    pointer.isPointerAnimation = false;
                    this.performBarAnimation(pointerElement, axis, pointer);
                }
            }
            if (pointer.animationDuration === 0) {
                pointer.startValue = pointer.currentValue;
            }
        };
        AxisRenderer.prototype.pointerAnimation = function (axis, axisIndex) {
            if ((!this.gauge.isPointerAnimationInProgress && this.gauge.allowLoadingAnimation)) {
                this.gauge.isPointerAnimationInProgress = true;
                for (var i = 0; i < axis.pointers.length; i++) {
                    var pointer = axis.pointers[i];
                    if (pointer.type === 'Bar') {
                        var barPointerGroup = helper_1.getElement(this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + pointer.type + 'Pointer_' + i);
                        Eif (barPointerGroup) {
                            this.performBarAnimation(barPointerGroup, axis, pointer);
                        }
                    }
                    else {
                        var markerPointerGroup = helper_1.getElement(this.gauge.element.id + '_AxisIndex_' + axisIndex + '_' + pointer.type + 'Pointer_' + i);
                        if (markerPointerGroup) {
                            this.performMarkerAnimation(markerPointerGroup, axis, pointer);
                        }
                    }
                }
            }
        };
        AxisRenderer.prototype.drawRanges = function (axis, axisObject, axisIndex) {
            var range;
            var options;
            var rangeElement = this.gauge.renderer.createGroup({ id: this.gauge.element.id + '_RangesGroup_' + axisIndex });
            if (this.gauge.allowLoadingAnimation) {
                rangeElement.classList.add(this.gauge.element.id + 'animation');
            }
            for (var j = 0; j < axis.ranges.length; j++) {
                range = axis.ranges[j];
                if (!(ej2_base_1.isNullOrUndefined(range.path))) {
                    options = new helper_1.PathOption(this.gauge.element.id + '_AxisIndex_' + axisIndex + '_Range_' + j, range.interior, (range.start !== range.end) ? range.border.width : 0, range.border.color, 1, range.border.dashArray, range.path);
                    rangeElement.appendChild(this.gauge.renderer.drawPath(options));
                }
            }
            axisObject.appendChild(rangeElement);
        };
        AxisRenderer.prototype.updateTextPointer = function (pointerId, pointer, axis) {
            var x;
            var y;
            var textOptions = new helper_2.TextOption(pointerId, x, y, 'start', pointer.text, null, 'auto');
            textOptions = helper_2.calculateTextPosition(pointer.bounds, 'Text', textOptions, this.gauge.orientation, axis, pointer);
            var textElement = document.getElementById(pointerId);
            textElement.setAttribute('x', textOptions.x.toString());
            textElement.setAttribute('y', textOptions.y.toString());
            textElement.textContent = pointer.text;
        };
        AxisRenderer.prototype.destroy = function () {
            this.htmlObject = null;
            this.axisObject = null;
            this.axisElements = [];
            this.gauge = null;
        };
        return AxisRenderer;
    }(animation_1.Animations));
    exports.AxisRenderer = AxisRenderer;
});