/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { IgrAxis } from './igr-axis';
import { toPoint, fromRect, ensureBool } from "igniteui-react-core/ES5/componentUtil";
/**
 * Represents the base class for all IgxDataChartComponent category-based axes.
*/
var IgrCategoryAxisBase = /** @class */ (function (_super) {
    tslib_1.__extends(IgrCategoryAxisBase, _super);
    function IgrCategoryAxisBase(props) {
        var _this = _super.call(this, props) || this;
        _this._chartLevelData = null;
        _this._dataSource = null;
        return _this;
    }
    IgrCategoryAxisBase.prototype.provideData = function (data) {
        this._chartLevelData = data;
        this.updateDataSource();
    };
    IgrCategoryAxisBase.prototype.updateDataSource = function () {
        if (this._dataSource == null) {
            this.i.itemsSource = this._chartLevelData;
        }
        else {
            this.i.itemsSource = this._dataSource;
        }
    };
    Object.defineProperty(IgrCategoryAxisBase.prototype, "dataSource", {
        get: function () {
            if (this._dataSource != null) {
                return this._dataSource;
            }
            return this.i.itemsSource;
        },
        set: function (value) {
            this._dataSource = value;
            this.updateDataSource();
            //console.log("setting axis data source: " + value)
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "isContinuous", {
        /**
     * Gets if the current axis is a continuous rather than a discrete scale
    */
        get: function () {
            return this.i.b4;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "isCategory", {
        /**
         * Checks if the axis is of category axis type
        */
        get: function () {
            return this.i.b2;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "itemsCount", {
        /**
         * Gets the number of items in the current category axis items source.
        */
        get: function () {
            return this.i.jr;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "gap", {
        /**
         * Gets or sets the amount of space between adjacent categories for the current axis object.
         * The gap is silently clamped to the range [0, 1] when used.
        */
        get: function () {
            return this.i.jg;
        },
        set: function (v) {
            this.i.jg = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "overlap", {
        /**
         * Gets or sets the amount of overlap between adjacent categories for the current axis object.
         * The overlap is silently clamped to the range [-1, 1] when used.
        */
        get: function () {
            return this.i.jn;
        },
        set: function (v) {
            this.i.jn = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrCategoryAxisBase.prototype, "useClusteringMode", {
        /**
         * Gets or sets whether the category axis should use clustering display mode even if no series are present that would force clustering mode.
        */
        get: function () {
            return this.i.jb;
        },
        set: function (v) {
            this.i.jb = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    IgrCategoryAxisBase.prototype.getCategoryBoundingBox = function (point, useInterpolation, singularWidth) {
        var iv = this.i.km(toPoint(point), useInterpolation, singularWidth);
        return fromRect(iv);
    };
    IgrCategoryAxisBase.prototype.getCategoryBoundingBoxHelper = function (point, useInterpolation, singularWidth, isVertical) {
        var iv = this.i.kn(toPoint(point), useInterpolation, singularWidth, isVertical);
        return fromRect(iv);
    };
    /**
     * Unscales a value from screen space into axis space.
    
    * @param unscaledValue  * The scaled value in screen coordinates to unscale into axis space.
    */
    IgrCategoryAxisBase.prototype.unscaleValue = function (unscaledValue) {
        var iv = this.i.jo(unscaledValue);
        return (iv);
    };
    IgrCategoryAxisBase.prototype.notifySetItem = function (index, oldItem, newItem) {
        this.i.j9(index, oldItem, newItem);
    };
    /**
     * Used to manually notify the axis that the data source has reset or cleared its items.
    
    */
    IgrCategoryAxisBase.prototype.notifyClearItems = function () {
        this.i.j6();
    };
    IgrCategoryAxisBase.prototype.notifyInsertItem = function (index, newItem) {
        this.i.j7(index, newItem);
    };
    IgrCategoryAxisBase.prototype.notifyRemoveItem = function (index, oldItem) {
        this.i.j8(index, oldItem);
    };
    return IgrCategoryAxisBase;
}(IgrAxis));
export { IgrCategoryAxisBase };
