UNPKG

igniteui-react-charts

Version:

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

490 lines (489 loc) 16.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-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 */ export let ProportionalCategoryAngleAxis = /*@__PURE__*/ (() => { class ProportionalCategoryAngleAxis extends CategoryAngleAxis { constructor() { super(...arguments); this.s3 = new OthersCategoryContext(); this.tm = null; this.tp = null; this.s6 = null; this.ta = true; this.tg = NaN; this.te = new List$1(Number_$type, 0); this.td = new List$1(Number_$type, 0); this.tc = new List$1(Boolean_$type, 0); this.s9 = false; this.tf = NaN; this.tk = -1; } get_s4() { return this.s3; } get s4() { return this.get_s4(); } tl() { if (this.tm == null) { this.tm = OthersCategoryContext.b(this.s3, this.b7); } return this.tm; } to(a) { if (a) { return this.tl(); } else { return this.s4; } } tb(a) { return a == this.s4 || a == this.tm; } get tw() { return this.tp; } set tw(a) { let b = this.tw; if (a != b) { this.tp = a; this.lu("ValueMemberPath", b, this.tw); } } hw(a, b) { let c = this.jp(b); if (this.hasOthersCategory && c == "Label") { if (typeCast(OthersCategoryContext.$, a) !== null) { return this.tu(); } else { let int_ = this.tn(a); if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) { return this.tu(); } } } return super.hw(a, b); } tn(a) { if (a == null) { return null; } return a.i ? a.i : a; return null; } get normalizationMayContainUnknowns() { return this.s8 == null || this.s8.mayContainUnknowns; } get s8() { return this.s6; } set s8(a) { if (this.s6 != a) { let b = this.s6; this.s6 = a; this.lu("ValueColumn", b, this.s6); } } s7(a) { if (a == null) { return this.po.registerColumn(null, null, false); } let b = null; let c = SeriesViewer.de(a, this.coercionMethods); b = c.a; return this.po.registerColumn(a, b, this.expectFunctions); } lc(a, b, c, d) { super.lc(a, b, c, d); switch (b) { case "ValueMemberPath": if (this.po != null) { this.po.deregisterColumn(this.s8); this.s8 = this.s7(this.tw); } break; case "ValueColumn": this.ta = true; this.s9 = false; this.lz(); break; case ProportionalCategoryAngleAxis.$$p[0]: case ProportionalCategoryAngleAxis.$$p[1]: case ProportionalCategoryAngleAxis.$$p[2]: this.ta = true; this.s9 = false; this.lz(); for (let e of fromEnum(this.ep())) { e.r9(true); } break; case "FastItemsSource": this.ta = true; this.s9 = false; let f = typeCast(IFastItemsSource_$type, c); if (f != null) { f.deregisterColumn(this.s8); this.s8 = null; } let g = typeCast(IFastItemsSource_$type, d); if (g != null) { this.s8 = this.s7(this.tw); } this.lz(); break; } } q0(a) { super.q0(a); this.ta = true; this.s9 = false; } getScaledAngle(a) { this.ty(); if (isNaN_(a) || isInfinity(a)) { return NaN; } let b = this.qc; let c = a % b; if (c < 0) { c = b + c; } let d = truncate(Math.floor(c)); let e = this.td._inner[d]; let f = c - d; let g = 0; if (isNaN_(this.te._inner[d])) { g = 0 * f; } else { g = this.te._inner[d] * f; } let h = e + g; if (this.dp) { 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.rw; } get_ds() { return true; } r3(a, b, c, d, e) { let f = 0.5; if (this.qe > 1) { let g = this.p8(c, d, e); let h = 0; if (!isNaN_(this.p7)) { h = Math.min(this.p7, 1); } let i = 1 - 0.5 * g; let j = i / (this.qe - (this.qe - 1) * h); let k = (i - j) / (this.qe - 1); f = 0.25 * g + 0.5 * j + a * k; } return this.th(a, c, d, e) * f; } th(a, b, c, d) { if (a < 0 || a > this.qd - 1) { return this.getCategorySize(b, c, d); } this.ty(); let e = this.te._inner[a]; if (isNaN_(e)) { return NaN; } let f = Math.PI * 2 * this.te._inner[a]; return f; } r4(a, b, c, d) { this.ty(); let e = this.p8(b, c, d); let f = 0; if (!isNaN_(this.p7)) { f = Math.min(this.p7, 1); } let g = 1 - 0.5 * e; if (a < 0 || a > this.qd - 1) { return this.p1(b, c, d); } let h = this.te._inner[a]; if (isNaN_(h)) { return NaN; } let i = Math.PI * 2 * h; return i * g / (this.qe - (this.qe - 1) * f); } qf() { if (this.po == null) { return 0; } this.ty(); if (this.s9) { return super.qf() + 1; } return super.qf(); } rr(a) { return this.hasOthersCategory && a == this.qd - 1; } sl() { return this.tu(); } rs(a) { if (a >= 0 && a < this.qd) { if (isNaN_(this.te._inner[a])) { return true; } } return super.rs(a); } l1(a) { this.ty(); super.l1(a); } ensureSum() { this.ty(); } ty() { if (this.ta) { this.ta = false; this.s9 = false; this.qd = this.qf(); this.tf = NaN; this.tk = -1; if (this.s8 != null && this.s8.count > 0) { this.tg = NaN; let a = true; for (let b = 0; b < this.s8.count; b++) { let c = this.s8.item(b); if (isNaN_(c) || isInfinity(c) || c < 0) { continue; } if (a) { a = false; this.tg = 0; } this.tg += c; } let d = 0; this.te.clear(); this.td.clear(); this.tc.clear(); let e = new List$1(Base.$, 0); this.s4.items = null; let f = 0; for (let g = 0; g < this.s8.count; g++) { let h = 0; if (isNaN_(this.tg)) { h = 1 / this.qd; } else { let i = this.s8.item(g); if (isNaN_(i) || isInfinity(i) || i < 0) { h = 0; } else { h = i; } } let j = false; if (this.s5 == 0) { if (h < this.tj) { j = true; } } else { if ((h / this.tg) * 100 < this.tj) { j = true; } } if (j) { e.add1(this.po.item(g)); this.td.add(d); this.te.add(NaN); this.tc.add(true); f += h; } else { this.td.add(d); this.te.add(h / this.tg); this.tc.add(false); d += (h / this.tg); } } if (f > 0) { this.s9 = true; this.td.add(d); this.te.add(f / this.tg); this.tc.add(false); this.tf = f; this.tk = this.td.count - 1; this.s4.items = e.toArray(); } } else { if (this.qd > 0) { this.te.clear(); this.td.clear(); let k = 0; for (let l = 0; l < this.qd; l++) { this.td.add(k); this.te.add(1 / this.qd); k += (1 / this.qd); } } } this.qd = this.qf(); } } get othersValue() { return this.tf; } get othersIndex() { return this.tk; } get hasOthersCategory() { return this.s9; } k3(a, b, c, d) { for (let e = b; e < c; e++) { a.item(e, this.f7(a.item(e), d)); } } getUnscaledAngle(a) { this.ty(); if (isNaN_(a) || isInfinity(a)) { return NaN; } if (this.td == null || this.td.count == 0 || this.te == null || this.te.count == 0) { return NaN; } a = CoreGeometryUtil.s(a); while (a < this.rw) { a += 2 * Math.PI; } while (a > (this.rw + (2 * Math.PI))) { a -= 2 * Math.PI; } let b = (a - this.rw) / (2 * Math.PI); if (this.dn) { b = 1 - b; } let c = -1; c = ArrayExtension.binarySearch$11(Number_$type, this.td, (d) => b < d ? -1 : (b > d ? 1 : 0)); if (c < 0) { c = ~c; c--; } if (c < 0) { c = 0; } if (c > this.td.count - 1) { c = this.td.count - 1; } let d = this.td._inner[c]; let e = this.te._inner[c]; if (isNaN_(e)) { b = c; } else { b = c + (b - d) / e; } return b; } isOthersValue(a) { if (a < 0 || a > this.tc.count - 1) { return false; } return this.tc._inner[a]; } ja(a) { let b = a; if (this.categoryMode == 0) { b = truncate(Math.round(a)); } else { b = truncate(Math.floor(a)); } if (this.hasOthersCategory && b >= this.qd - 1) { b = this.qd - 1; return this.tu(); } return super.ja(a); } tu() { if (this.tq != null) { return this.tq; } return "Others"; } getNormalizingValueAtIndex(a, b) { if (a < 0 || this.s8 == null || a > this.s8.count - 1) { return b; } return this.s8.item(a); } ti(a) { this.ty(); let b = this.te._inner[a] * 100; return b; } get isVertical() { return this.dz; } j$d(a, b) { return this.ga.apply(this, arguments); } j$c(a, b) { return this.f7.apply(this, arguments); } j$e(a, b, c, d, e) { this.k2.apply(this, arguments); } j$f(a, b, c, d) { this.k3.apply(this, arguments); } j$g(a, b, c, d) { this.k4.apply(this, arguments); } get j$b() { return this.dn; } j$a() { return this.ag.apply(this, arguments); } get itemsCount() { return this.qd; } } ProportionalCategoryAngleAxis.$t = /*@__PURE__*/ markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]); ProportionalCategoryAngleAxis.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'lu', ['OthersCategoryText:tq:tz', [2, null], 'OthersCategoryThreshold:tj:t0', [1, 3], 'OthersCategoryType:s5:t1', [OthersCategoryType_$type, /*@__PURE__*/ enumGetBox(OthersCategoryType_$type, 1)]]); return ProportionalCategoryAngleAxis; })();