igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
490 lines (489 loc) • 16.2 kB
JavaScript
/*
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.s1 = new OthersCategoryContext();
this.tk = null;
this.tn = null;
this.s4 = null;
this.s8 = true;
this.te = NaN;
this.tc = new List$1(Number_$type, 0);
this.tb = new List$1(Number_$type, 0);
this.ta = new List$1(Boolean_$type, 0);
this.s7 = false;
this.td = NaN;
this.ti = -1;
}
get_s2() {
return this.s1;
}
get s2() {
return this.get_s2();
}
tj() {
if (this.tk == null) {
this.tk = OthersCategoryContext.b(this.s1, this.b7);
}
return this.tk;
}
tm(a) {
if (a) {
return this.tj();
}
else {
return this.s2;
}
}
s9(a) {
return a == this.s2 || a == this.tk;
}
get tu() {
return this.tn;
}
set tu(a) {
let b = this.tu;
if (a != b) {
this.tn = a;
this.ls("ValueMemberPath", b, this.tu);
}
}
hu(a, b) {
let c = this.jn(b);
if (this.hasOthersCategory && c == "Label") {
if (typeCast(OthersCategoryContext.$, a) !== null) {
return this.ts();
}
else {
let int_ = this.tl(a);
if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) {
return this.ts();
}
}
}
return super.hu(a, b);
}
tl(a) {
if (a == null) {
return null;
}
return a.i ? a.i : a;
return null;
}
get normalizationMayContainUnknowns() {
return this.s6 == null || this.s6.mayContainUnknowns;
}
get s6() {
return this.s4;
}
set s6(a) {
if (this.s4 != a) {
let b = this.s4;
this.s4 = a;
this.ls("ValueColumn", b, this.s4);
}
}
s5(a) {
if (a == null) {
return this.pm.registerColumn(null, null, false);
}
let b = null;
let c = SeriesViewer.de(a, this.coercionMethods);
b = c.a;
return this.pm.registerColumn(a, b, this.expectFunctions);
}
la(a, b, c, d) {
super.la(a, b, c, d);
switch (b) {
case "ValueMemberPath":
if (this.pm != null) {
this.pm.deregisterColumn(this.s6);
this.s6 = this.s5(this.tu);
}
break;
case "ValueColumn":
this.s8 = true;
this.s7 = false;
this.lx();
break;
case ProportionalCategoryAngleAxis.$$p[0]:
case ProportionalCategoryAngleAxis.$$p[1]:
case ProportionalCategoryAngleAxis.$$p[2]:
this.s8 = true;
this.s7 = false;
this.lx();
for (let e of fromEnum(this.eo())) {
e.r8(true);
}
break;
case "FastItemsSource":
this.s8 = true;
this.s7 = false;
let f = typeCast(IFastItemsSource_$type, c);
if (f != null) {
f.deregisterColumn(this.s6);
this.s6 = null;
}
let g = typeCast(IFastItemsSource_$type, d);
if (g != null) {
this.s6 = this.s5(this.tu);
}
this.lx();
break;
}
}
qy(a) {
super.qy(a);
this.s8 = true;
this.s7 = false;
}
getScaledAngle(a) {
this.tw();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
let b = this.qa;
let c = a % b;
if (c < 0) {
c = b + c;
}
let d = truncate(Math.floor(c));
let e = this.tb._inner[d];
let f = c - d;
let g = 0;
if (isNaN_(this.tc._inner[d])) {
g = 0 * f;
}
else {
g = this.tc._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.ru;
}
get_ds() {
return true;
}
r1(a, b, c, d, e) {
let f = 0.5;
if (this.qc > 1) {
let g = this.p6(c, d, e);
let h = 0;
if (!isNaN_(this.p5)) {
h = Math.min(this.p5, 1);
}
let i = 1 - 0.5 * g;
let j = i / (this.qc - (this.qc - 1) * h);
let k = (i - j) / (this.qc - 1);
f = 0.25 * g + 0.5 * j + a * k;
}
return this.tf(a, c, d, e) * f;
}
tf(a, b, c, d) {
if (a < 0 || a > this.qb - 1) {
return this.getCategorySize(b, c, d);
}
this.tw();
let e = this.tc._inner[a];
if (isNaN_(e)) {
return NaN;
}
let f = Math.PI * 2 * this.tc._inner[a];
return f;
}
r2(a, b, c, d) {
this.tw();
let e = this.p6(b, c, d);
let f = 0;
if (!isNaN_(this.p5)) {
f = Math.min(this.p5, 1);
}
let g = 1 - 0.5 * e;
if (a < 0 || a > this.qb - 1) {
return this.pz(b, c, d);
}
let h = this.tc._inner[a];
if (isNaN_(h)) {
return NaN;
}
let i = Math.PI * 2 * h;
return i * g / (this.qc - (this.qc - 1) * f);
}
qd() {
if (this.pm == null) {
return 0;
}
this.tw();
if (this.s7) {
return super.qd() + 1;
}
return super.qd();
}
rp(a) {
return this.hasOthersCategory && a == this.qb - 1;
}
sj() {
return this.ts();
}
rq(a) {
if (a >= 0 && a < this.qb) {
if (isNaN_(this.tc._inner[a])) {
return true;
}
}
return super.rq(a);
}
lz(a) {
this.tw();
super.lz(a);
}
ensureSum() {
this.tw();
}
tw() {
if (this.s8) {
this.s8 = false;
this.s7 = false;
this.qb = this.qd();
this.td = NaN;
this.ti = -1;
if (this.s6 != null && this.s6.count > 0) {
this.te = NaN;
let a = true;
for (let b = 0; b < this.s6.count; b++) {
let c = this.s6.item(b);
if (isNaN_(c) || isInfinity(c) || c < 0) {
continue;
}
if (a) {
a = false;
this.te = 0;
}
this.te += c;
}
let d = 0;
this.tc.clear();
this.tb.clear();
this.ta.clear();
let e = new List$1(Base.$, 0);
this.s2.items = null;
let f = 0;
for (let g = 0; g < this.s6.count; g++) {
let h = 0;
if (isNaN_(this.te)) {
h = 1 / this.qb;
}
else {
let i = this.s6.item(g);
if (isNaN_(i) || isInfinity(i) || i < 0) {
h = 0;
}
else {
h = i;
}
}
let j = false;
if (this.s3 == 0) {
if (h < this.th) {
j = true;
}
}
else {
if ((h / this.te) * 100 < this.th) {
j = true;
}
}
if (j) {
e.add1(this.pm.item(g));
this.tb.add(d);
this.tc.add(NaN);
this.ta.add(true);
f += h;
}
else {
this.tb.add(d);
this.tc.add(h / this.te);
this.ta.add(false);
d += (h / this.te);
}
}
if (f > 0) {
this.s7 = true;
this.tb.add(d);
this.tc.add(f / this.te);
this.ta.add(false);
this.td = f;
this.ti = this.tb.count - 1;
this.s2.items = e.toArray();
}
}
else {
if (this.qb > 0) {
this.tc.clear();
this.tb.clear();
let k = 0;
for (let l = 0; l < this.qb; l++) {
this.tb.add(k);
this.tc.add(1 / this.qb);
k += (1 / this.qb);
}
}
}
this.qb = this.qd();
}
}
get othersValue() {
return this.td;
}
get othersIndex() {
return this.ti;
}
get hasOthersCategory() {
return this.s7;
}
k1(a, b, c, d) {
for (let e = b; e < c; e++) {
a.item(e, this.f6(a.item(e), d));
}
}
getUnscaledAngle(a) {
this.tw();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
if (this.tb == null || this.tb.count == 0 || this.tc == null || this.tc.count == 0) {
return NaN;
}
a = CoreGeometryUtil.s(a);
while (a < this.ru) {
a += 2 * Math.PI;
}
while (a > (this.ru + (2 * Math.PI))) {
a -= 2 * Math.PI;
}
let b = (a - this.ru) / (2 * Math.PI);
if (this.dn) {
b = 1 - b;
}
let c = -1;
c = ArrayExtension.binarySearch$11(Number_$type, this.tb, (d) => b < d ? -1 : (b > d ? 1 : 0));
if (c < 0) {
c = ~c;
c--;
}
if (c < 0) {
c = 0;
}
if (c > this.tb.count - 1) {
c = this.tb.count - 1;
}
let d = this.tb._inner[c];
let e = this.tc._inner[c];
if (isNaN_(e)) {
b = c;
}
else {
b = c + (b - d) / e;
}
return b;
}
isOthersValue(a) {
if (a < 0 || a > this.ta.count - 1) {
return false;
}
return this.ta._inner[a];
}
i8(a) {
let b = a;
if (this.categoryMode == 0) {
b = truncate(Math.round(a));
}
else {
b = truncate(Math.floor(a));
}
if (this.hasOthersCategory && b >= this.qb - 1) {
b = this.qb - 1;
return this.ts();
}
return super.i8(a);
}
ts() {
if (this.to != null) {
return this.to;
}
return "Others";
}
getNormalizingValueAtIndex(a, b) {
if (a < 0 || this.s6 == null || a > this.s6.count - 1) {
return b;
}
return this.s6.item(a);
}
tg(a) {
this.tw();
let b = this.tc._inner[a] * 100;
return b;
}
get isVertical() {
return this.dy;
}
j$d(a, b) {
return this.f9.apply(this, arguments);
}
j$c(a, b) {
return this.f6.apply(this, arguments);
}
j$e(a, b, c, d, e) {
this.k0.apply(this, arguments);
}
j$f(a, b, c, d) {
this.k1.apply(this, arguments);
}
j$g(a, b, c, d) {
this.k2.apply(this, arguments);
}
get j$b() {
return this.dn;
}
j$a() {
return this.ag.apply(this, arguments);
}
get itemsCount() {
return this.qb;
}
}
ProportionalCategoryAngleAxis.$t = /*@__PURE__*/ markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]);
ProportionalCategoryAngleAxis.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'ls', ['OthersCategoryText:to:tx', [2, null], 'OthersCategoryThreshold:th:ty', [1, 3], 'OthersCategoryType:s3:tz', [OthersCategoryType_$type, /*@__PURE__*/ enumGetBox(OthersCategoryType_$type, 1)]]);
return ProportionalCategoryAngleAxis;
})();