UNPKG

igniteui-angular-charts

Version:

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

487 lines (486 loc) 14.2 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 { 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-angular-core"; import { DependencyProperty } from "igniteui-angular-core"; import { OthersCategoryType_$type } from "igniteui-angular-core"; 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 */ export class ProportionalCategoryAngleAxis extends CategoryAngleAxis { constructor() { super(...arguments); this.ti = new OthersCategoryContext(); this.t1 = null; this.t4 = null; this.tl = null; this.tp = true; this.tv = NaN; this.tt = new List$1(Number_$type, 0); this.ts = new List$1(Number_$type, 0); this.tr = new List$1(Boolean_$type, 0); this.to = false; this.tu = NaN; this.tz = -1; } static { this.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]); } get_tj() { return this.ti; } get tj() { return this.get_tj(); } t0() { if (this.t1 == null) { this.t1 = OthersCategoryContext.b(this.ti, this.b7); } return this.t1; } t3(a) { if (a) { return this.t0(); } else { return this.tj; } } tq(a) { return a == this.tj || a == this.t1; } get ub() { return this.t4; } set ub(a) { let b = this.ub; if (a != b) { this.t4 = a; this.l2("ValueMemberPath", b, this.ub); } } h0(a, b) { let c = this.jx(b); if (this.hasOthersCategory && c == "Label") { if (typeCast(OthersCategoryContext.$, a) !== null) { return this.t9(); } else { let int_ = this.t2(a); if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) { return this.t9(); } } } return super.h0(a, b); } t2(a) { if (a == null) { return null; } return a.i ? a.i : a; return null; } get normalizationMayContainUnknowns() { return this.tn == null || this.tn.mayContainUnknowns; } get tn() { return this.tl; } set tn(a) { if (this.tl != a) { let b = this.tl; this.tl = a; this.l2("ValueColumn", b, this.tl); } } tm(a) { if (a == null) { return this.p0.registerColumn(null, null, false); } let b = null; let c = SeriesViewer.de(a, this.coercionMethods); b = c.a; return this.p0.registerColumn(a, b, this.expectFunctions); } lk(a, b, c, d) { super.lk(a, b, c, d); switch (b) { case "ValueMemberPath": if (this.p0 != null) { this.p0.deregisterColumn(this.tn); this.tn = this.tm(this.ub); } break; case "ValueColumn": this.tp = true; this.to = false; this.l7(); break; case ProportionalCategoryAngleAxis.$$p[0]: case ProportionalCategoryAngleAxis.$$p[1]: case ProportionalCategoryAngleAxis.$$p[2]: this.tp = true; this.to = false; this.l7(); for (let e of fromEnum(this.et())) { e.sa(true); } break; case "FastItemsSource": this.tp = true; this.to = false; let f = typeCast(IFastItemsSource_$type, c); if (f != null) { f.deregisterColumn(this.tn); this.tn = null; } let g = typeCast(IFastItemsSource_$type, d); if (g != null) { this.tn = this.tm(this.ub); } this.l7(); break; } } re(a) { super.re(a); this.tp = true; this.to = false; } getScaledAngle(a) { this.ud(); if (isNaN_(a) || isInfinity(a)) { return NaN; } let b = this.qp; let c = a % b; if (c < 0) { c = b + c; } let d = truncate(Math.floor(c)); let e = this.ts._inner[d]; let f = c - d; let g = 0; if (isNaN_(this.tt._inner[d])) { g = 0 * f; } else { g = this.tt._inner[d] * f; } let h = e + g; if (this.ds) { h = 1 - h; } let 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.sb; } get_dw() { return true; } si(a, b, c, d, e) { let f = 0.5; if (this.qr > 1) { let g = this.ql(c, d, e); let h = 0; if (!isNaN_(this.qk)) { h = Math.min(this.qk, 1); } let i = 1 - 0.5 * g; let j = i / (this.qr - (this.qr - 1) * h); let k = (i - j) / (this.qr - 1); f = 0.25 * g + 0.5 * j + a * k; } return this.tw(a, c, d, e) * f; } tw(a, b, c, d) { if (a < 0 || a > this.qq - 1) { return this.getCategorySize(b, c, d); } this.ud(); let e = this.tt._inner[a]; if (isNaN_(e)) { return NaN; } let f = Math.PI * 2 * this.tt._inner[a]; return f; } sj(a, b, c, d) { this.ud(); let e = this.ql(b, c, d); let f = 0; if (!isNaN_(this.qk)) { f = Math.min(this.qk, 1); } let g = 1 - 0.5 * e; if (a < 0 || a > this.qq - 1) { return this.qe(b, c, d); } let h = this.tt._inner[a]; if (isNaN_(h)) { return NaN; } let i = Math.PI * 2 * h; return i * g / (this.qr - (this.qr - 1) * f); } qs() { if (this.p0 == null) { return 0; } this.ud(); if (this.to) { return super.qs() + 1; } return super.qs(); } r6(a) { return this.hasOthersCategory && a == this.qq - 1; } s0() { return this.t9(); } r7(a) { if (a >= 0 && a < this.qq) { if (isNaN_(this.tt._inner[a])) { return true; } } return super.r7(a); } l9(a) { this.ud(); super.l9(a); } ensureSum() { this.ud(); } ud() { if (this.tp) { this.tp = false; this.to = false; this.qq = this.qs(); this.tu = NaN; this.tz = -1; if (this.tn != null && this.tn.count > 0) { this.tv = NaN; let a = true; for (let b = 0; b < this.tn.count; b++) { let c = this.tn.item(b); if (isNaN_(c) || isInfinity(c) || c < 0) { continue; } if (a) { a = false; this.tv = 0; } this.tv += c; } let d = 0; this.tt.clear(); this.ts.clear(); this.tr.clear(); let e = new List$1(Base.$, 0); this.tj.items = null; let f = 0; for (let g = 0; g < this.tn.count; g++) { let h = 0; if (isNaN_(this.tv)) { h = 1 / this.qq; } else { let i = this.tn.item(g); if (isNaN_(i) || isInfinity(i) || i < 0) { h = 0; } else { h = i; } } let j = false; if (this.tk == 0) { if (h < this.ty) { j = true; } } else { if ((h / this.tv) * 100 < this.ty) { j = true; } } if (j) { e.add1(this.p0.item(g)); this.ts.add(d); this.tt.add(NaN); this.tr.add(true); f += h; } else { this.ts.add(d); this.tt.add(h / this.tv); this.tr.add(false); d += (h / this.tv); } } if (f > 0) { this.to = true; this.ts.add(d); this.tt.add(f / this.tv); this.tr.add(false); this.tu = f; this.tz = this.ts.count - 1; this.tj.items = e.toArray(); } } else { if (this.qq > 0) { this.tt.clear(); this.ts.clear(); let k = 0; for (let l = 0; l < this.qq; l++) { this.ts.add(k); this.tt.add(1 / this.qq); k += (1 / this.qq); } } } this.qq = this.qs(); } } get othersValue() { return this.tu; } get othersIndex() { return this.tz; } get hasOthersCategory() { return this.to; } lb(a, b, c, d) { for (let e = b; e < c; e++) { a.item(e, this.gc(a.item(e), d)); } } getUnscaledAngle(a) { this.ud(); if (isNaN_(a) || isInfinity(a)) { return NaN; } if (this.ts == null || this.ts.count == 0 || this.tt == null || this.tt.count == 0) { return NaN; } a = CoreGeometryUtil.s(a); while (a < this.sb) { a += 2 * Math.PI; } while (a > (this.sb + (2 * Math.PI))) { a -= 2 * Math.PI; } let b = (a - this.sb) / (2 * Math.PI); if (this.dr) { b = 1 - b; } let c = -1; c = ArrayExtension.binarySearch$11(Number_$type, this.ts, (d) => b < d ? -1 : (b > d ? 1 : 0)); if (c < 0) { c = ~c; c--; } if (c < 0) { c = 0; } if (c > this.ts.count - 1) { c = this.ts.count - 1; } let d = this.ts._inner[c]; let e = this.tt._inner[c]; if (isNaN_(e)) { b = c; } else { b = c + (b - d) / e; } return b; } isOthersValue(a) { if (a < 0 || a > this.tr.count - 1) { return false; } return this.tr._inner[a]; } jh(a) { let b = a; if (this.categoryMode == 0) { b = truncate(Math.round(a)); } else { b = truncate(Math.floor(a)); } if (this.hasOthersCategory && b >= this.qq - 1) { b = this.qq - 1; return this.t9(); } return super.jh(a); } t9() { if (this.t5 != null) { return this.t5; } return "Others"; } getNormalizingValueAtIndex(a, b) { if (a < 0 || this.tn == null || a > this.tn.count - 1) { return b; } return this.tn.item(a); } tx(a) { this.ud(); let b = this.tt._inner[a] * 100; return b; } get isVertical() { return this.d3; } j$d(a, b) { return this.gf.apply(this, arguments); } j$c(a, b) { return this.gc.apply(this, arguments); } j$e(a, b, c, d, e) { this.la.apply(this, arguments); } j$f(a, b, c, d) { this.lb.apply(this, arguments); } j$g(a, b, c, d) { this.lc.apply(this, arguments); } get j$b() { return this.dr; } j$a() { return this.ag.apply(this, arguments); } get itemsCount() { return this.qq; } static { this.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'l2', ['OthersCategoryText:t5:ue', [2, null], 'OthersCategoryThreshold:ty:uf', [1, 3], 'OthersCategoryType:tk:ug', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]); } }