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

100% Statements 65/65
93.94% Branches 31/33
100% Functions 14/14
100% Lines 62/62
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84        16×   16× 16× 16× 16× 16× 16× 16× 16× 16× 16× 16× 16× 192× 192× 192× 192× 183× 183× 183× 183× 128× 128× 128× 128× 128× 128×       55× 55×   183×   183× 183×     16×     16× 16×   131×     20665×          
/* 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 MultiColoredAreaSeries = (function (_super) {
        __extends(MultiColoredAreaSeries, _super);
        function MultiColoredAreaSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        MultiColoredAreaSeries.prototype.render = function (series, xAxis, yAxis, isInverted) {
            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 color;
            var rendered;
            var segments = this.sortSegments(series, series.segments);
            series.points.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, series);
                    if (previous && _this.setPointColor(point, previous, series, series.segmentAxis === 'X', segments)) {
                        rendered = true;
                        startRegion = helper_1.getPoint(startPoint.x, origin, xAxis, yAxis, isInverted, series);
                        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 (!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, '');
            }
            this.applySegmentAxis(series, options, segments);
            this.renderMarker(series);
        };
        MultiColoredAreaSeries.prototype.generatePathOption = function (options, series, point, direction, id) {
            options.push(new helper_1.PathOption(series.chart.element.id + '_Series_' + series.index + id, series.setPointColor(point, series.interior), series.border.width, series.border.color, series.opacity, series.dashArray, direction));
        };
        MultiColoredAreaSeries.prototype.destroy = function (chart) {
        };
        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;
});