UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

546 lines (545 loc) 18.6 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 { CategoryAngleAxis } from "./CategoryAngleAxis"; import { ICoalescingModerator_$type } from "./ICoalescingModerator"; import { OthersCategoryContext } from "./OthersCategoryContext"; import { Base, typeCast, Number_$type, enumGetBox, fromEnum, Boolean_$type, markType, markDep } from "igniteui-react-core"; import { DependencyProperty } from "igniteui-react-core"; import { OthersCategoryType_$type } from "igniteui-react-core"; import { IFastItemsSource_$type } from "igniteui-react-core"; import { SeriesViewer } from "./SeriesViewer"; import { List$1 } from "igniteui-react-core"; import { CoreGeometryUtil } from "igniteui-react-core"; import { ArrayExtension } from "igniteui-react-core"; import { PropertyMetadata } from "igniteui-react-core"; import { truncate, isNaN_, isInfinity } from "igniteui-react-core"; /** * @hidden */ var ProportionalCategoryAngleAxis = /** @class */ /*@__PURE__*/ (function (_super) { __extends(ProportionalCategoryAngleAxis, _super); function ProportionalCategoryAngleAxis() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ny = new OthersCategoryContext(); _this.oh = null; _this.ok = null; _this.n1 = null; _this.n5 = true; _this.ob = NaN; _this.n9 = new List$1(Number_$type, 0); _this.n8 = new List$1(Number_$type, 0); _this.n7 = new List$1(Boolean_$type, 0); _this.n4 = false; _this.oa = NaN; _this.of = -1; return _this; } ProportionalCategoryAngleAxis.prototype.get_nz = function () { return this.ny; }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "nz", { get: function () { return this.get_nz(); }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.og = function () { if (this.oh == null) { this.oh = OthersCategoryContext.b(this.ny, this.bi); } return this.oh; }; ProportionalCategoryAngleAxis.prototype.oj = function (a) { if (a) { return this.og(); } else { return this.nz; } }; ProportionalCategoryAngleAxis.prototype.n6 = function (a) { return a == this.nz || a == this.oh; }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "or", { get: function () { return this.ok; }, set: function (a) { var b = this.or; if (a != b) { this.ok = a; this.h5("ValueMemberPath", b, this.or); } }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.fz = function (a, b) { var c = this.gu(b); if (this.hasOthersCategory && c == "Label") { if (typeCast(OthersCategoryContext.$, a) !== null) { return this.op(); } else { var int_ = this.oi(a); if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) { return this.op(); } } } return _super.prototype.fz.call(this, a, b); }; ProportionalCategoryAngleAxis.prototype.oi = function (a) { if (a == null) { return null; } return a.i ? a.i : a; return null; }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "normalizationMayContainUnknowns", { get: function () { return this.n3 == null || this.n3.mayContainUnknowns; }, enumerable: false, configurable: true }); Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "n3", { get: function () { return this.n1; }, set: function (a) { if (this.n1 != a) { var b = this.n1; this.n1 = a; this.h5("ValueColumn", b, this.n1); } }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.n2 = function (a) { if (a == null) { return this.kv.registerColumn(null, null, false); } var b = null; var c = SeriesViewer.cv(a, this.coercionMethods); b = c.a; return this.kv.registerColumn(a, b, this.expectFunctions); }; ProportionalCategoryAngleAxis.prototype.hz = function (a, b, c, d) { var e_1, _a; _super.prototype.hz.call(this, a, b, c, d); switch (b) { case "ValueMemberPath": if (this.kv != null) { this.kv.deregisterColumn(this.n3); this.n3 = this.n2(this.or); } break; case "ValueColumn": this.n5 = true; this.n4 = false; this.ia(); break; case ProportionalCategoryAngleAxis.$$p[0]: case ProportionalCategoryAngleAxis.$$p[1]: case ProportionalCategoryAngleAxis.$$p[2]: this.n5 = true; this.n4 = false; this.ia(); try { for (var _b = __values(fromEnum(this.db())), _c = _b.next(); !_c.done; _c = _b.next()) { var e = _c.value; e.ru(true); } } 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; } } break; case "FastItemsSource": this.n5 = true; this.n4 = false; var f = typeCast(IFastItemsSource_$type, c); if (f != null) { f.deregisterColumn(this.n3); this.n3 = null; } var g = typeCast(IFastItemsSource_$type, d); if (g != null) { this.n3 = this.n2(this.or); } this.ia(); break; } }; ProportionalCategoryAngleAxis.prototype.l7 = function (a) { _super.prototype.l7.call(this, a); this.n5 = true; this.n4 = false; }; ProportionalCategoryAngleAxis.prototype.getScaledAngle = function (a) { this.ot(); if (isNaN_(a) || isInfinity(a)) { return NaN; } var b = this.lj; var c = a % b; if (c < 0) { c = b + c; } var d = truncate(Math.floor(c)); var e = this.n8._inner[d]; var f = c - d; var g = 0; if (isNaN_(this.n9._inner[d])) { g = 0 * f; } else { g = this.n9._inner[d] * f; } var h = e + g; if (this.ci) { h = 1 - h; } var i = (h * 2 * Math.PI); if (a >= b) { i += (2 * Math.PI) * Math.floor(a / b); } if (a < 0) { i -= (2 * Math.PI) * Math.abs(Math.floor(a / b)); } return i + this.m2; }; ProportionalCategoryAngleAxis.prototype.get_cl = function () { return true; }; ProportionalCategoryAngleAxis.prototype.m6 = function (a, b, c, d, e) { var f = 0.5; if (this.ll > 1) { var g = this.lf(c, d, e); var h = 0; if (!isNaN_(this.le)) { h = Math.min(this.le, 1); } var i = 1 - 0.5 * g; var j = i / (this.ll - (this.ll - 1) * h); var k = (i - j) / (this.ll - 1); f = 0.25 * g + 0.5 * j + a * k; } return this.oc(a, c, d, e) * f; }; ProportionalCategoryAngleAxis.prototype.oc = function (a, b, c, d) { if (a < 0 || a > this.lk - 1) { return this.getCategorySize(b, c, d); } this.ot(); var e = this.n9._inner[a]; if (isNaN_(e)) { return NaN; } var f = Math.PI * 2 * this.n9._inner[a]; return f; }; ProportionalCategoryAngleAxis.prototype.m7 = function (a, b, c, d) { this.ot(); var e = this.lf(b, c, d); var f = 0; if (!isNaN_(this.le)) { f = Math.min(this.le, 1); } var g = 1 - 0.5 * e; if (a < 0 || a > this.lk - 1) { return this.k8(b, c, d); } var h = this.n9._inner[a]; if (isNaN_(h)) { return NaN; } var i = Math.PI * 2 * h; return i * g / (this.ll - (this.ll - 1) * f); }; ProportionalCategoryAngleAxis.prototype.lm = function () { if (this.kv == null) { return 0; } this.ot(); if (this.n4) { return _super.prototype.lm.call(this) + 1; } return _super.prototype.lm.call(this); }; ProportionalCategoryAngleAxis.prototype.mx = function (a) { return this.hasOthersCategory && a == this.lk - 1; }; ProportionalCategoryAngleAxis.prototype.nk = function () { return this.op(); }; ProportionalCategoryAngleAxis.prototype.my = function (a) { if (a >= 0 && a < this.lk) { if (isNaN_(this.n9._inner[a])) { return true; } } return _super.prototype.my.call(this, a); }; ProportionalCategoryAngleAxis.prototype.ic = function (a) { this.ot(); _super.prototype.ic.call(this, a); }; ProportionalCategoryAngleAxis.prototype.ensureSum = function () { this.ot(); }; ProportionalCategoryAngleAxis.prototype.ot = function () { if (this.n5) { this.n5 = false; this.n4 = false; this.lk = this.lm(); this.oa = NaN; this.of = -1; if (this.n3 != null && this.n3.count > 0) { this.ob = NaN; var a = true; for (var b = 0; b < this.n3.count; b++) { var c = this.n3.item(b); if (isNaN_(c) || isInfinity(c) || c < 0) { continue; } if (a) { a = false; this.ob = 0; } this.ob += c; } var d = 0; this.n9.clear(); this.n8.clear(); this.n7.clear(); var e = new List$1(Base.$, 0); this.nz.items = null; var f = 0; for (var g = 0; g < this.n3.count; g++) { var h = 0; if (isNaN_(this.ob)) { h = 1 / this.lk; } else { var i = this.n3.item(g); if (isNaN_(i) || isInfinity(i) || i < 0) { h = 0; } else { h = i; } } var j = false; if (this.n0 == 0) { if (h < this.oe) { j = true; } } else { if ((h / this.ob) * 100 < this.oe) { j = true; } } if (j) { e.add1(this.kv.item(g)); this.n8.add(d); this.n9.add(NaN); this.n7.add(true); f += h; } else { this.n8.add(d); this.n9.add(h / this.ob); this.n7.add(false); d += (h / this.ob); } } if (f > 0) { this.n4 = true; this.n8.add(d); this.n9.add(f / this.ob); this.n7.add(false); this.oa = f; this.of = this.n8.count - 1; this.nz.items = e.toArray(); } } else { if (this.lk > 0) { this.n9.clear(); this.n8.clear(); var k = 0; for (var l = 0; l < this.lk; l++) { this.n8.add(k); this.n9.add(1 / this.lk); k += (1 / this.lk); } } } this.lk = this.lm(); } }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersValue", { get: function () { return this.oa; }, enumerable: false, configurable: true }); Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersIndex", { get: function () { return this.of; }, enumerable: false, configurable: true }); Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "hasOthersCategory", { get: function () { return this.n4; }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.hq = function (a, b, c, d) { for (var e = b; e < c; e++) { a.item(e, this.el(a.item(e), d)); } }; ProportionalCategoryAngleAxis.prototype.getUnscaledAngle = function (a) { this.ot(); if (isNaN_(a) || isInfinity(a)) { return NaN; } a = CoreGeometryUtil.b(a); while (a < this.m2) { a += 2 * Math.PI; } while (a > (this.m2 + (2 * Math.PI))) { a -= 2 * Math.PI; } var b = (a - this.m2) / (2 * Math.PI); if (this.ch) { b = 1 - b; } var c = -1; c = ArrayExtension.binarySearch$11(Number_$type, this.n8, function (d) { return b < d ? -1 : (b > d ? 1 : 0); }); if (c < 0) { c = ~c; c--; } if (c < 0) { c = 0; } if (c > this.n8.count - 1) { c = this.n8.count - 1; } var d = this.n8._inner[c]; var e = this.n9._inner[c]; if (isNaN_(e)) { b = c; } else { b = c + (b - d) / e; } return b; }; ProportionalCategoryAngleAxis.prototype.isOthersValue = function (a) { if (a < 0 || a > this.n7.count - 1) { return false; } return this.n7._inner[a]; }; ProportionalCategoryAngleAxis.prototype.gf = function (a) { var b = a; if (this.categoryMode == 0) { b = truncate(Math.round(a)); } else { b = truncate(Math.floor(a)); } if (this.hasOthersCategory && b >= this.lk - 1) { b = this.lk - 1; return this.op(); } return _super.prototype.gf.call(this, a); }; ProportionalCategoryAngleAxis.prototype.op = function () { if (this.ol != null) { return this.ol; } return "Others"; }; ProportionalCategoryAngleAxis.prototype.getNormalizingValueAtIndex = function (a, b) { if (a < 0 || this.n3 == null || a > this.n3.count - 1) { return b; } return this.n3.item(a); }; ProportionalCategoryAngleAxis.prototype.od = function (a) { this.ot(); var b = this.n9._inner[a] * 100; return b; }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "isVertical", { get: function () { return this.cp; }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.j$d = function (a, b) { return this.eo.apply(this, arguments); }; ProportionalCategoryAngleAxis.prototype.j$c = function (a, b) { return this.el.apply(this, arguments); }; ProportionalCategoryAngleAxis.prototype.j$e = function (a, b, c, d, e) { this.hp.apply(this, arguments); }; ProportionalCategoryAngleAxis.prototype.j$f = function (a, b, c, d) { this.hq.apply(this, arguments); }; ProportionalCategoryAngleAxis.prototype.j$g = function (a, b, c, d) { this.hr.apply(this, arguments); }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "j$b", { get: function () { return this.ch; }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.j$a = function () { return this.ag.apply(this, arguments); }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "itemsCount", { get: function () { return this.lk; }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]); ProportionalCategoryAngleAxis.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'h5', ['OthersCategoryText:ol:ou', [2, null], 'OthersCategoryThreshold:oe:ov', [1, 3], 'OthersCategoryType:n0:ow', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]); return ProportionalCategoryAngleAxis; }(CategoryAngleAxis)); export { ProportionalCategoryAngleAxis };