UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

500 lines (499 loc) 17.7 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 { DependencyProperty } from "igniteui-angular-core"; import { OthersCategoryType_$type } from "igniteui-angular-core"; import { typeCast, Number_$type, enumGetBox, fromEnum, Boolean_$type, markType, markDep } from "igniteui-angular-core"; import { OthersCategoryContext } from "./OthersCategoryContext"; import { IFastItemsSource_$type } from "igniteui-angular-core"; import { SeriesViewer } from "./SeriesViewer"; import { List$1 } from "igniteui-angular-core"; import { CoreGeometryUtil } from "igniteui-angular-core"; import { ArrayExtension } from "igniteui-angular-core"; import { PropertyMetadata } from "igniteui-angular-core"; import { truncate, isNaN_, isInfinity } from "igniteui-angular-core"; /** * @hidden */ var ProportionalCategoryAngleAxis = /** @class */ /*@__PURE__*/ (function (_super) { __extends(ProportionalCategoryAngleAxis, _super); function ProportionalCategoryAngleAxis() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.od = null; _this.nz = null; _this.n3 = true; _this.n8 = NaN; _this.n6 = new List$1(Number_$type, 0); _this.n5 = new List$1(Number_$type, 0); _this.n4 = new List$1(Boolean_$type, 0); _this.n2 = false; _this.n7 = NaN; _this.oc = -1; return _this; } Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "ok", { get: function () { return this.od; }, set: function (a) { var b = this.ok; if (a != b) { this.od = a; this.h5("ValueMemberPath", b, this.ok); } }, 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.oi(); } } return _super.prototype.fz.call(this, a, b); }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "normalizationMayContainUnknowns", { get: function () { return this.n1 == null || this.n1.mayContainUnknowns; }, enumerable: false, configurable: true }); Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "n1", { get: function () { return this.nz; }, set: function (a) { if (this.nz != a) { var b = this.nz; this.nz = a; this.h5("ValueColumn", b, this.nz); } }, enumerable: false, configurable: true }); ProportionalCategoryAngleAxis.prototype.n0 = function (a) { if (a == null) { return this.kv.registerColumn(null, null, false); } var b = null; var c = SeriesViewer.cu(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.n1); this.n1 = this.n0(this.ok); } break; case "ValueColumn": this.n3 = true; this.n2 = false; this.ia(); break; case ProportionalCategoryAngleAxis.$$p[0]: case ProportionalCategoryAngleAxis.$$p[1]: case ProportionalCategoryAngleAxis.$$p[2]: this.n3 = true; this.n2 = false; this.ia(); try { for (var _b = __values(fromEnum(this.db())), _c = _b.next(); !_c.done; _c = _b.next()) { var e = _c.value; e.rq(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.n3 = true; this.n2 = false; var f = typeCast(IFastItemsSource_$type, c); if (f != null) { f.deregisterColumn(this.n1); this.n1 = null; } var g = typeCast(IFastItemsSource_$type, d); if (g != null) { this.n1 = this.n0(this.ok); } this.ia(); break; } }; ProportionalCategoryAngleAxis.prototype.l7 = function (a) { _super.prototype.l7.call(this, a); this.n3 = true; this.n2 = false; }; ProportionalCategoryAngleAxis.prototype.getScaledAngle = function (a) { this.om(); 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.n5._inner[d]; var f = c - d; var g = 0; if (isNaN_(this.n6._inner[d])) { g = 0 * f; } else { g = this.n6._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.n9(a, c, d, e) * f; }; ProportionalCategoryAngleAxis.prototype.n9 = function (a, b, c, d) { if (a < 0 || a > this.lk - 1) { return this.getCategorySize(b, c, d); } this.om(); var e = this.n6._inner[a]; if (isNaN_(e)) { return NaN; } var f = Math.PI * 2 * this.n6._inner[a]; return f; }; ProportionalCategoryAngleAxis.prototype.m7 = function (a, b, c, d) { this.om(); 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.n6._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.om(); if (this.n2) { 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.oi(); }; ProportionalCategoryAngleAxis.prototype.my = function (a) { if (a >= 0 && a < this.lk) { if (isNaN_(this.n6._inner[a])) { return true; } } return _super.prototype.my.call(this, a); }; ProportionalCategoryAngleAxis.prototype.ic = function (a) { this.om(); _super.prototype.ic.call(this, a); }; ProportionalCategoryAngleAxis.prototype.ensureSum = function () { this.om(); }; ProportionalCategoryAngleAxis.prototype.om = function () { if (this.n3) { this.n3 = false; this.n2 = false; this.lk = this.lm(); this.n7 = NaN; this.oc = -1; if (this.n1 != null && this.n1.count > 0) { this.n8 = NaN; var a = true; for (var b = 0; b < this.n1.count; b++) { var c = this.n1.item(b); if (isNaN_(c) || isInfinity(c) || c < 0) { continue; } if (a) { a = false; this.n8 = 0; } this.n8 += c; } var d = 0; this.n6.clear(); this.n5.clear(); this.n4.clear(); var e = 0; for (var f = 0; f < this.n1.count; f++) { var g = 0; if (isNaN_(this.n8)) { g = 1 / this.lk; } else { var h = this.n1.item(f); if (isNaN_(h) || isInfinity(h) || h < 0) { g = 0; } else { g = h; } } var i = false; if (this.ny == 0) { if (g < this.ob) { i = true; } } else { if ((g / this.n8) * 100 < this.ob) { i = true; } } if (i) { this.n5.add(d); this.n6.add(NaN); this.n4.add(true); e += g; } else { this.n5.add(d); this.n6.add(g / this.n8); this.n4.add(false); d += (g / this.n8); } } if (e > 0) { this.n2 = true; this.n5.add(d); this.n6.add(e / this.n8); this.n4.add(false); this.n7 = e; this.oc = this.n5.count - 1; } } else { if (this.lk > 0) { this.n6.clear(); this.n5.clear(); var j = 0; for (var k = 0; k < this.lk; k++) { this.n5.add(j); this.n6.add(1 / this.lk); j += (1 / this.lk); } } } this.lk = this.lm(); } }; Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersValue", { get: function () { return this.n7; }, enumerable: false, configurable: true }); Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersIndex", { get: function () { return this.oc; }, enumerable: false, configurable: true }); Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "hasOthersCategory", { get: function () { return this.n2; }, 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.om(); 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.n5, function (d) { return b < d ? -1 : (b > d ? 1 : 0); }); if (c < 0) { c = ~c; c--; } if (c < 0) { c = 0; } if (c > this.n5.count - 1) { c = this.n5.count - 1; } var d = this.n5._inner[c]; var e = this.n6._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.n4.count - 1) { return false; } return this.n4._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.oi(); } return _super.prototype.gf.call(this, a); }; ProportionalCategoryAngleAxis.prototype.oi = function () { if (this.oe != null) { return this.oe; } return "Others"; }; ProportionalCategoryAngleAxis.prototype.getNormalizingValueAtIndex = function (a, b) { if (a < 0 || this.n1 == null || a > this.n1.count - 1) { return b; } return this.n1.item(a); }; ProportionalCategoryAngleAxis.prototype.oa = function (a) { this.om(); var b = this.n6._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:oe:on', [2, null], 'OthersCategoryThreshold:ob:oo', [1, 3], 'OthersCategoryType:ny:op', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]); return ProportionalCategoryAngleAxis; }(CategoryAngleAxis)); export { ProportionalCategoryAngleAxis };