igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
490 lines (489 loc) • 16.6 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-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 let ProportionalCategoryAngleAxis = /*@__PURE__*/ (() => {
class ProportionalCategoryAngleAxis extends CategoryAngleAxis {
constructor() {
super(...arguments);
this.sy = new OthersCategoryContext();
this.th = null;
this.tk = null;
this.s1 = null;
this.s5 = true;
this.tb = NaN;
this.s9 = new List$1(Number_$type, 0);
this.s8 = new List$1(Number_$type, 0);
this.s7 = new List$1(Boolean_$type, 0);
this.s4 = false;
this.ta = NaN;
this.tf = -1;
}
get_sz() {
return this.sy;
}
get sz() {
return this.get_sz();
}
tg() {
if (this.th == null) {
this.th = OthersCategoryContext.b(this.sy, this.b2);
}
return this.th;
}
tj(a) {
if (a) {
return this.tg();
}
else {
return this.sz;
}
}
s6(a) {
return a == this.sz || a == this.th;
}
get tr() {
return this.tk;
}
set tr(a) {
let b = this.tr;
if (a != b) {
this.tk = a;
this.lp("ValueMemberPath", b, this.tr);
}
}
ht(a, b) {
let c = this.jl(b);
if (this.hasOthersCategory && c == "Label") {
if (typeCast(OthersCategoryContext.$, a) !== null) {
return this.tp();
}
else {
let int_ = this.ti(a);
if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) {
return this.tp();
}
}
}
return super.ht(a, b);
}
ti(a) {
if (a == null) {
return null;
}
return a.i ? a.i : a;
return null;
}
get normalizationMayContainUnknowns() {
return this.s3 == null || this.s3.mayContainUnknowns;
}
get s3() {
return this.s1;
}
set s3(a) {
if (this.s1 != a) {
let b = this.s1;
this.s1 = a;
this.lp("ValueColumn", b, this.s1);
}
}
s2(a) {
if (a == null) {
return this.pj.registerColumn(null, null, false);
}
let b = null;
let c = SeriesViewer.de(a, this.coercionMethods);
b = c.a;
return this.pj.registerColumn(a, b, this.expectFunctions);
}
k7(a, b, c, d) {
super.k7(a, b, c, d);
switch (b) {
case "ValueMemberPath":
if (this.pj != null) {
this.pj.deregisterColumn(this.s3);
this.s3 = this.s2(this.tr);
}
break;
case "ValueColumn":
this.s5 = true;
this.s4 = false;
this.lu();
break;
case ProportionalCategoryAngleAxis.$$p[0]:
case ProportionalCategoryAngleAxis.$$p[1]:
case ProportionalCategoryAngleAxis.$$p[2]:
this.s5 = true;
this.s4 = false;
this.lu();
for (let e of fromEnum(this.en())) {
e.r7(true);
}
break;
case "FastItemsSource":
this.s5 = true;
this.s4 = false;
let f = typeCast(IFastItemsSource_$type, c);
if (f != null) {
f.deregisterColumn(this.s3);
this.s3 = null;
}
let g = typeCast(IFastItemsSource_$type, d);
if (g != null) {
this.s3 = this.s2(this.tr);
}
this.lu();
break;
}
}
qv(a) {
super.qv(a);
this.s5 = true;
this.s4 = false;
}
getScaledAngle(a) {
this.tt();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
let b = this.p7;
let c = a % b;
if (c < 0) {
c = b + c;
}
let d = truncate(Math.floor(c));
let e = this.s8._inner[d];
let f = c - d;
let g = 0;
if (isNaN_(this.s9._inner[d])) {
g = 0 * f;
}
else {
g = this.s9._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.rr;
}
get_ds() {
return true;
}
ry(a, b, c, d, e) {
let f = 0.5;
if (this.p9 > 1) {
let g = this.p3(c, d, e);
let h = 0;
if (!isNaN_(this.p2)) {
h = Math.min(this.p2, 1);
}
let i = 1 - 0.5 * g;
let j = i / (this.p9 - (this.p9 - 1) * h);
let k = (i - j) / (this.p9 - 1);
f = 0.25 * g + 0.5 * j + a * k;
}
return this.tc(a, c, d, e) * f;
}
tc(a, b, c, d) {
if (a < 0 || a > this.p8 - 1) {
return this.getCategorySize(b, c, d);
}
this.tt();
let e = this.s9._inner[a];
if (isNaN_(e)) {
return NaN;
}
let f = Math.PI * 2 * this.s9._inner[a];
return f;
}
rz(a, b, c, d) {
this.tt();
let e = this.p3(b, c, d);
let f = 0;
if (!isNaN_(this.p2)) {
f = Math.min(this.p2, 1);
}
let g = 1 - 0.5 * e;
if (a < 0 || a > this.p8 - 1) {
return this.pw(b, c, d);
}
let h = this.s9._inner[a];
if (isNaN_(h)) {
return NaN;
}
let i = Math.PI * 2 * h;
return i * g / (this.p9 - (this.p9 - 1) * f);
}
qa() {
if (this.pj == null) {
return 0;
}
this.tt();
if (this.s4) {
return super.qa() + 1;
}
return super.qa();
}
rm(a) {
return this.hasOthersCategory && a == this.p8 - 1;
}
sg() {
return this.tp();
}
rn(a) {
if (a >= 0 && a < this.p8) {
if (isNaN_(this.s9._inner[a])) {
return true;
}
}
return super.rn(a);
}
lw(a) {
this.tt();
super.lw(a);
}
ensureSum() {
this.tt();
}
tt() {
if (this.s5) {
this.s5 = false;
this.s4 = false;
this.p8 = this.qa();
this.ta = NaN;
this.tf = -1;
if (this.s3 != null && this.s3.count > 0) {
this.tb = NaN;
let a = true;
for (let b = 0; b < this.s3.count; b++) {
let c = this.s3.item(b);
if (isNaN_(c) || isInfinity(c) || c < 0) {
continue;
}
if (a) {
a = false;
this.tb = 0;
}
this.tb += c;
}
let d = 0;
this.s9.clear();
this.s8.clear();
this.s7.clear();
let e = new List$1(Base.$, 0);
this.sz.items = null;
let f = 0;
for (let g = 0; g < this.s3.count; g++) {
let h = 0;
if (isNaN_(this.tb)) {
h = 1 / this.p8;
}
else {
let i = this.s3.item(g);
if (isNaN_(i) || isInfinity(i) || i < 0) {
h = 0;
}
else {
h = i;
}
}
let j = false;
if (this.s0 == 0) {
if (h < this.te) {
j = true;
}
}
else {
if ((h / this.tb) * 100 < this.te) {
j = true;
}
}
if (j) {
e.add1(this.pj.item(g));
this.s8.add(d);
this.s9.add(NaN);
this.s7.add(true);
f += h;
}
else {
this.s8.add(d);
this.s9.add(h / this.tb);
this.s7.add(false);
d += (h / this.tb);
}
}
if (f > 0) {
this.s4 = true;
this.s8.add(d);
this.s9.add(f / this.tb);
this.s7.add(false);
this.ta = f;
this.tf = this.s8.count - 1;
this.sz.items = e.toArray();
}
}
else {
if (this.p8 > 0) {
this.s9.clear();
this.s8.clear();
let k = 0;
for (let l = 0; l < this.p8; l++) {
this.s8.add(k);
this.s9.add(1 / this.p8);
k += (1 / this.p8);
}
}
}
this.p8 = this.qa();
}
}
get othersValue() {
return this.ta;
}
get othersIndex() {
return this.tf;
}
get hasOthersCategory() {
return this.s4;
}
ky(a, b, c, d) {
for (let e = b; e < c; e++) {
a.item(e, this.f5(a.item(e), d));
}
}
getUnscaledAngle(a) {
this.tt();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
if (this.s8 == null || this.s8.count == 0 || this.s9 == null || this.s9.count == 0) {
return NaN;
}
a = CoreGeometryUtil.s(a);
while (a < this.rr) {
a += 2 * Math.PI;
}
while (a > (this.rr + (2 * Math.PI))) {
a -= 2 * Math.PI;
}
let b = (a - this.rr) / (2 * Math.PI);
if (this.dn) {
b = 1 - b;
}
let c = -1;
c = ArrayExtension.binarySearch$11(Number_$type, this.s8, (d) => b < d ? -1 : (b > d ? 1 : 0));
if (c < 0) {
c = ~c;
c--;
}
if (c < 0) {
c = 0;
}
if (c > this.s8.count - 1) {
c = this.s8.count - 1;
}
let d = this.s8._inner[c];
let e = this.s9._inner[c];
if (isNaN_(e)) {
b = c;
}
else {
b = c + (b - d) / e;
}
return b;
}
isOthersValue(a) {
if (a < 0 || a > this.s7.count - 1) {
return false;
}
return this.s7._inner[a];
}
i6(a) {
let b = a;
if (this.categoryMode == 0) {
b = truncate(Math.round(a));
}
else {
b = truncate(Math.floor(a));
}
if (this.hasOthersCategory && b >= this.p8 - 1) {
b = this.p8 - 1;
return this.tp();
}
return super.i6(a);
}
tp() {
if (this.tl != null) {
return this.tl;
}
return "Others";
}
getNormalizingValueAtIndex(a, b) {
if (a < 0 || this.s3 == null || a > this.s3.count - 1) {
return b;
}
return this.s3.item(a);
}
td(a) {
this.tt();
let b = this.s9._inner[a] * 100;
return b;
}
get isVertical() {
return this.dy;
}
j$d(a, b) {
return this.f8.apply(this, arguments);
}
j$c(a, b) {
return this.f5.apply(this, arguments);
}
j$e(a, b, c, d, e) {
this.kx.apply(this, arguments);
}
j$f(a, b, c, d) {
this.ky.apply(this, arguments);
}
j$g(a, b, c, d) {
this.kz.apply(this, arguments);
}
get j$b() {
return this.dn;
}
j$a() {
return this.ag.apply(this, arguments);
}
get itemsCount() {
return this.p8;
}
}
ProportionalCategoryAngleAxis.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]);
ProportionalCategoryAngleAxis.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'lp', ['OthersCategoryText:tl:tu', [2, null], 'OthersCategoryThreshold:te:tv', [1, 3], 'OthersCategoryType:s0:tw', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]);
return ProportionalCategoryAngleAxis;
})();