all files / chart/series/ area-series.js

98.7% Statements 76/77
91.43% Branches 64/70
100% Functions 14/14
98.65% Lines 73/74
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          134×   223× 223× 223× 223× 223× 22× 22×   223× 223× 223× 223× 223× 223× 223× 223× 223× 16561× 16561× 16561× 16561× 16561× 14407× 14407× 14407× 14407×     14407×     223× 22× 22× 22× 22×       22×   223×   223× 76× 76×   223× 221×     14× 14×   14× 14× 14×         42127×   13× 13×        
/* 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", "./multi-colored-base"], function (require, exports, helper_1, ej2_svg_base_1, multi_colored_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var AreaSeries = (function (_super) {
        __extends(AreaSeries, _super);
        function AreaSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        AreaSeries.prototype.render = function (series, xAxis, yAxis, isInverted, pointAnimate, pointUpdate) {
            var startPoint = null;
            var direction = '';
            var isPolar = (series.chart && series.chart.chartAreaType === 'PolarRadar');
            var origin = Math.max(series.yAxis.visibleRange.min, 0);
            if (isPolar) {
                var connectPoints = this.getFirstLastVisiblePoint(series.points);
                origin = connectPoints.first.yValue;
            }
            var currentXValue;
            var isDropMode = (series.emptyPointSettings && series.emptyPointSettings.mode === 'Drop');
            var borderWidth = series.border.width ? series.border.width : 0;
            var borderColor = series.border.color ? series.border.color : series.interior;
            var getCoordinate = series.chart.chartAreaType === 'PolarRadar' ? helper_1.TransformToVisible : helper_1.getPoint;
            var visiblePoints = this.enableComplexProperty(series);
            var point;
            var emptyPointDirection = '';
            for (var i = 0; i < visiblePoints.length; i++) {
                point = visiblePoints[i];
                currentXValue = point.xValue;
                point.symbolLocations = [];
                point.regions = [];
                if (point.visible && helper_1.withInRange(visiblePoints[i - 1], point, visiblePoints[i + 1], series)) {
                    direction += this.getAreaPathDirection(currentXValue, origin, series, isInverted, getCoordinate, startPoint, 'M');
                    startPoint = startPoint || new helper_1.ChartLocation(currentXValue, origin);
                    direction += this.getAreaPathDirection(currentXValue, point.yValue, series, isInverted, getCoordinate, null, 'L');
                    if (visiblePoints[i + 1] && (!visiblePoints[i + 1].visible &&
                        (!isPolar || (isPolar && this.withinYRange(visiblePoints[i + 1], yAxis)))) && !isDropMode) {
                        direction += this.getAreaEmptyDirection({ 'x': currentXValue, 'y': origin }, startPoint, series, isInverted, getCoordinate);
                        startPoint = null;
                    }
                    this.storePointLocation(point, series, isInverted, getCoordinate);
                }
            }
            if (isPolar && direction !== '') {
                var endPoint = '';
                var chart = this.chart;
                endPoint += this.getAreaPathDirection(0, origin, series, isInverted, getCoordinate, null, 'L');
                Iif (xAxis.isAxisInverse || yAxis.isAxisInverse) {
                    direction += (series.type === 'Polar' ? chart.polarSeriesModule.getPolarIsInversedPath(xAxis, endPoint) :
                        chart.radarSeriesModule.getRadarIsInversedPath(xAxis, endPoint));
                }
                direction = direction.concat(direction + ' ' + 'Z');
            }
            this[pointAnimate ? 'addAreaPath' : 'appendLinePath'](new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_' + series.index, series.interior, 0, 'transparent', series.opacity, series.dashArray, ((direction !== '') ? (direction + this.getAreaPathDirection(series.points[series.points.length - 1].xValue, series.chart.chartAreaType === 'PolarRadar' ?
                series.points[series.points.length - 1].yValue : origin, series, isInverted, getCoordinate, null, 'L')) : '')), series, '');
            if (series.border.width !== 0) {
                emptyPointDirection = this.removeEmptyPointsBorder(direction);
                this[pointAnimate ? 'addAreaPath' : 'appendLinePath'](new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_border_' + series.index, 'transparent', borderWidth, borderColor, 1, series.border.dashArray, emptyPointDirection), series, '');
            }
            if (!pointUpdate) {
                this.renderMarker(series);
            }
        };
        AreaSeries.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);
                }
            }
        };
        AreaSeries.prototype.destroy = function () {
        };
        AreaSeries.prototype.getModuleName = function () {
            return 'AreaSeries';
        };
        AreaSeries.prototype.doAnimation = function (series) {
            var option = series.animation;
            this.doLinearAnimation(series, option);
        };
        return AreaSeries;
    }(multi_colored_base_1.MultiColoredSeries));
    exports.AreaSeries = AreaSeries;
});