all files / chart3d/axis/ category-axis.js

100% Statements 60/60
88% Branches 22/25
100% Functions 15/15
100% Lines 57/57
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          203×   432× 432× 432× 432×   498× 498× 498× 338×     160×   498× 498× 498×   498× 498× 498× 498× 498× 498×   432× 432× 432× 432× 432× 432× 432× 432× 3194× 3194× 2954× 2954×     432× 432×     4177×          
/* 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", "../utils/doubleRange", "../../common/utils/helper", "@syncfusion/ej2-base", "../axis/axis-helper"], function (require, exports, helper_1, doubleRange_1, helper_2, ej2_base_1, axis_helper_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Category3D = (function (_super) {
        __extends(Category3D, _super);
        function Category3D(chart) {
            return _super.call(this, chart) || this;
        }
        Category3D.prototype.calculateRangeAndInterval = function (size, axis) {
            this.calculateRange(axis);
            this.getActualRange(axis, size);
            this.applyRangePadding(axis, size);
            this.calculateVisibleLabels(axis);
        };
        Category3D.prototype.getActualRange = function (axis, size) {
            this.initializeDoubleRange(axis);
            axis.actualRange = {};
            if (!axis.interval) {
                axis.actualRange.interval = Math.max(1, Math.floor(axis.doubleRange.delta / helper_1.getActualDesiredIntervalsCount(size, axis)));
            }
            else {
                axis.actualRange.interval = Math.ceil(axis.interval);
            }
            axis.actualRange.min = axis.doubleRange.start;
            axis.actualRange.max = axis.doubleRange.end;
            axis.actualRange.delta = axis.doubleRange.delta;
        };
        Category3D.prototype.applyRangePadding = function (axis, size) {
            var ticks = 0.5;
            axis.actualRange.min -= ticks;
            axis.actualRange.max += ticks;
            axis.doubleRange = new doubleRange_1.DoubleRange(axis.actualRange.min, axis.actualRange.max);
            axis.actualRange.delta = axis.doubleRange.delta;
            this.calculateVisibleRange(size, axis);
        };
        Category3D.prototype.calculateVisibleLabels = function (axis) {
            axis.visibleLabels = [];
            axis.visibleRange.interval = axis.visibleRange.interval < 1 ? 1 : axis.visibleRange.interval;
            var tempInterval = Math.ceil(axis.visibleRange.min);
            var labelStyle;
            var position;
            axis.startLabel = axis.labels[Math.round(axis.visibleRange.min)];
            axis.endLabel = axis.labels[Math.floor(axis.visibleRange.max)];
            for (; tempInterval <= axis.visibleRange.max; tempInterval += axis.visibleRange.interval) {
                labelStyle = (ej2_base_1.extend({}, ej2_base_1.getValue('properties', axis.labelStyle), null, true));
                if (helper_2.withIn(tempInterval, axis.visibleRange) && axis.labels.length > 0) {
                    position = Math.round(tempInterval);
                    helper_1.triggerLabelRender(this.chart, position, axis.labels[position] ? axis.labels[position].toString() : position.toString(), labelStyle, axis);
                }
            }
            Eif (axis.getMaxLabelWidth) {
                axis.getMaxLabelWidth(this.chart);
            }
        };
        Category3D.prototype.getModuleName = function () {
            return 'Category3D';
        };
        Category3D.prototype.destroy = function () {
        };
        return Category3D;
    }(axis_helper_1.NiceIntervals));
    exports.Category3D = Category3D;
});