all files / accumulation-chart/renderer/ pie-series.js

100% Statements 46/46
91.67% Branches 22/24
100% Functions 13/13
100% Lines 43/43
9 statements, 5 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        378×   1608× 1608× 1608× 1608× 1608× 1608× 1608×   1608×   1605× 1605× 1605×   180× 180×     1157×          
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "../../common/utils/helper", "../renderer/pie-base"], function (require, exports, helper_1, pie_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PieSeries = (function (_super) {
        __extends(PieSeries, _super);
        function PieSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        PieSeries.prototype.renderPoint = function (point, series, chart, option) {
            var sum = series.sumOfPoints;
            var degree = (sum) ? ((Math.abs(point.y) / sum) * (this.totalAngle)) : null;
            option.d = this.getPathOption(point, degree);
            point.midAngle = (this.startAngle - (degree / 2)) % 360;
            point.endAngle = this.startAngle % 360;
            point.symbolLocation = helper_1.degreeToLocation(point.midAngle, (this.radius + this.innerRadius) / 2, this.center);
            return option;
        };
        PieSeries.prototype.getPathOption = function (point, degree) {
            if (degree === null || !point.y) {
                return '';
            }
            var path = this.getPathArc(this.center, this.startAngle % 360, (this.startAngle + degree) % 360, this.radius, this.innerRadius);
            this.startAngle += degree;
            return path;
        };
        PieSeries.prototype.animateSeries = function (accumulation, option, series, slice) {
            var groupId = accumulation.element.id + 'SeriesGroup' + series.index;
            if (series.animation.enable && accumulation.animateSeries) {
                var clippath = accumulation.renderer.createClipPath({ id: groupId + '_clipPath' });
                var path = new helper_1.PathOption(groupId + '_slice', 'transparent', 1, 'transparent', 1, '', '');
                var clipslice = accumulation.renderer.drawPath(path);
                clippath.appendChild(clipslice);
                accumulation.svgObject.appendChild(clippath);
                slice.setAttribute('style', 'clip-path:url(#' + clippath.id + ')');
                this.doAnimation(clipslice, series);
            }
        };
        PieSeries.prototype.getModuleName = function () {
            return 'PieSeries';
        };
        PieSeries.prototype.destroy = function (accumulation) {
        };
        return PieSeries;
    }(pie_base_1.PieBase));
    exports.PieSeries = PieSeries;
});