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

100% Statements 67/67
95.83% Branches 23/24
100% Functions 11/11
100% Lines 64/64
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        127×   161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 161× 880× 880× 880× 880× 880× 869× 701× 701× 701× 701× 701× 701× 701× 701×   701×   869× 869×     11× 11× 11×     161×   161× 161× 161×   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 SplineSeries = (function (_super) {
        __extends(SplineSeries, _super);
        function SplineSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        SplineSeries.prototype.render = function (series, xAxis, yAxis, isInverted) {
            var chart = series.chart;
            var marker = series.marker;
            var ySpline;
            var options;
            var firstPoint = null;
            var secondPoint = null;
            var direction = '';
            var pt1;
            var pt2;
            var bpt1;
            var bpt2;
            var data;
            var controlPointCount = 0;
            var controlPoint1;
            var controlPoint2;
            var startPoint = 'M';
            var points = this.filterEmptyPoints(series);
            var previous;
            var getCoordinate = series.chart.chartAreaType === 'PolarRadar' ? helper_1.TransformToVisible : helper_1.getPoint;
            for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
                var point = points_1[_i];
                previous = this.getPreviousIndex(points, point.index - 1, series);
                point.symbolLocations = [];
                point.regions = [];
                if (point.visible && helper_1.withInRange(points[previous], point, points[this.getNextIndex(points, point.index - 1, series)], series)) {
                    if (firstPoint !== null) {
                        data = series.drawPoints[previous];
                        controlPoint1 = data.controlPoint1;
                        controlPoint2 = data.controlPoint2;
                        pt1 = getCoordinate(firstPoint.xValue, firstPoint.yValue, xAxis, yAxis, isInverted, series);
                        pt2 = getCoordinate(point.xValue, point.yValue, xAxis, yAxis, isInverted, series);
                        bpt1 = getCoordinate(controlPoint1.x, controlPoint1.y, xAxis, yAxis, isInverted, series);
                        bpt2 = getCoordinate(controlPoint2.x, controlPoint2.y, xAxis, yAxis, isInverted, series);
                        direction = direction.concat((startPoint + ' ' + (pt1.x) + ' ' + (pt1.y) + ' ' + 'C' + ' ' + (bpt1.x) + ' '
                            + (bpt1.y) + ' ' + (bpt2.x) + ' ' + (bpt2.y) + ' ' + (pt2.x) + ' ' + (pt2.y) + ' '));
                        startPoint = 'L';
                    }
                    firstPoint = point;
                    this.storePointLocation(point, series, isInverted, getCoordinate);
                }
                else {
                    startPoint = 'M';
                    firstPoint = null;
                    point.symbolLocations = [];
                }
            }
            var name = series.category === 'TrendLine' ? series.chart.element.id + '_Series_' + series.sourceIndex + '_TrendLine_' + series.index :
                series.chart.element.id + '_Series_' + series.index;
            options = new helper_1.PathOption(name, 'transparent', series.width, series.interior, series.opacity, series.dashArray, direction);
            this.appendLinePath(options, series, '');
            this.renderMarker(series);
        };
        SplineSeries.prototype.getModuleName = function () {
            return 'SplineSeries';
        };
        SplineSeries.prototype.destroy = function (chart) {
        };
        return SplineSeries;
    }(spline_base_1.SplineBase));
    exports.SplineSeries = SplineSeries;
});