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

98.78% Statements 81/82
89.8% Branches 44/49
94.12% Functions 16/17
98.73% Lines 78/79
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          21×   24× 24× 24× 24× 24× 24× 24× 24× 24× 24× 24× 24× 24× 282× 282× 282× 282× 273× 273× 273× 273× 160× 160× 160× 160× 160× 160×       113× 113×   273×   273× 273×     24×     24×   24× 24× 23×     168×     12× 12×   12× 12× 12×         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", "@syncfusion/ej2-base", "./multi-colored-base"], function (require, exports, helper_1, ej2_svg_base_1, ej2_base_1, multi_colored_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var MultiColoredAreaSeries = (function (_super) {
        __extends(MultiColoredAreaSeries, _super);
        function MultiColoredAreaSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        MultiColoredAreaSeries.prototype.render = function (series, xAxis, yAxis, isInverted, pointAnimate, pointUpdate) {
            var _this = this;
            var firstPoint;
            var startPoint = null;
            var direction = '';
            var origin = Math.max(series.yAxis.visibleRange.min, 0);
            var options = [];
            var startRegion;
            var previous;
            var rendered;
            var segments = this.sortSegments(series, series.segments);
            var emptyPointDirection = '';
            var visiblePoints = this.enableComplexProperty(series);
            visiblePoints.map(function (point, i, seriesPoints) {
                point.symbolLocations = [];
                point.regions = [];
                rendered = false;
                if (point.visible && helper_1.withInRange(seriesPoints[i - 1], point, seriesPoints[i + 1], series)) {
                    direction += _this.getAreaPathDirection(point.xValue, origin, series, isInverted, helper_1.getPoint, startPoint, 'M');
                    startPoint = startPoint || new helper_1.ChartLocation(point.xValue, origin);
                    firstPoint = helper_1.getPoint(point.xValue, point.yValue, xAxis, yAxis, isInverted);
                    if (previous && _this.setPointColor(point, previous, series, series.segmentAxis === 'X', segments)) {
                        rendered = true;
                        startRegion = helper_1.getPoint(startPoint.x, origin, xAxis, yAxis, isInverted);
                        direction += ('L' + ' ' + (firstPoint.x) + ' ' + (firstPoint.y) + ' ');
                        direction += ('L' + ' ' + (firstPoint.x) + ' ' + (startRegion.y) + ' ');
                        _this.generatePathOption(options, series, previous, direction, '_Point_' + previous.index);
                        direction = 'M' + ' ' + (firstPoint.x) + ' ' + (startRegion.y) + ' ' + 'L' + ' ' +
                            (firstPoint.x) + ' ' + (firstPoint.y) + ' ';
                    }
                    else {
                        direction += ('L' + ' ' + (firstPoint.x) + ' ' + (firstPoint.y) + ' ');
                        _this.setPointColor(point, null, series, series.segmentAxis === 'X', segments);
                    }
                    if (seriesPoints[i + 1] && !seriesPoints[i + 1].visible && series.emptyPointSettings.mode !== 'Drop') {
                        direction += _this.getAreaEmptyDirection({ 'x': point.xValue, 'y': origin }, startPoint, series, isInverted, helper_1.getPoint);
                        startPoint = null;
                    }
                    previous = point;
                    _this.storePointLocation(point, series, isInverted, helper_1.getPoint);
                }
            });
            if (!ej2_base_1.isNullOrUndefined(rendered) && !rendered) {
                direction = series.points.length > 1 ?
                    (direction + this.getAreaPathDirection(previous.xValue, origin, series, isInverted, helper_1.getPoint, null, 'L')) : '';
                this.generatePathOption(options, series, previous, direction, '');
            }
            if (series.border.width !== 0) {
                emptyPointDirection = this.removeEmptyPointsBorder(this.getBorderDirection(direction));
                this.generateBorderPathOption(options, series, previous, emptyPointDirection, '');
            }
            this.applySegmentAxis(series, options, segments, pointAnimate);
            if (!pointUpdate) {
                this.renderMarker(series);
            }
        };
        MultiColoredAreaSeries.prototype.generatePathOption = function (options, series, point, direction, id) {
            options.push(new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_' + series.index + id, series.setPointColor(point, series.interior), 0, 'transparent', series.opacity, series.dashArray, direction));
        };
        MultiColoredAreaSeries.prototype.generateBorderPathOption = function (options, series, point, emptyPointDirection, id) {
            options.push(new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_border_' + series.index + id, 'transparent', series.border.width, series.border.color ? series.border.color : series.interior, 1, series.border.dashArray, emptyPointDirection));
        };
        MultiColoredAreaSeries.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);
                }
            }
        };
        MultiColoredAreaSeries.prototype.destroy = function () {
        };
        MultiColoredAreaSeries.prototype.getModuleName = function () {
            return 'MultiColoredAreaSeries';
        };
        MultiColoredAreaSeries.prototype.doAnimation = function (series) {
            this.doLinearAnimation(series, series.animation);
        };
        return MultiColoredAreaSeries;
    }(multi_colored_base_1.MultiColoredSeries));
    exports.MultiColoredAreaSeries = MultiColoredAreaSeries;
});