UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

202 lines (201 loc) 8.09 kB
/* 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 { __extends, __values } from "tslib"; import { ScatterDataInfo } from "./ScatterDataInfo"; import { List$1 } from "./List$1"; import { BreakEvenItem } from "./BreakEvenItem"; import { fromEnum, Point_$type, markType } from "./type"; import { DataSeriesMemberPathHint } from "./DataSeriesMemberPathHint"; import { LineEquation } from "./LineEquation"; import { Compute } from "./Compute"; import { ShapeChartUtils } from "./ShapeChartUtils"; /** * @hidden */ var BreakEvenDataInfo = /** @class */ /*@__PURE__*/ (function (_super) { __extends(BreakEvenDataInfo, _super); function BreakEvenDataInfo(a) { var _this = _super.call(this, a) || this; _this.ac = null; _this.ad = null; _this.af = null; _this.ab = null; _this.aa = null; _this.ah = null; _this.ae = null; _this.ag = null; _this.u = null; _this.z = null; _this.x = null; _this.w = null; _this.v = null; _this.y = null; _this.ac = new List$1(BreakEvenItem.$, 0); _this.af = new List$1(BreakEvenItem.$, 0); _this.ad = new List$1(BreakEvenItem.$, 0); _this.y = ((function () { var $ret = new DataSeriesMemberPathHint(); $ret.intent = 19; return $ret; })()); _this.u = ((function () { var $ret = new DataSeriesMemberPathHint(); $ret.intent = 20; return $ret; })()); _this.z = ((function () { var $ret = new DataSeriesMemberPathHint(); $ret.intent = 21; return $ret; })()); _this.x = ((function () { var $ret = new DataSeriesMemberPathHint(); $ret.intent = 22; return $ret; })()); _this.w = ((function () { var $ret = new DataSeriesMemberPathHint(); $ret.intent = 23; return $ret; })()); _this.v = ((function () { var $ret = new DataSeriesMemberPathHint(); $ret.intent = 24; return $ret; })()); return _this; } BreakEvenDataInfo.prototype.ai = function () { var e_1, _a; this.ad.clear(); this.ac.clear(); this.ac.o(this.af); if (this.ac.count == 1) { var a = new BreakEvenItem(); a.FixedCost = this.af._inner[0].FixedCost; a.VariableCost = 0; a.MarginalProfit = 0; a.SalesRevenue = 0; a.Units = 0; this.ac.add(a); } this.ab = ((function () { var $ret = new BreakEvenItem(); $ret.MarginalProfit = 1.7976931348623157E+308; $ret.VariableCost = 1.7976931348623157E+308; $ret.FixedCost = 1.7976931348623157E+308; $ret.SalesRevenue = 1.7976931348623157E+308; $ret.Units = 1.7976931348623157E+308; return $ret; })()); this.aa = ((function () { var $ret = new BreakEvenItem(); $ret.MarginalProfit = -1.7976931348623157E+308; $ret.VariableCost = -1.7976931348623157E+308; $ret.FixedCost = -1.7976931348623157E+308; $ret.SalesRevenue = -1.7976931348623157E+308; $ret.Units = -1.7976931348623157E+308; return $ret; })()); try { for (var _b = __values(fromEnum(this.ac)), _c = _b.next(); !_c.done; _c = _b.next()) { var b = _c.value; this.ab.VariableCost = Math.min(this.ab.VariableCost, b.VariableCost); this.aa.VariableCost = Math.max(this.aa.VariableCost, b.VariableCost); this.ab.FixedCost = Math.min(this.ab.FixedCost, b.FixedCost); this.aa.FixedCost = Math.max(this.aa.FixedCost, b.FixedCost); this.ab.Units = Math.min(this.ab.Units, b.Units); this.aa.Units = Math.max(this.aa.Units, b.Units); this.ab.MarginalProfit = Math.min(this.ab.MarginalProfit, b.MarginalProfit); this.aa.MarginalProfit = Math.max(this.aa.MarginalProfit, b.MarginalProfit); this.ab.SalesRevenue = Math.min(this.ab.SalesRevenue, b.SalesRevenue); this.aa.SalesRevenue = Math.max(this.aa.SalesRevenue, b.SalesRevenue); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } var c = new LineEquation(0, this.ab.Units, this.ab.MarginalProfit, this.aa.Units, this.aa.MarginalProfit); var d = new LineEquation(0, this.ab.Units, this.ab.SalesRevenue, this.aa.Units, this.aa.SalesRevenue); var e = new LineEquation(0, this.ab.Units, this.ab.TotalCost, this.aa.Units, this.aa.TotalCost); var f = new LineEquation(0, this.ab.Units, this.ab.FixedCost, this.aa.Units, this.aa.FixedCost); var g = Compute.a(d, e); var h = Compute.a(c, f); var i = new BreakEvenItem(); i.FixedCost = this.ac._inner[0].FixedCost; i.VariableCost = g.y - i.FixedCost; i.SalesRevenue = g.y; i.MarginalProfit = h.y; i.Units = g.x; var j = new BreakEvenItem(); j.SalesRevenue = g.y; j.Units = g.x; var k = new BreakEvenItem(); k.SalesRevenue = h.y; k.Units = h.x; var l = new BreakEvenItem(); l.SalesRevenue = g.y; l.Units = this.ab.Units; var m = new BreakEvenItem(); m.SalesRevenue = 0; m.Units = g.x; this.ad.add(l); this.ad.add(j); this.ad.add(m); this.ah = new List$1(List$1.$.specialize(Point_$type), 0); this.ah.add(((function () { var $ret = new List$1(Point_$type, 0); $ret.add(h); $ret.add(f.f); $ret.add(c.f); return $ret; })())); this.ae = new List$1(List$1.$.specialize(Point_$type), 0); this.ae.add(((function () { var $ret = new List$1(Point_$type, 0); $ret.add(g); $ret.add(d.g); $ret.add(e.g); return $ret; })())); this.ag = new List$1(List$1.$.specialize(Point_$type), 0); this.ag.add(((function () { var $ret = new List$1(Point_$type, 0); $ret.add(g); $ret.add(e.f); $ret.add(d.f); return $ret; })())); }; BreakEvenDataInfo.prototype.s = function (a, b) { if (b === void 0) { b = null; } if (a == null || a.count == 0) { return; } this.z.update(ShapeChartUtils.ab(a).toArray(), b); this.u.update(ShapeChartUtils.q(a).toArray(), b); this.x.update(ShapeChartUtils.z(a).toArray(), b); this.w.update(ShapeChartUtils.w(a).toArray(), b); this.v.update(ShapeChartUtils.v(a).toArray(), b); this.y.update(ShapeChartUtils.x(a).toArray(), b); }; BreakEvenDataInfo.$t = markType(BreakEvenDataInfo, 'BreakEvenDataInfo', ScatterDataInfo.$); return BreakEvenDataInfo; }(ScatterDataInfo)); export { BreakEvenDataInfo };