UNPKG

igniteui-react-charts

Version:

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

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