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

100% Statements 56/56
100% Branches 38/38
100% Functions 12/12
100% Lines 53/53
4 statements, 2 functions, 6 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  272× 272× 272×       1246×   1973× 1973× 1973× 1973× 1973× 1973× 1973× 1973× 1973× 1973× 1973× 32893× 32893× 32893× 29536× 29536× 29536× 29536×     3357× 3357× 3357×     1973× 58× 56× 56× 56×     1973×     1973× 1973× 1973×   214× 214×   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", "./line-base"], function (require, exports, helper_1, line_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var LineSeries = (function (_super) {
        __extends(LineSeries, _super);
        function LineSeries() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        LineSeries.prototype.render = function (series, xAxis, yAxis, isInverted) {
            var point1;
            var point2;
            var direction = '';
            var prevPoint = null;
            var startPoint = 'M';
            var options;
            var isPolar = (series.chart && series.chart.chartAreaType === 'PolarRadar');
            var isDrop = (series.emptyPointSettings && series.emptyPointSettings.mode === 'Drop');
            var getCoordinate = isPolar ? helper_1.TransformToVisible : helper_1.getPoint;
            var visiblePoints = this.improveChartPerformance(series);
            for (var _i = 0, visiblePoints_1 = visiblePoints; _i < visiblePoints_1.length; _i++) {
                var point = visiblePoints_1[_i];
                point.regions = [];
                if (point.visible && helper_1.withInRange(visiblePoints[point.index - 1], point, visiblePoints[point.index + 1], series)) {
                    direction += this.getLineDirection(prevPoint, point, series, isInverted, getCoordinate, startPoint);
                    startPoint = prevPoint ? 'L' : startPoint;
                    prevPoint = point;
                    this.storePointLocation(point, series, isInverted, getCoordinate);
                }
                else {
                    prevPoint = isDrop ? prevPoint : null;
                    startPoint = isDrop ? startPoint : 'M';
                    point.symbolLocations = [];
                }
            }
            if (isPolar) {
                if (series.isClosed) {
                    point2 = getCoordinate(visiblePoints[visiblePoints.length - 1].xValue, visiblePoints[visiblePoints.length - 1].yValue, xAxis, yAxis, isInverted, series);
                    point1 = getCoordinate(visiblePoints[0].xValue, visiblePoints[0].yValue, xAxis, yAxis, isInverted, series);
                    direction = direction.concat(startPoint + ' ' + point2.x + ' ' + point2.y + ' ' + 'L' + ' ' + point1.x + ' ' + point1.y);
                }
            }
            var name = series.category === 'Indicator' ? series.chart.element.id + '_Indicator_' + series.index + '_' + series.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, 'none', series.width, series.interior, series.opacity, series.dashArray, direction);
            this.appendLinePath(options, series, '');
            this.renderMarker(series);
        };
        LineSeries.prototype.doAnimation = function (series) {
            var option = series.animation;
            this.doProgressiveAnimation(series, option);
        };
        LineSeries.prototype.getModuleName = function () {
            return 'LineSeries';
        };
        LineSeries.prototype.destroy = function (chart) {
        };
        return LineSeries;
    }(line_base_1.LineBase));
    exports.LineSeries = LineSeries;
});