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.s6 = new OthersCategoryContext(); this.tp = null; this.ts = null; this.s9 = null; this.td = true; this.tj = NaN; this.th = new List$1(Number_$type, 0); this.tg = new List$1(Number_$type, 0); this.tf = new List$1(Boolean_$type, 0); this.tc = false; this.ti = NaN; this.tn = -1; } get_s7() { return this.s6; } get s7() { return this.get_s7(); } to() { if (this.tp == null) { this.tp = OthersCategoryContext.b(this.s6, this.b7); } return this.tp; } tr(a) { if (a) { return this.to(); } else { return this.s7; } } te(a) { return a == this.s7 || a == this.tp; } get tz() { return this.ts; } set tz(a) { let b = this.tz; if (a != b) { this.ts = a; this.lu("ValueMemberPath", b, this.tz); } } hw(a, b) { let c = this.jp(b); if (this.hasOthersCategory && c == "Label") { if (typeCast(OthersCategoryContext.$, a) !== null) { return this.tx(); } else { let int_ = this.tq(a); if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) { return this.tx(); } } } return super.hw(a, b); } tq(a) { if (a == null) { return null; } return a.i ? a.i : a; return null; } get normalizationMayContainUnknowns() { return this.tb == null || this.tb.mayContainUnknowns; } get tb() { return this.s9; } set tb(a) { if (this.s9 != a) { let b = this.s9; this.s9 = a; this.lu("ValueColumn", b, this.s9); } } ta(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.tb); this.tb = this.ta(this.tz); } break; case "ValueColumn": this.td = true; this.tc = false; this.lz(); break; case ProportionalCategoryAngleAxis.$$p[0]: case ProportionalCategoryAngleAxis.$$p[1]: case ProportionalCategoryAngleAxis.$$p[2]: this.td = true; this.tc = false; this.lz(); for (let e of fromEnum(this.ep())) { e.sa(true); } break; case "FastItemsSource": this.td = true; this.tc = false; let f = typeCast(IFastItemsSource_$type, c); if (f != null) { f.deregisterColumn(this.tb); this.tb = null; } let g = typeCast(IFastItemsSource_$type, d); if (g != null) { this.tb = this.ta(this.tz); } this.lz(); break; } } q2(a) { super.q2(a); this.td = true; this.tc = false; } getScaledAngle(a) { this.t1(); if (isNaN_(a) || isInfinity(a)) { return NaN; } let b = this.qd; let c = a % b; if (c < 0) { c = b + c; } let d = truncate(Math.floor(c)); let e = this.tg._inner[d]; let f = c - d; let g = 0; if (isNaN_(this.th._inner[d])) { g = 0 * f; } else { g = this.th._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.rz; } get_ds() { return true; } r6(a, b, c, d, e) { let f = 0.5; if (this.qf > 1) { let g = this.p9(c, d, e); let h = 0; if (!isNaN_(this.p8)) { h = Math.min(this.p8, 1); } let i = 1 - 0.5 * g; let j = i / (this.qf - (this.qf - 1) * h); let k = (i - j) / (this.qf - 1); f = 0.25 * g + 0.5 * j + a * k; } return this.tk(a, c, d, e) * f; } tk(a, b, c, d) { if (a < 0 || a > this.qe - 1) { return this.getCategorySize(b, c, d); } this.t1(); let e = this.th._inner[a]; if (isNaN_(e)) { return NaN; } let f = Math.PI * 2 * this.th._inner[a]; return f; } r7(a, b, c, d) { this.t1(); let e = this.p9(b, c, d); let f = 0; if (!isNaN_(this.p8)) { f = Math.min(this.p8, 1); } let g = 1 - 0.5 * e; if (a < 0 || a > this.qe - 1) { return this.p2(b, c, d); } let h = this.th._inner[a]; if (isNaN_(h)) { return NaN; } let i = Math.PI * 2 * h; return i * g / (this.qf - (this.qf - 1) * f); } qg() { if (this.po == null) { return 0; } this.t1(); if (this.tc) { return super.qg() + 1; } return super.qg(); } ru(a) { return this.hasOthersCategory && a == this.qe - 1; } so() { return this.tx(); } rv(a) { if (a >= 0 && a < this.qe) { if (isNaN_(this.th._inner[a])) { return true; } } return super.rv(a); } l1(a) { this.t1(); super.l1(a); } ensureSum() { this.t1(); } t1() { if (this.td) { this.td = false; this.tc = false; this.qe = this.qg(); this.ti = NaN; this.tn = -1; if (this.tb != null && this.tb.count > 0) { this.tj = NaN; let a = true; for (let b = 0; b < this.tb.count; b++) { let c = this.tb.item(b); if (isNaN_(c) || isInfinity(c) || c < 0) { continue; } if (a) { a = false; this.tj = 0; } this.tj += c; } let d = 0; this.th.clear(); this.tg.clear(); this.tf.clear(); let e = new List$1(Base.$, 0); this.s7.items = null; let f = 0; for (let g = 0; g < this.tb.count; g++) { let h = 0; if (isNaN_(this.tj)) { h = 1 / this.qe; } else { let i = this.tb.item(g); if (isNaN_(i) || isInfinity(i) || i < 0) { h = 0; } else { h = i; } } let j = false; if (this.s8 == 0) { if (h < this.tm) { j = true; } } else { if ((h / this.tj) * 100 < this.tm) { j = true; } } if (j) { e.add1(this.po.item(g)); this.tg.add(d); this.th.add(NaN); this.tf.add(true); f += h; } else { this.tg.add(d); this.th.add(h / this.tj); this.tf.add(false); d += (h / this.tj); } } if (f > 0) { this.tc = true; this.tg.add(d); this.th.add(f / this.tj); this.tf.add(false); this.ti = f; this.tn = this.tg.count - 1; this.s7.items = e.toArray(); } } else { if (this.qe > 0) { this.th.clear(); this.tg.clear(); let k = 0; for (let l = 0; l < this.qe; l++) { this.tg.add(k); this.th.add(1 / this.qe); k += (1 / this.qe); } } } this.qe = this.qg(); } } get othersValue() { return this.ti; } get othersIndex() { return this.tn; } get hasOthersCategory() { return this.tc; } k3(a, b, c, d) { for (let e = b; e < c; e++) { a.item(e, this.f7(a.item(e), d)); } } getUnscaledAngle(a) { this.t1(); if (isNaN_(a) || isInfinity(a)) { return NaN; } if (this.tg == null || this.tg.count == 0 || this.th == null || this.th.count == 0) { return NaN; } a = CoreGeometryUtil.s(a); while (a < this.rz) { a += 2 * Math.PI; } while (a > (this.rz + (2 * Math.PI))) { a -= 2 * Math.PI; } let b = (a - this.rz) / (2 * Math.PI); if (this.dn) { b = 1 - b; } let c = -1; c = ArrayExtension.binarySearch$11(Number_$type, this.tg, (d) => b < d ? -1 : (b > d ? 1 : 0)); if (c < 0) { c = ~c; c--; } if (c < 0) { c = 0; } if (c > this.tg.count - 1) { c = this.tg.count - 1; } let d = this.tg._inner[c]; let e = this.th._inner[c]; if (isNaN_(e)) { b = c; } else { b = c + (b - d) / e; } return b; } isOthersValue(a) { if (a < 0 || a > this.tf.count - 1) { return false; } return this.tf._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.qe - 1) { b = this.qe - 1; return this.tx(); } return super.ja(a); } tx() { if (this.tt != null) { return this.tt; } return "Others"; } getNormalizingValueAtIndex(a, b) { if (a < 0 || this.tb == null || a > this.tb.count - 1) { return b; } return this.tb.item(a); } tl(a) { this.t1(); let b = this.th._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.qe; } } ProportionalCategoryAngleAxis.$t = /*@__PURE__*/ markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]); ProportionalCategoryAngleAxis.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'lu', ['OthersCategoryText:tt:t2', [2, null], 'OthersCategoryThreshold:tm:t3', [1, 3], 'OthersCategoryType:s8:t4', [OthersCategoryType_$type, /*@__PURE__*/ enumGetBox(OthersCategoryType_$type, 1)]]); return ProportionalCategoryAngleAxis; })();