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

100% Statements 49/49
92.31% Branches 36/39
100% Functions 13/13
100% Lines 46/46
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 59 60 61 62 63        66×   110× 110× 110× 110×   110× 110× 110× 110× 110× 110× 10357× 10357× 10357× 10357× 9602× 9602× 9602× 9602×   9602×     110×   110×     21177×          
/* 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", "./multi-colored-base"], function (require, exports, helper_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) {
            var _this = this;
            var startPoint = null;
            var direction = '';
            var origin = series.chart.chartAreaType === 'PolarRadar' ? series.points[0].yValue :
                Math.max(series.yAxis.visibleRange.min, 0);
            var currentXValue;
            var isDropMode = (series.emptyPointSettings && series.emptyPointSettings.mode === 'Drop');
            var borderWidth = series.border ? series.border.width : 0;
            var borderColor = series.border ? series.border.color : 'transparent';
            var getCoordinate = series.chart.chartAreaType === 'PolarRadar' ? helper_1.TransformToVisible : helper_1.getPoint;
            series.points.map(function (point, i, seriesPoints) {
                currentXValue = point.xValue;
                point.symbolLocations = [];
                point.regions = [];
                if (point.visible && helper_1.withInRange(seriesPoints[i - 1], point, seriesPoints[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 (seriesPoints[i + 1] && !seriesPoints[i + 1].visible && !isDropMode) {
                        direction += _this.getAreaEmptyDirection({ 'x': currentXValue, 'y': origin }, startPoint, series, isInverted, getCoordinate);
                        startPoint = null;
                    }
                    _this.storePointLocation(point, series, isInverted, getCoordinate);
                }
            });
            this.appendLinePath(new helper_1.PathOption(series.chart.element.id + '_Series_' + series.index, series.interior, borderWidth, borderColor, series.opacity, series.dashArray, (series.points.length > 1 ? (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, '');
            this.renderMarker(series);
        };
        AreaSeries.prototype.destroy = function (chart) {
        };
        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;
});