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

100% Statements 66/66
96.77% Branches 30/31
100% Functions 11/11
100% Lines 63/63
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 85 86        59×   87× 87× 87× 87× 87× 87× 87× 87× 87× 87× 87× 87× 87× 87× 87× 87×   87× 721× 721× 721× 721× 721×   669× 554× 554× 554× 554× 554× 554× 554×       115× 115× 115× 115×   669× 669×     52× 52×   721×   114× 114×     87× 87×   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", "./spline-base"], function (require, exports, helper_1, spline_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var SplineAreaSeries = (function (_super) {
        __extends(SplineAreaSeries, _super);
        function SplineAreaSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        SplineAreaSeries.prototype.render = function (series, xAxis, yAxis, isInverted) {
            var firstPoint = null;
            var direction = '';
            var startPoint = null;
            var startPoint1 = null;
            var pt1;
            var pt2;
            var bpt1;
            var bpt2;
            var controlPt1;
            var controlPt2;
            var points = this.filterEmptyPoints(series);
            var pointsLength = series.points.length;
            var point;
            var previous;
            var getCoordinate = series.chart.chartAreaType === 'PolarRadar' ? helper_1.TransformToVisible : helper_1.getPoint;
            var origin = series.chart.chartAreaType === 'PolarRadar' ? series.points[0].yValue :
                Math.max(series.yAxis.visibleRange.min, 0);
            for (var i = 0; i < pointsLength; i++) {
                point = series.points[i];
                point.symbolLocations = [];
                point.regions = [];
                previous = this.getPreviousIndex(points, point.index - 1, series);
                if (point.visible &&
                    helper_1.withInRange(points[previous], point, points[this.getNextIndex(points, point.index - 1, series)], series)) {
                    if (firstPoint) {
                        controlPt1 = series.drawPoints[previous].controlPoint1;
                        controlPt2 = series.drawPoints[previous].controlPoint2;
                        pt1 = getCoordinate(firstPoint.xValue, firstPoint.yValue, xAxis, yAxis, isInverted, series);
                        pt2 = getCoordinate(point.xValue, point.yValue, xAxis, yAxis, isInverted, series);
                        bpt1 = getCoordinate(controlPt1.x, controlPt1.y, xAxis, yAxis, isInverted, series);
                        bpt2 = getCoordinate(controlPt2.x, controlPt2.y, xAxis, yAxis, isInverted, series);
                        direction = direction.concat(' C' + bpt1.x + ' '
                            + bpt1.y + ' ' + bpt2.x + ' ' + bpt2.y + ' ' + pt2.x + ' ' + pt2.y + ' ');
                    }
                    else {
                        startPoint = getCoordinate(point.xValue, origin, xAxis, yAxis, isInverted, series);
                        direction += ('M ' + startPoint.x + ' ' + startPoint.y + ' ');
                        startPoint1 = getCoordinate(point.xValue, point.yValue, xAxis, yAxis, isInverted, series);
                        direction += ('L ' + startPoint1.x + ' ' + startPoint1.y + ' ');
                    }
                    this.storePointLocation(point, series, isInverted, getCoordinate);
                    firstPoint = point;
                }
                else {
                    firstPoint = null;
                    point.symbolLocations = [];
                }
                if (((i + 1 < pointsLength && !series.points[i + 1].visible) || i === pointsLength - 1)
                    && pt2 && startPoint) {
                    startPoint = getCoordinate(point.xValue, origin, xAxis, yAxis, isInverted, series);
                    direction = direction.concat('L ' + (startPoint.x) + ' ' + (startPoint.y));
                }
            }
            this.appendLinePath(new helper_1.PathOption(series.chart.element.id + '_Series_' + series.index, series.interior, series.border.width, series.border.color, series.opacity, series.dashArray, direction), series, '');
            this.renderMarker(series);
        };
        SplineAreaSeries.prototype.getModuleName = function () {
            return 'SplineAreaSeries';
        };
        SplineAreaSeries.prototype.destroy = function (chart) {
        };
        return SplineAreaSeries;
    }(spline_base_1.SplineBase));
    exports.SplineAreaSeries = SplineAreaSeries;
});