/*
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 { AxisVisualDataList } from "./AxisVisualDataList";
import { SeriesVisualDataList } from "./SeriesVisualDataList";
import { RectData } from "igniteui-react-core/ES5/RectData";
import { Base, fromEnum, markType } from "igniteui-react-core/ES5/type";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { StringBuilder } from "igniteui-react-core/ES5/StringBuilder";
import { PointData } from "igniteui-react-core/ES5/PointData";
var ChartVisualData = /** @class */ (function (_super) {
    tslib_1.__extends(ChartVisualData, _super);
    function ChartVisualData() {
        var _this = _super.call(this) || this;
        _this._axes = null;
        _this._series = null;
        _this._title = null;
        _this._subtitle = null;
        _this._width = 0;
        _this._height = 0;
        _this._contentArea = null;
        _this._centralArea = null;
        _this._plotArea = null;
        _this._name = null;
        _this._isViewportScaled = false;
        _this._dipScalingRatio = 0;
        _this.dipScalingRatio = 1;
        _this.axes = new AxisVisualDataList();
        _this.series = new SeriesVisualDataList();
        return _this;
    }
    Object.defineProperty(ChartVisualData.prototype, "axes", {
        get: function () {
            return this._axes;
        },
        set: function (a) {
            this._axes = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "series", {
        get: function () {
            return this._series;
        },
        set: function (a) {
            this._series = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "title", {
        get: function () {
            return this._title;
        },
        set: function (a) {
            this._title = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "subtitle", {
        get: function () {
            return this._subtitle;
        },
        set: function (a) {
            this._subtitle = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "width", {
        get: function () {
            return this._width;
        },
        set: function (a) {
            this._width = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "height", {
        get: function () {
            return this._height;
        },
        set: function (a) {
            this._height = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "contentArea", {
        get: function () {
            return this._contentArea;
        },
        set: function (a) {
            this._contentArea = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "centralArea", {
        get: function () {
            return this._centralArea;
        },
        set: function (a) {
            this._centralArea = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "plotArea", {
        get: function () {
            return this._plotArea;
        },
        set: function (a) {
            this._plotArea = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "name", {
        get: function () {
            return this._name;
        },
        set: function (a) {
            this._name = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ChartVisualData.prototype, "isViewportScaled", {
        get: function () {
            return this._isViewportScaled;
        },
        set: function (a) {
            this._isViewportScaled = a;
        },
        enumerable: true,
        configurable: true
    });
    ChartVisualData.prototype.scaleByViewport = function () {
        try {
            for (var _a = tslib_1.__values(fromEnum(this.axes)), _b = _a.next(); !_b.done; _b = _a.next()) {
                var a = _b.value;
                a.o();
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
            }
            finally { if (e_1) throw e_1.error; }
        }
        try {
            for (var _d = tslib_1.__values(fromEnum(this.series)), _e = _d.next(); !_e.done; _e = _d.next()) {
                var b = _e.value;
                b.l();
            }
        }
        catch (e_2_1) { e_2 = { error: e_2_1 }; }
        finally {
            try {
                if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
            }
            finally { if (e_2) throw e_2.error; }
        }
        if (this.title != null) {
            this.title.g();
        }
        if (this.subtitle != null) {
            this.subtitle.g();
        }
        var e_1, _c, e_2, _f;
    };
    ChartVisualData.prototype.getBounds = function () {
        return new RectData(0, 0, this.width, this.height);
    };
    ChartVisualData.prototype.serialize = function () {
        var a = new StringBuilder(0);
        a.u("{");
        a.u("name: '" + this.name + "',");
        a.u("width: " + this.width + ",");
        a.u("height: " + this.height + ",");
        a.u("plotArea: { left: " + this.plotArea.left + ", top: " + this.plotArea.top + ", width: " + this.plotArea.width + ", height: " + this.plotArea.height + "}, ");
        a.u("contentArea: { left: " + this.contentArea.left + ", top: " + this.contentArea.top + ", width: " + this.contentArea.width + ", height: " + this.contentArea.height + "}, ");
        a.u("centralArea: { left: " + this.centralArea.left + ", top: " + this.centralArea.top + ", width: " + this.centralArea.width + ", height: " + this.centralArea.height + "}, ");
        a.u("isViewportScaled: " + (this.isViewportScaled ? "true" : "false") + ", ");
        a.u("axes: [");
        for (var b = 0; b < this.axes.count; b++) {
            if (b != 0) {
                a.l(", ");
            }
            a.l(this.axes._inner[b].serialize());
        }
        a.u("],");
        a.u("series: [");
        for (var c = 0; c < this.series.count; c++) {
            if (c != 0) {
                a.l(", ");
            }
            a.l(this.series._inner[c].serialize());
        }
        a.u("]");
        if (this.title != null) {
            a.u(", title: " + this.title.serialize());
        }
        if (this.subtitle != null) {
            a.u(", subtitle: " + this.subtitle.serialize());
        }
        a.l(", dipScalingRatio: " + this.dipScalingRatio.toString());
        a.u("}");
        return a.toString();
    };
    ChartVisualData.prototype.getSerializedSeriesPoints = function (a, b, c) {
        var d = new List$1(List$1.$.specialize(PointData.$), 0);
        for (var e = 0; e < this.series.count; e++) {
            if (this.series._inner[e].name == a) {
                var f = this.series._inner[e].shapes.containingTag(b);
                for (var g = 0; g < f.count; g++) {
                    var h = f._inner[e];
                    h.getPointsOverride(d, c);
                }
            }
        }
        var i = new StringBuilder(0);
        i.u("[");
        for (var j = 0; j < d.count; j++) {
            var k = d._inner[j];
            i.u("[");
            for (var l = 0; l < k.count; l++) {
                if (l != 0) {
                    i.l(", ");
                }
                i.l("{ x: " + k._inner[l].x + ", y: " + k._inner[l].y + "}");
            }
            i.u("]");
        }
        i.u("]");
        return i.toString();
    };
    Object.defineProperty(ChartVisualData.prototype, "dipScalingRatio", {
        get: function () {
            return this._dipScalingRatio;
        },
        set: function (a) {
            this._dipScalingRatio = a;
        },
        enumerable: true,
        configurable: true
    });
    ChartVisualData.$t = markType(ChartVisualData, 'ChartVisualData');
    return ChartVisualData;
}(Base));
export { ChartVisualData };
