all files / chart/series/ stacking-line-series.js

100% Statements 68/68
95.45% Branches 42/44
100% Functions 14/14
100% Lines 65/65
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            17× 17× 17× 17× 17× 17× 17× 17× 17× 17× 17× 100× 100× 100× 100× 84× 84× 84× 84×     16× 13× 11× 11× 11×         17×   17× 17× 17× 16×                 41538×        
/* 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", "../../common/utils/helper", "@syncfusion/ej2-svg-base", "./line-base"], function (require, exports, helper_1, ej2_svg_base_1, line_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var StackingLineSeries = (function (_super) {
        __extends(StackingLineSeries, _super);
        function StackingLineSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        StackingLineSeries.prototype.render = function (series, xAxis, yAxis, isInverted, pointAnimate, pointUpdate) {
            var polarType = series.chart.chartAreaType === 'PolarRadar';
            var getCoordinate = polarType ? helper_1.TransformToVisible : helper_1.getPoint;
            var direction = '';
            var visiblePts = this.enableComplexProperty(series);
            var pointsLength = visiblePts.length;
            var stackedvalue = series.stackedValues;
            var pointIndex;
            var nextPointIndex;
            var point1;
            var point2;
            for (var i = 0; i < pointsLength; i++) {
                visiblePts[i].regions = [];
                visiblePts[i].symbolLocations = [];
                pointIndex = visiblePts[i].index;
                if (visiblePts[i].visible && helper_1.withInRange(visiblePts[i - 1], visiblePts[i], visiblePts[i + 1], series)) {
                    point1 = getCoordinate(visiblePts[i].xValue, stackedvalue.endValues[pointIndex], xAxis, yAxis, isInverted, series);
                    direction = direction.concat((i ? 'L' : 'M') + ' ' + (point1.x) + ' ' + (point1.y) + ' ');
                    visiblePts[i].symbolLocations.push(getCoordinate(visiblePts[i].xValue, stackedvalue.endValues[pointIndex], xAxis, yAxis, isInverted, series));
                    visiblePts[i].regions.push(new ej2_svg_base_1.Rect(visiblePts[i].symbolLocations[0].x - series.marker.width, visiblePts[i].symbolLocations[0].y - series.marker.height, 2 * series.marker.width, 2 * series.marker.height));
                }
                else {
                    if (series.emptyPointSettings.mode !== 'Drop') {
                        if (visiblePts[i + 1] && visiblePts[i + 1].visible) {
                            nextPointIndex = visiblePts[i + 1].index;
                            point1 = getCoordinate(visiblePts[i + 1].xValue, stackedvalue.endValues[nextPointIndex], xAxis, yAxis, isInverted, series);
                            direction = direction.concat('M' + ' ' + (point1.x) + ' ' + (point1.y) + ' ');
                        }
                    }
                }
            }
            if (series.chart.chartAreaType === 'PolarRadar' && visiblePts.length > 1) {
                point1 = { 'y': stackedvalue.endValues[0], 'x': series.points[0].xValue };
                point2 = getCoordinate(point1.x, point1.y, xAxis, yAxis, isInverted, series);
                direction += ('L' + ' ' + (point2.x) + ' ' + (point2.y) + ' ');
            }
            var options = new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_' + series.index, 'none', series.width, series.interior, series.opacity, series.dashArray, direction);
            this[pointAnimate ? 'addPath' : 'appendLinePath'](options, series, '');
            if (!pointUpdate) {
                this.renderMarker(series);
            }
        };
        StackingLineSeries.prototype.updateDirection = function (series, point) {
            this.render(series, series.xAxis, series.yAxis, series.chart.requireInvertedAxis, false, true);
            for (var i = 0; i < point.length; i++) {
                Eif (series.marker && series.marker.visible) {
                    series.chart.markerRender.renderMarker(series, series.points[point[i]], series.points[point[i]].symbolLocations[0], null, true);
                }
                Eif (series.marker.dataLabel.visible && series.chart.dataLabelModule) {
                    series.chart.dataLabelModule.commonId = series.chart.element.id + '_Series_' + series.index + '_Point_';
                    series.chart.dataLabelModule.renderDataLabel(series, series.points[point[i]], null, series.marker.dataLabel);
                }
            }
        };
        StackingLineSeries.prototype.doAnimation = function (series) {
            var option = series.animation;
            this.doLinearAnimation(series, option);
        };
        StackingLineSeries.prototype.destroy = function () {
        };
        StackingLineSeries.prototype.getModuleName = function () {
            return 'StackingLineSeries';
        };
        return StackingLineSeries;
    }(line_base_1.LineBase));
    exports.StackingLineSeries = StackingLineSeries;
});