all files / circularchart3d/renderer/ series.js

97.7% Statements 383/392
88.89% Branches 192/216
97.3% Functions 36/37
98.18% Lines 377/384
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              2467× 2467× 2467×     10×             418× 418× 418× 418× 418× 418× 418× 418× 418× 418× 418×   305× 305× 305× 305× 305×         305× 305×     305× 305× 305× 305×   305× 302× 302×     305× 305× 305×   299× 299× 299× 299× 299× 2467× 2467× 17×   2467×     2467× 2467× 2467× 2467×       2467× 2467× 2467× 2467×   299× 299× 2467×   2447×       2467× 2467× 2467× 2467× 2467× 2467× 2467× 2467× 2467× 2467× 2467× 2467× 2467×   356× 356× 356× 356× 356× 356×     356× 356× 356×     356×   356× 356× 154×   356× 356× 356× 356×   712× 712× 712× 712× 712× 712× 712× 712× 712× 712× 712×   712×   712× 442× 356×       86×       712× 712× 712× 232× 232× 232× 232×     480× 480× 480×   480×     356× 356× 356× 356× 356× 356× 356× 356×         356× 356× 2681× 2681× 2681× 2681×       2681× 2681× 2680× 8740× 1051×   8740× 8740× 36537×             356× 1051× 36537× 36537×     356×   2681× 2681× 2681× 2681× 2681×   2680× 2680× 2680× 2680× 2680× 23584× 23584× 23584× 23584×   23584×   23584×   2680× 2680× 2680× 20904×           20904× 20904×   2680× 2680× 700× 700× 4913×           4913× 4913×   700×   2680× 2680× 2680× 23584× 23584×   2680× 700× 5613× 5613×       1980× 1980×   2680× 2680× 2680× 2680× 2680× 2680× 700×           700×           700× 700× 700× 700× 700×     1980×           1980×           1980× 1980× 1980× 1980× 1980×   2680×   356× 356× 356× 356× 356× 356× 2702× 2681×     356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 356× 2702× 2681× 2681× 2681× 2681× 2681× 2681× 2681×                 2681×   2681× 2681× 2681×   40× 40× 40× 40×   2681× 2681× 2681×   2681× 2681× 2681× 2681×     356×   2681× 2681× 2681× 2681× 2681× 2681× 2681× 2681×   2681× 2681× 2681×   2679×   2681×                                 187763×   356× 356× 356× 2702×   356×   1549× 1549× 1549× 1549×   2467× 2447×   20× 20× 20× 20×       17× 17×                                                                                               302×   1315×          
/* 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", "../../common/model/base", "../../common/utils/helper", "@syncfusion/ej2-svg-base", "@syncfusion/ej2-data", "../../common/model/constants", "../model/theme", "./dataLabel"], function (require, exports, ej2_base_1, base_1, helper_1, ej2_svg_base_1, ej2_data_1, constants_1, theme_1, dataLabel_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CircularChart3DPoints = (function () {
        function CircularChart3DPoints() {
            this.visible = true;
            this.isExplode = false;
            this.argsData = null;
        }
        return CircularChart3DPoints;
    }());
    exports.CircularChart3DPoints = CircularChart3DPoints;
    var CircularChart3DEmptyPointSettings = (function (_super) {
        __extends(CircularChart3DEmptyPointSettings, _super);
        function CircularChart3DEmptyPointSettings() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        __decorate([
            ej2_base_1.Property(null)
        ], CircularChart3DEmptyPointSettings.prototype, "fill", void 0);
        __decorate([
            ej2_base_1.Property('Gap')
        ], CircularChart3DEmptyPointSettings.prototype, "mode", void 0);
        return CircularChart3DEmptyPointSettings;
    }(ej2_base_1.ChildProperty));
    exports.CircularChart3DEmptyPointSettings = CircularChart3DEmptyPointSettings;
    var CircularChart3DSeries = (function (_super) {
        __extends(CircularChart3DSeries, _super);
        function CircularChart3DSeries() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this.points = [];
            _this.sumOfPoints = 0;
            _this.isRectSeries = true;
            _this.clipRect = new ej2_svg_base_1.Rect(0, 0, 0, 0);
            _this.category = 'Series';
            _this.rightSidePoints = [];
            _this.leftSidePoints = [];
            _this.segments = [];
            _this.isExploded = false;
            return _this;
        }
        CircularChart3DSeries.prototype.refreshDataManager = function (chart, render) {
            var _this = this;
            var dateSource = this.dataSource || chart.dataSource;
            Eif (!(dateSource instanceof ej2_data_1.DataManager) && ej2_base_1.isNullOrUndefined(this.query)) {
                this.dataManagerSuccess({ result: dateSource, count: dateSource.length }, chart, render);
                return;
            }
            var dataManager = this.dataModule.getData(this.dataModule.generateQuery().requiresCount());
            dataManager.then(function (e) { return _this.dataManagerSuccess(e, chart); });
        };
        CircularChart3DSeries.prototype.dataManagerSuccess = function (dataObject, chart, render) {
            Iif (render === void 0) { render = true; }
            var argsData = {
                name: constants_1.seriesRender, series: this, data: dataObject.result
            };
            chart.allowServerDataBinding = false;
            chart.trigger(constants_1.seriesRender, argsData);
            this.resultData = dataObject.result !== '' ? dataObject.result : [];
            if (!render) {
                this.getPoints(this.resultData, chart);
            }
            if ((++chart.seriesCounts === chart.visibleSeries.length && render)) {
                this.getPoints(this.resultData, chart);
                chart.refreshChart();
            }
        };
        CircularChart3DSeries.prototype.getPoints = function (result, chart) {
            var length = Object.keys(result).length;
            this.sumOfPoints = 0;
            if (length === 0) {
                this.points = [];
                return null;
            }
            this.findSumOfPoints(result);
            this.points = [];
            var point;
            var colors = this.palettes.length ? this.palettes : theme_1.getCircular3DSeriesColor(chart.theme);
            for (var i = 0; i < length; i++) {
                point = this.setPoints(result, i, chart);
                if (ej2_base_1.isNullOrUndefined(point.y)) {
                    point.visible = false;
                }
                this.pushPoints(point, colors, chart);
            }
        };
        CircularChart3DSeries.prototype.pushPoints = function (point, colors, chart) {
            point.index = this.points.length;
            point.isExplode = this.explodeAll || (point.index === this.explodeIndex);
            point.color = point.color || colors[point.index % colors.length];
            var argsData = {
                cancel: false, name: constants_1.pointRender, series: this, point: point,
                fill: point.color
            };
            chart.trigger(constants_1.pointRender, argsData);
            point.color = argsData.fill;
            point.visible = !argsData.cancel;
            this.points.push(point);
        };
        CircularChart3DSeries.prototype.findSumOfPoints = function (result) {
            var length = Object.keys(result).length;
            for (var i = 0; i < length; i++) {
                if (!ej2_base_1.isNullOrUndefined(result[i]) &&
                    !ej2_base_1.isNullOrUndefined(result[i][this.yName]) && !isNaN(result[i][this.yName])) {
                    this.sumOfPoints += Math.abs(result[i][this.yName]);
                }
            }
        };
        CircularChart3DSeries.prototype.setPoints = function (data, index, chart) {
            var point = new CircularChart3DPoints();
            point.x = ej2_base_1.getValue(this.xName, data[index]);
            point.y = ej2_base_1.getValue(this.yName, data[index]);
            point.percentage = (+(point.y / this.sumOfPoints * 100).toFixed(2));
            point.legendImageUrl = ej2_base_1.getValue(this.legendImageUrl, data[index]);
            point.color = ej2_base_1.getValue(this.pointColorMapping, data[index]);
            point.text = point.originalText = ej2_base_1.getValue(this.dataLabel.name || '', data[index]);
            point.tooltip = ej2_base_1.getValue(this.tooltipMappingName || '', data[index]);
            point.sliceRadius = ej2_base_1.getValue(this.radius ? this.radius : '80%', data[index]);
            point.sliceRadius = ej2_base_1.isNullOrUndefined(point.sliceRadius) ? '80%' : point.sliceRadius;
            point.separatorY = chart.intl.formatNumber(point.y, { useGrouping: chart.useGroupingSeparator });
            this.setEmptyPoint(point, index, data, chart);
            return point;
        };
        CircularChart3DSeries.prototype.draw = function (series, chart) {
            var marginRatio = 0.03;
            var seriesIndex = chart.visibleSeries.indexOf(series);
            this.calculateSize(chart, series);
            var seriesRadius = series.radius ? series.radius : (ej2_base_1.Browser.isDevice && series.dataLabel.position === 'Outside') ? '40%' : '80%';
            var radius = parseInt(seriesRadius, 10);
            Iif (!((seriesRadius.indexOf('%') !== -1 || typeof radius === 'number') && !isNaN(radius))) {
                this.isRadiusMapped = true;
            }
            series.size = this.isRadiusMapped ? 0.8 : parseInt(seriesRadius, 10) / 100;
            series.coefficient = parseInt(series.innerRadius, 10) / 100;
            chart.circularRadius[seriesIndex] =
                (((1 - marginRatio) * Math.min(series.actualWidth / 2 - ((chart.legendSettings.visible && chart.circularChartLegend3DModule && (chart.legendSettings.position === 'Right' ||
                    chart.legendSettings.position === 'Left')) ? chart.circularChartLegend3DModule.legendBounds.width : 0), series.actualHeight / 2)) * series.size);
            chart.innerRadius[seriesIndex] =
                series.coefficient * chart.circularRadius[seriesIndex];
            this.createPolygons(series, chart);
            if (this.dataLabel.visible) {
                chart.circularChartDataLabel3DModule.renderDataLabel(series, chart);
            }
            helper_1.appendChildElement(false, chart.svgObject, chart.groupElement, chart.redraw);
            var size = new ej2_svg_base_1.Size(chart.availableSize.width, chart.availableSize.height);
            chart.graphics.prepareView(0, chart.depth, chart.rotation, chart.tilt, size, chart);
            chart.graphics.view(chart.svgObject, chart);
        };
        CircularChart3DSeries.prototype.calculateSize = function (chart, series) {
            var legend = chart.legendSettings;
            var legXSpace = 0;
            var legYSpace = 0;
            var legendPosition = chart.circularChartLegend3DModule ? chart.circularChartLegend3DModule.position : 'Auto';
            var title = chart.title;
            var subTitle = chart.subTitle;
            var titleLocation = chart.titleLocation;
            var subTitleLocation = chart.subTitleLocation;
            var titleTextOverflow = chart.titleStyle.textOverflow;
            var subTitleTextOverflow = chart.subTitleStyle.textOverflow;
            var titleEnable = (title &&
                (titleTextOverflow === 'Wrap')) ? true : false;
            var subTitleEnable = (subTitle &&
                (subTitleTextOverflow === 'Wrap')) ? true : false;
            if (legend.visible && chart.circularChartLegend3DModule && legendPosition !== 'Custom') {
                if (legendPosition === 'Right' || legendPosition === 'Left') {
                    legXSpace = (legendPosition.toLowerCase() === 'right') ?
                        chart.margin.right : chart.margin.left + chart.circularChartLegend3DModule.legendBounds.width;
                }
                else {
                    legYSpace = (legendPosition === 'Top') ? chart.margin.top :
                        ((legendPosition === 'Bottom') ? chart.margin.bottom + chart.circularChartLegend3DModule.legendBounds.height : 0);
                }
            }
            series.actualWidth = chart.availableSize.width - legXSpace;
            var centerx = (series.actualWidth * 0.5) + ((legendPosition === 'Left') ? legXSpace : 0);
            if (titleEnable || subTitleEnable) {
                var yOffset = titleLocation.size.height + (subTitleEnable ? subTitleLocation.size.height : 0) + legYSpace;
                series.actualHeight = chart.svgObject.height.baseVal.value - yOffset;
                var centery = series.actualHeight * 0.5 + (titleLocation.size.height + (subTitleEnable ? subTitleLocation.size.height : 0));
                return { centerX: centerx, centerY: centery };
            }
            else {
                var yOffset = ((title) ? titleLocation.y : 0) + legYSpace;
                series.actualHeight = chart.svgObject.height.baseVal.value - yOffset;
                var centery = series.actualHeight * 0.5 + ((legendPosition === 'Top') ?
                    yOffset : ((title) ? (titleLocation.y) : 0));
                return { centerX: centerx, centerY: centery };
            }
        };
        CircularChart3DSeries.prototype.createPolygons = function (series, chart) {
            var segments = [];
            var polygons = [];
            var seg;
            var style;
            var pointIndex;
            var polygonCollection = [];
            Eif (series.segments.length === 0) {
                segments = this.createPoints(series, chart);
            }
            else {
                segments = series.segments;
            }
            var segmentsLength = segments.length;
            for (var i = 0; i < segmentsLength; i++) {
                seg = segments[i];
                Eif (seg.visible) {
                    pointIndex = segments[i].pointIndex;
                    style = {
                        opacity: series.opacity,
                        interior: series.points[pointIndex].color
                    };
                    polygonCollection = this.createSector(seg, chart, style, series.index);
                    if (polygonCollection !== null) {
                        for (var k = 0; k < polygonCollection.length; k++) {
                            if (!polygons[k]) {
                                polygons[k] = [];
                            }
                            Eif (polygonCollection[k] !== null) {
                                for (var j = 0; j < polygonCollection[k].length; j++) {
                                    polygons[k].push(polygonCollection[k][j]);
                                }
                            }
                        }
                    }
                }
            }
            for (var i = 0; i < polygons.length; i++) {
                for (var k = 0; k < polygons[i].length; k++) {
                    var polygone = (polygons[i][k]);
                    chart.circular3DPolygon.push(polygone);
                }
            }
            return null;
        };
        CircularChart3DSeries.prototype.createSector = function (segment, chart, style, seriesIndex) {
            var count = Math.ceil(segment.actualEndValue / 6);
            var degreesToRadians = Math.PI / 180;
            var index = 0;
            var depth = chart.depth;
            if (count < 1) {
                return null;
            }
            var polygonCollection = [];
            var endValue = segment.actualEndValue / count;
            var outputPoints = [];
            var inputPoints = [];
            for (var i = 0; i < count + 1; i++) {
                var ox = segment.center.x + segment.radius * Math.cos((segment.actualStartValue + i * endValue) * degreesToRadians);
                var oy = segment.center.y + segment.radius * Math.sin((segment.actualStartValue + i * endValue) * degreesToRadians);
                outputPoints[i] = { x: ox, y: oy };
                var ix = segment.center.x +
                    segment.inSideRadius * Math.cos((segment.actualStartValue + i * endValue) * degreesToRadians);
                var iy = segment.center.y +
                    segment.inSideRadius * Math.sin((segment.actualStartValue + i * endValue) * degreesToRadians);
                inputPoints[i] = { x: ix, y: iy };
            }
            var originPolygon = [];
            var vts = [];
            for (var i = 0; i < count; i++) {
                vts = [
                    this.vector(outputPoints[i].x, outputPoints[i].y, 0),
                    this.vector(outputPoints[i].x, outputPoints[i].y, depth),
                    this.vector(outputPoints[i + 1].x, outputPoints[i + 1].y, depth),
                    this.vector(outputPoints[i + 1].x, outputPoints[i + 1].y, 0)
                ];
                originPolygon[i] = chart.polygon.polygon3D(vts, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText);
                index++;
            }
            polygonCollection[1] = originPolygon;
            if (segment.inSideRadius > 0) {
                var iPlgs = [];
                for (var i = 0; i < count; i++) {
                    vts = [
                        this.vector(inputPoints[i].x, inputPoints[i].y, 0),
                        this.vector(inputPoints[i].x, inputPoints[i].y, depth),
                        this.vector(inputPoints[i + 1].x, inputPoints[i + 1].y, depth),
                        this.vector(inputPoints[i + 1].x, inputPoints[i + 1].y, 0)
                    ];
                    iPlgs[i] = chart.polygon.polygon3D(vts, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText);
                    index++;
                }
                polygonCollection[3] = iPlgs;
            }
            var tVtxs = [];
            var bVtxs = [];
            for (var i = 0; i < count + 1; i++) {
                tVtxs.push(this.vector(outputPoints[i].x, outputPoints[i].y, 0));
                bVtxs.push(this.vector(outputPoints[i].x, outputPoints[i].y, depth));
            }
            if (segment.inSideRadius > 0) {
                for (var i = count; i > -1; i--) {
                    tVtxs.push(this.vector(inputPoints[i].x, inputPoints[i].y, 0));
                    bVtxs.push(this.vector(inputPoints[i].x, inputPoints[i].y, depth));
                }
            }
            else {
                tVtxs.push(segment.center);
                bVtxs.push(this.vector(segment.center.x, segment.center.y, depth));
            }
            polygonCollection[0] = [];
            polygonCollection[0].push(chart.polygon.polygon3D(tVtxs, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText));
            index++;
            polygonCollection[0].push(chart.polygon.polygon3D(bVtxs, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText));
            index++;
            if (segment.inSideRadius > 0) {
                var rvts = [
                    this.vector(outputPoints[0].x, outputPoints[0].y, 0),
                    this.vector(outputPoints[0].x, outputPoints[0].y, depth),
                    this.vector(inputPoints[0].x, inputPoints[0].y, depth),
                    this.vector(inputPoints[0].x, inputPoints[0].y, 0)
                ];
                var lvts = [
                    this.vector(outputPoints[count].x, outputPoints[count].y, 0),
                    this.vector(outputPoints[count].x, outputPoints[count].y, depth),
                    this.vector(inputPoints[count].x, inputPoints[count].y, depth),
                    this.vector(inputPoints[count].x, inputPoints[count].y, 0)
                ];
                polygonCollection[2] = [];
                polygonCollection[2].push(chart.polygon.polygon3D(rvts, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText));
                index++;
                polygonCollection[2].push(chart.polygon.polygon3D(lvts, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText));
                index++;
            }
            else {
                var rvts = [
                    this.vector(outputPoints[0].x, outputPoints[0].y, 0),
                    this.vector(outputPoints[0].x, outputPoints[0].y, depth),
                    this.vector(segment.center.x, segment.center.y, depth),
                    this.vector(segment.center.x, segment.center.y, 0)
                ];
                var lvts = [
                    this.vector(outputPoints[count].x, outputPoints[count].y, 0),
                    this.vector(outputPoints[count].x, outputPoints[count].y, depth),
                    this.vector(segment.center.x, segment.center.y, depth),
                    this.vector(segment.center.x, segment.center.y, 0)
                ];
                polygonCollection[2] = [];
                polygonCollection[2].push(chart.polygon.polygon3D(rvts, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText));
                index++;
                polygonCollection[2].push(chart.polygon.polygon3D(lvts, null, segment.index, null, null, style.opacity, style.interior, index.toString() + '-region' + '-series-' + seriesIndex + '-point-' + segment.index, chart.groupElement, segment.accessibilityText));
                index++;
            }
            return polygonCollection;
        };
        CircularChart3DSeries.prototype.createPoints = function (series, chart) {
            series.segments = [];
            var size = this.calculateSize(chart, series);
            var all = 0;
            var visiblePoints = series.points;
            var count = visiblePoints.length;
            for (var j = 0; j < count; j++) {
                if (visiblePoints[j].visible && !ej2_base_1.isNullOrUndefined(visiblePoints[j].y)) {
                    all += visiblePoints[j].y;
                }
            }
            all = all !== 0 ? all : 1;
            var coefficient = 360 / all;
            var seriesIndex = series.index;
            var insideRadius = chart.innerRadius[seriesIndex];
            var yValues = this.getYValues(series.points);
            var pieHeight = chart.depth;
            var center;
            var arcStartAngle = 0;
            var arcEndAngle = 0;
            var current = 0;
            var pointIndex;
            var value;
            var rect = new ej2_svg_base_1.Rect(0, 0, 0, 0);
            var offset = { X: 0, Y: 0 };
            var segment;
            var segIndex = 0;
            var radius = chart.circularRadius[seriesIndex];
            for (var i = 0; i < count; i++) {
                if (series.points[i].visible && !ej2_base_1.isNullOrUndefined(yValues[i])) {
                    pointIndex = series.points[i].index;
                    value = Math.abs(yValues[i]);
                    arcEndAngle = Math.abs(value) * ((Math.PI * 2) / all);
                    rect.x = 0;
                    rect.y = 0;
                    var point = series.points[i];
                    Iif (series.isRadiusMapped) {
                        if (series.points[i].sliceRadius.indexOf('%') !== -1) {
                            point.radius = helper_1.stringToNumber(series.points[i].sliceRadius, this.size / 2);
                        }
                        else {
                            point.radius = parseInt(series.points[i].sliceRadius, 10);
                        }
                    }
                    else {
                        point.radius = radius;
                    }
                    var accessibilityText = point.x + ':' + point.y + ', ' + series.name;
                    Eif (!ej2_base_1.isNullOrUndefined(value)) {
                        if (series.explode && (series.explodeIndex === point.index ||
                            !series.isExploded && series.explodeAll)) {
                            offset.X = Math.cos(2 * Math.PI * (current + value / 2) / all);
                            offset.Y = Math.sin(2 * Math.PI * (current + value / 2) / all);
                            rect.x = 0.01 * point.radius * offset.X * helper_1.stringToNumber(series.explodeOffset, 100);
                            rect.y = 0.01 * point.radius * offset.Y * helper_1.stringToNumber(series.explodeOffset, 100);
                        }
                        center = this.vector(rect.x + size.centerX, rect.y + size.centerY, 0);
                        segment = this.createSegment(center, (coefficient * current), (coefficient * value), pieHeight, point.radius, i, value, insideRadius, pointIndex, series, accessibilityText);
                        series.segments.push(segment);
                    }
                    this.addPieDataLabel(segIndex, yValues[i], arcStartAngle, arcStartAngle + arcEndAngle, point.radius, this.isChartRotated(chart) ? chart.depth + 5 : 0, center, series.points[i]);
                    segIndex++;
                    arcStartAngle += arcEndAngle;
                    current += value;
                }
            }
            return series.segments;
        };
        CircularChart3DSeries.prototype.addPieDataLabel = function (x, y, startAngle, endAngle, radius, startDepth, center, point) {
            var angle = (startAngle + endAngle) / 2;
            point.symbolLocation = { x: 0, y: 0, radius: 0, angle: 0 };
            point.symbolLocation.x = x;
            point.symbolLocation.y = y;
            point.symbolLocation.radius = radius;
            point.symbolLocation.angle = angle;
            point.symbolLocation.center = center;
            point.startDepth = startDepth;
        };
        CircularChart3DSeries.prototype.isChartRotated = function (chart) {
            var actualTiltView = Math.abs(chart.tilt % 360);
            var actualRotateView = Math.abs(chart.rotation % 360);
            if ((actualTiltView > 90 && actualTiltView < 270) !== (actualRotateView > 90 && actualRotateView < 270)) {
                return true;
            }
            return false;
        };
        CircularChart3DSeries.prototype.createSegment = function (center, start, end, height, radius, index, yValue, insideRadius, pointIndex, series, accessibilityText) {
            return {
                startValue: start,
                endValue: end,
                depth: height,
                radius: radius,
                index: index,
                yData: yValue,
                center: center,
                inSideRadius: insideRadius,
                actualEndValue: end,
                actualStartValue: start,
                pointIndex: pointIndex,
                series: series,
                visible: true,
                accessibilityText: accessibilityText
            };
        };
        CircularChart3DSeries.prototype.vector = function (vx, vy, vz) {
            return { x: vx, y: vy, z: vz };
        };
        CircularChart3DSeries.prototype.getYValues = function (points) {
            var values = [];
            var length = points.length;
            for (var i = 0; i < length; i++) {
                values.push(points[i].y);
            }
            return values;
        };
        CircularChart3DSeries.prototype.findMaxBounds = function (totalBound, bound) {
            totalBound.x = bound.x < totalBound.x ? bound.x : totalBound.x;
            totalBound.y = bound.y < totalBound.y ? bound.y : totalBound.y;
            totalBound.height = (bound.y + bound.height) > totalBound.height ? (bound.y + bound.height) : totalBound.height;
            totalBound.width = (bound.x + bound.width) > totalBound.width ? (bound.x + bound.width) : totalBound.width;
        };
        CircularChart3DSeries.prototype.setEmptyPoint = function (point, index, data, chart) {
            if (!(ej2_base_1.isNullOrUndefined(point.y) || isNaN(point.y))) {
                return null;
            }
            point.color = this.emptyPointSettings.fill || point.color;
            var previous;
            var next;
            switch (this.emptyPointSettings.mode) {
                case 'Zero':
                    point.y = 0;
                    point.visible = true;
                    break;
                case 'Average':
                    previous = data[index - 1] ? (data[index - 1][this.yName] || 0) : 0;
                    next = data[index + 1] ? (data[index + 1][this.yName] || 0) : 0;
                    point.y = (Math.abs(previous) + Math.abs(next)) / 2;
                    point.separatorY = chart.intl.formatNumber(point.y, { useGrouping: chart.useGroupingSeparator });
                    this.sumOfPoints += point.y;
                    point.visible = true;
                    break;
                default:
                    point.visible = false;
                    break;
            }
        };
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "dataSource", void 0);
        __decorate([
            ej2_base_1.Property()
        ], CircularChart3DSeries.prototype, "query", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "xName", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "name", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "tooltipMappingName", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "yName", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], CircularChart3DSeries.prototype, "visible", void 0);
        __decorate([
            ej2_base_1.Complex(null, base_1.Animation)
        ], CircularChart3DSeries.prototype, "animation", void 0);
        __decorate([
            ej2_base_1.Property('SeriesType')
        ], CircularChart3DSeries.prototype, "legendShape", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "legendImageUrl", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], CircularChart3DSeries.prototype, "pointColorMapping", void 0);
        __decorate([
            ej2_base_1.Complex({}, dataLabel_1.CircularChart3DDataLabelSettings)
        ], CircularChart3DSeries.prototype, "dataLabel", void 0);
        __decorate([
            ej2_base_1.Property([])
        ], CircularChart3DSeries.prototype, "palettes", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularChart3DSeries.prototype, "radius", void 0);
        __decorate([
            ej2_base_1.Property('0')
        ], CircularChart3DSeries.prototype, "innerRadius", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], CircularChart3DSeries.prototype, "enableTooltip", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularChart3DSeries.prototype, "explode", void 0);
        __decorate([
            ej2_base_1.Property('30%')
        ], CircularChart3DSeries.prototype, "explodeOffset", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], CircularChart3DSeries.prototype, "explodeAll", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], CircularChart3DSeries.prototype, "explodeIndex", void 0);
        __decorate([
            ej2_base_1.Complex({ mode: 'Drop' }, CircularChart3DEmptyPointSettings)
        ], CircularChart3DSeries.prototype, "emptyPointSettings", void 0);
        __decorate([
            ej2_base_1.Property(1)
        ], CircularChart3DSeries.prototype, "opacity", void 0);
        return CircularChart3DSeries;
    }(ej2_base_1.ChildProperty));
    exports.CircularChart3DSeries = CircularChart3DSeries;
    var PieSeries3D = (function (_super) {
        __extends(PieSeries3D, _super);
        function PieSeries3D() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        PieSeries3D.prototype.getModuleName = function () {
            return 'PieSeries3D';
        };
        PieSeries3D.prototype.destroy = function () {
        };
        return PieSeries3D;
    }(CircularChart3DSeries));
    exports.PieSeries3D = PieSeries3D;
});