import { __extends } from "tslib";
import { IgrCategoryAxisBase } from "./igr-category-axis-base";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { IgrAnchoredCategorySeries } from "./igr-anchored-category-series";
import { toPoint, fromRect, fromPoint } from "igniteui-react-core";
/**
 * Base class for anchored category series with a category x-axis and a numeric y-axis.
*
* Instantiate HorizontalAnchoredCategorySeries
*
* ```ts
*  <IgrDataChart
*     dataSource={this.state.dataSource} >
*
*     <IgrCategoryXAxis name="xAxis" />
*     <IgrNumericYAxis name="yAxis" />
*
*     <IgrColumnSeries
*      name="series1"
*     xAxisName="xAxis"
* 	yAxisName="yAxis"
* 	valueMemberPath="Value" />
*  </IgrDataChart>
* ```
*
* ```ts
* this.columnSeries1 = new IgrColumnSeries({ name: "colSeries1" });
* this.columnSeries1.dataSource = this.categoryData;
* this.columnSeries1.xAxis = this.categoryXAxis;
* this.columnSeries1.yAxis = this.numericYAxis;
* this.columnSeries1.xAxisName = "categoryXAxis";
* this.columnSeries1.yAxisName = "numericYAxis";
* this.columnSeries1.valueMemberPath = "USA";
* ```
*/
var IgrHorizontalAnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(IgrHorizontalAnchoredCategorySeries, _super);
    function IgrHorizontalAnchoredCategorySeries(props) {
        var _this = _super.call(this, props) || this;
        _this._xAxisName = null;
        _this._yAxisName = null;
        return _this;
    }
    Object.defineProperty(IgrHorizontalAnchoredCategorySeries.prototype, "i", {
        /**
                                     * @hidden
                                     */
        get: function () {
            return this._implementation;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalAnchoredCategorySeries.prototype, "xAxis", {
        /**
         * Gets or sets the effective x-axis for this series.
        *
        * Instantiate xAxis
        *
        * ```ts
        *  <IgrDataChart
        *     dataSource={this.state.dataSource} >
        *
        *     <IgrCategoryXAxis name="xAxis" />
        *     <IgrNumericYAxis name="yAxis" />
        *
        *     <IgrColumnSeries
        *      name="series1"
        *     xAxisName="xAxis"
        * 	yAxisName="yAxis"
        * 	valueMemberPath="Value" />
        *  </IgrDataChart>
        * ```
        *
        * ```ts
        * this.columnSeries1 = new IgrColumnSeries({ name: "colSeries1" });
        * this.columnSeries1.dataSource = this.categoryData;
        * this.columnSeries1.xAxis = this.categoryXAxis;
        * this.columnSeries1.yAxis = this.numericYAxis;
        * this.columnSeries1.xAxisName = "categoryXAxis";
        * this.columnSeries1.yAxisName = "numericYAxis";
        * this.columnSeries1.valueMemberPath = "USA";
        * ```
        */
        get: function () {
            var r = this.i.xAxis;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                var e = IgrCategoryAxisBase._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        },
        set: function (v) {
            if (v != null && this._stylingContainer && v._styling)
                v._styling(this._stylingContainer, this, this);
            v == null ? this.i.xAxis = null : this.i.xAxis = v.i;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalAnchoredCategorySeries.prototype, "xAxisName", {
        /**
        * Gets or sets the name to use to resolve xAxis from markup.
        */
        get: function () {
            return this._xAxisName;
        },
        set: function (v) {
            this._xAxisName = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalAnchoredCategorySeries.prototype, "yAxis", {
        /**
         * Gets or sets the effective y-axis for this series.
        *
        * Instantiate yAxis
        *
        * ```ts
        *  <IgrDataChart
        *     dataSource={this.state.dataSource} >
        *
        *     <IgrCategoryXAxis name="xAxis" />
        *     <IgrNumericYAxis name="yAxis" />
        *
        *     <IgrColumnSeries
        *      name="series1"
        *     xAxisName="xAxis"
        * 	yAxisName="yAxis"
        * 	valueMemberPath="Value" />
        *  </IgrDataChart>
        * ```
        *
        * ```ts
        * this.columnSeries1 = new IgrColumnSeries({ name: "colSeries1" });
        * this.columnSeries1.dataSource = this.categoryData;
        * this.columnSeries1.xAxis = this.categoryXAxis;
        * this.columnSeries1.yAxis = this.numericYAxis;
        * this.columnSeries1.xAxisName = "categoryXAxis";
        * this.columnSeries1.yAxisName = "numericYAxis";
        * this.columnSeries1.valueMemberPath = "USA";
        * ```
        */
        get: function () {
            var r = this.i.yAxis;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                var e = IgrNumericYAxis._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        },
        set: function (v) {
            if (v != null && this._stylingContainer && v._styling)
                v._styling(this._stylingContainer, this, this);
            v == null ? this.i.yAxis = null : this.i.yAxis = v.i;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalAnchoredCategorySeries.prototype, "yAxisName", {
        /**
        * Gets or sets the name to use to resolve yAxis from markup.
        */
        get: function () {
            return this._yAxisName;
        },
        set: function (v) {
            this._yAxisName = v;
        },
        enumerable: false,
        configurable: true
    });
    IgrHorizontalAnchoredCategorySeries.prototype.bindAxes = function (axes) {
        _super.prototype.bindAxes.call(this, axes);
        for (var i = 0; i < axes.length; i++) {
            if (this.xAxisName && this.xAxisName.length > 0 &&
                axes[i].name == this.xAxisName) {
                this.xAxis = axes[i];
            }
        }
        for (var i = 0; i < axes.length; i++) {
            if (this.yAxisName && this.yAxisName.length > 0 &&
                axes[i].name == this.yAxisName) {
                this.yAxis = axes[i];
            }
        }
    };
    IgrHorizontalAnchoredCategorySeries.prototype.findByName = function (name) {
        var baseResult = _super.prototype.findByName.call(this, name);
        if (baseResult) {
            return baseResult;
        }
        if (this.xAxis && this.xAxis.name && this.xAxis.name == name) {
            return this.xAxis;
        }
        if (this.yAxis && this.yAxis.name && this.yAxis.name == name) {
            return this.yAxis;
        }
        return null;
    };
    IgrHorizontalAnchoredCategorySeries.prototype._styling = function (container, component, parent) {
        _super.prototype._styling.call(this, container, component, parent);
        this._inStyling = true;
        if (this.xAxis && this.xAxis._styling) {
            this.xAxis._styling(container, component, this);
        }
        if (this.yAxis && this.yAxis._styling) {
            this.yAxis._styling(container, component, this);
        }
        this._inStyling = false;
    };
    /**
     * If possible, will return the best available value marker bounding box within the series that has the best value match for the world position provided.
    
    * @param world  * The world coordinates for which to get a value marker bounding box for
    *
    * You can use the `GetCategoryWidth` to get the width of the category grouping a series is in.
    *
    * <!-- Angular JS -->
    *
    *     var x = financialSeries.GetSeriesValueMarkerBoundingBox(new IgxPoint());
    *
    * <!-- Ignite JS -->
    *
    *      N/A
    */
    IgrHorizontalAnchoredCategorySeries.prototype.getSeriesValueMarkerBoundingBox = function (world) {
        var iv = this.i.tu(toPoint(world));
        return fromRect(iv);
    };
    /**
     * Returns the offset value for this series if grouped on a category axis.
    
    *
    * You can use the `GetOffsetValue` to get the offset value for this series if grouped on a category axis.
    *
    * <!-- Angular JS -->
    *
    *       var g = series.getOffsetValue();
    *
    * <!-- Ignite JS -->
    *
    *      N/A
    */
    IgrHorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        var iv = this.i.getOffsetValue();
        return (iv);
    };
    /**
     * Returns the width of the category grouping this series is in.
    
    *
    * You can use the `GetCategoryWidth` to get the width of the category grouping a series is in.
    *
    * <!-- Angular JS -->
    *
    *      var x = this.financialSeries.CanUseAsXAxis(this.xAxis);
    *
    * <!-- Ignite JS -->
    *
    *      N/A
    */
    IgrHorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var iv = this.i.getCategoryWidth();
        return (iv);
    };
    IgrHorizontalAnchoredCategorySeries.prototype.getSeriesValue = function (world, useInterpolation, skipUnknowns) {
        var iv = this.i.h9(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    };
    IgrHorizontalAnchoredCategorySeries.prototype.getPreviousOrExactIndex = function (world, skipUnknowns) {
        var iv = this.i.jf(toPoint(world), skipUnknowns);
        return (iv);
    };
    IgrHorizontalAnchoredCategorySeries.prototype.getNextOrExactIndex = function (world, skipUnknowns) {
        var iv = this.i.jd(toPoint(world), skipUnknowns);
        return (iv);
    };
    IgrHorizontalAnchoredCategorySeries.prototype.getSeriesValuePosition = function (world, useInterpolation, skipUnknowns) {
        var iv = this.i.th(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    };
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    *
    * You can use the `CanUseAsXAxis` method to determine if object can be used as XAxis
    *
    * <!-- Angular JS -->
    *
    *      var x = this.financialSeries.CanUseAsXAxis(this.xAxis);
    */
    IgrHorizontalAnchoredCategorySeries.prototype.canUseAsXAxis = function (axis) {
        var iv = this.i.y3(axis);
        return (iv);
    };
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    *
    * You can use the `CanUseAsYAxis` method to determine if object can be used as YAxis
    *
    * <!-- Ignite JS -->
    *
    *      N/A
    */
    IgrHorizontalAnchoredCategorySeries.prototype.canUseAsYAxis = function (axis) {
        var iv = this.i.y4(axis);
        return (iv);
    };
    return IgrHorizontalAnchoredCategorySeries;
}(IgrAnchoredCategorySeries));
export { IgrHorizontalAnchoredCategorySeries };
