all files / chart/series/ stacking-column-series.js

96.15% Statements 75/78
88.24% Branches 60/68
100% Functions 15/15
96% Lines 72/75
11 statements, 6 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117          158× 158× 158×   508× 508× 508× 508× 508× 3624× 3624×   508× 465×     3636× 3636× 3636× 3581× 3581× 3581× 258× 258×         258×       3581×     3581× 258× 258×     3323×   3581×   3581×   3581× 3577× 3577× 3577× 150×         150×             12× 12×     12×         24×     41538×        
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        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 extendStatics(d, b);
    };
    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", "./column-base"], function (require, exports, helper_1, column_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var StackingColumnSeries = (function (_super) {
        __extends(StackingColumnSeries, _super);
        function StackingColumnSeries() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this.sideBySideInfo = [];
            return _this;
        }
        StackingColumnSeries.prototype.render = function (series) {
            series.isRectSeries = true;
            this.sideBySideInfo[series.index] = this.getSideBySideInfo(series);
            var stackedValue = series.stackedValues;
            var visiblePoints = helper_1.getVisiblePoints(series);
            for (var _i = 0, visiblePoints_1 = visiblePoints; _i < visiblePoints_1.length; _i++) {
                var point = visiblePoints_1[_i];
                this.renderPoint(series, point, this.sideBySideInfo[series.index], stackedValue, visiblePoints);
            }
            if (series.visible) {
                this.renderMarker(series);
            }
        };
        StackingColumnSeries.prototype.renderPoint = function (series, point, sideBySideInfo, stackedValue, visiblePoints) {
            point.symbolLocations = [];
            point.regions = [];
            if (point.visible && helper_1.withInRange(visiblePoints[point.index - 1], point, visiblePoints[point.index + 1], series)) {
                var index = void 0;
                var startvalue = void 0;
                if (!series.visible && series.isLegendClicked) {
                    for (var i = series.index; i >= 0; i--) {
                        Iif (series.chart.visibleSeries[i].visible) {
                            index = series.chart.visibleSeries[i].index;
                            break;
                        }
                    }
                    startvalue = series.index > 0 && index !== undefined ?
                        series.chart.visibleSeries[index].stackedValues.endValues[point.index] :
                        series.stackedValues.startValues[point.index];
                }
                this.rect = this.getRectangle(point.xValue + sideBySideInfo.start, (!series.visible && series.isLegendClicked) ? startvalue :
                    stackedValue.endValues[point.index], point.xValue + sideBySideInfo.end, (!series.visible && series.isLegendClicked) ?
                    startvalue : stackedValue.startValues[point.index], series);
                if (series.chart.isTransposed && series.columnWidthInPixel) {
                    this.rect.height = series.columnWidthInPixel ? series.columnWidthInPixel : this.rect.width;
                    this.rect.y -= series.columnWidthInPixel / 2;
                }
                else {
                    this.rect.width = series.columnWidthInPixel ? series.columnWidthInPixel : this.rect.width;
                }
                this.rect.x = series.columnWidthInPixel ? series.chart.isTransposed ? this.rect.x : this.rect.x -
                    (((series.columnWidthInPixel / 2) * series.rectCount) - (series.columnWidthInPixel * series.position)) : this.rect.x;
                var argsData = this.triggerEvent(series, point, series.interior, { width: series.visible ?
                        series.border.width : 0, color: series.visible ? series.border.color : '' });
                if (!argsData.cancel) {
                    this.drawRectangle(series, point, this.rect, argsData);
                    this.updateSymbolLocation(point, this.rect, series);
                    if (series.columnFacet === 'Cylinder') {
                        var cylinderSeriesOption = {
                            'isColumn': true,
                            'stacking': series.type === 'StackingColumn100',
                            'isLastSeries': true
                        };
                        this.drawCylinder(this.options, this.element, cylinderSeriesOption, this.rect, series);
                    }
                }
            }
        };
        StackingColumnSeries.prototype.updateDirection = function (series, point) {
            var seriesCollection = [];
            for (var i = 0; i < series.xAxis.series.length; i++) {
                var stackSeries = series.xAxis.series[i];
                Eif (stackSeries.stackingGroup === series.stackingGroup) {
                    seriesCollection.push(stackSeries);
                }
            }
            for (var j = 0; j < seriesCollection.length; j++) {
                var visiblePoints = helper_1.getVisiblePoints(seriesCollection[j]);
                for (var i = 0; i < point.length; i++) {
                    this.renderPoint(seriesCollection[j], seriesCollection[j].points[point[i]], this.sideBySideInfo[series.index], seriesCollection[j].stackedValues, visiblePoints);
                    Iif (series.marker && series.marker.visible) {
                        seriesCollection[j].chart.markerRender.renderMarker(seriesCollection[j], seriesCollection[j].points[point[i]], seriesCollection[j].points[point[i]].symbolLocations[0], null, true);
                    }
                    if (seriesCollection[j].marker.dataLabel.visible && seriesCollection[j].chart.dataLabelModule) {
                        seriesCollection[j].chart.dataLabelModule.commonId = seriesCollection[j].chart.element.id + '_Series_' + seriesCollection[j].index + '_Point_';
                        seriesCollection[j].chart.dataLabelModule.renderDataLabel(seriesCollection[j], seriesCollection[j].points[point[i]], null, seriesCollection[j].marker.dataLabel);
                    }
                }
            }
        };
        StackingColumnSeries.prototype.doAnimation = function (series) {
            this.animate(series);
        };
        StackingColumnSeries.prototype.destroy = function () {
        };
        StackingColumnSeries.prototype.getModuleName = function () {
            return 'StackingColumnSeries';
        };
        return StackingColumnSeries;
    }(column_base_1.ColumnBase));
    exports.StackingColumnSeries = StackingColumnSeries;
});