igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
549 lines (548 loc) • 18.8 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 { __extends, __read, __spreadArray, __values } from "tslib";
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
*/
var ProportionalCategoryAngleAxis = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ProportionalCategoryAngleAxis, _super);
function ProportionalCategoryAngleAxis() {
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_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;
return _this;
}
ProportionalCategoryAngleAxis.prototype.get_s4 = function () {
return this.s3;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "s4", {
get: function () {
return this.get_s4();
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.tl = function () {
if (this.tm == null) {
this.tm = OthersCategoryContext.b(this.s3, this.b7);
}
return this.tm;
};
ProportionalCategoryAngleAxis.prototype.to = function (a) {
if (a) {
return this.tl();
}
else {
return this.s4;
}
};
ProportionalCategoryAngleAxis.prototype.tb = function (a) {
return a == this.s4 || a == this.tm;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "tw", {
get: function () {
return this.tp;
},
set: function (a) {
var b = this.tw;
if (a != b) {
this.tp = a;
this.lu("ValueMemberPath", b, this.tw);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.hw = function (a, b) {
var c = this.jp(b);
if (this.hasOthersCategory && c == "Label") {
if (typeCast(OthersCategoryContext.$, a) !== null) {
return this.tu();
}
else {
var int_ = this.tn(a);
if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) {
return this.tu();
}
}
}
return _super.prototype.hw.call(this, a, b);
};
ProportionalCategoryAngleAxis.prototype.tn = function (a) {
if (a == null) {
return null;
}
return a.i ? a.i : a;
return null;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "normalizationMayContainUnknowns", {
get: function () {
return this.s8 == null || this.s8.mayContainUnknowns;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "s8", {
get: function () {
return this.s6;
},
set: function (a) {
if (this.s6 != a) {
var b = this.s6;
this.s6 = a;
this.lu("ValueColumn", b, this.s6);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.s7 = function (a) {
if (a == null) {
return this.po.registerColumn(null, null, false);
}
var b = null;
var c = SeriesViewer.de(a, this.coercionMethods);
b = c.a;
return this.po.registerColumn(a, b, this.expectFunctions);
};
ProportionalCategoryAngleAxis.prototype.lc = function (a, b, c, d) {
var e_1, _a;
_super.prototype.lc.call(this, 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();
try {
for (var _b = __values(fromEnum(this.ep())), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
e.r9(true);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
break;
case "FastItemsSource":
this.ta = true;
this.s9 = false;
var f = typeCast(IFastItemsSource_$type, c);
if (f != null) {
f.deregisterColumn(this.s8);
this.s8 = null;
}
var g = typeCast(IFastItemsSource_$type, d);
if (g != null) {
this.s8 = this.s7(this.tw);
}
this.lz();
break;
}
};
ProportionalCategoryAngleAxis.prototype.q0 = function (a) {
_super.prototype.q0.call(this, a);
this.ta = true;
this.s9 = false;
};
ProportionalCategoryAngleAxis.prototype.getScaledAngle = function (a) {
this.ty();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
var b = this.qc;
var c = a % b;
if (c < 0) {
c = b + c;
}
var d = truncate(Math.floor(c));
var e = this.td._inner[d];
var f = c - d;
var g = 0;
if (isNaN_(this.te._inner[d])) {
g = 0 * f;
}
else {
g = this.te._inner[d] * f;
}
var h = e + g;
if (this.dp) {
h = 1 - h;
}
var 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;
};
ProportionalCategoryAngleAxis.prototype.get_ds = function () {
return true;
};
ProportionalCategoryAngleAxis.prototype.r3 = function (a, b, c, d, e) {
var f = 0.5;
if (this.qe > 1) {
var g = this.p8(c, d, e);
var h = 0;
if (!isNaN_(this.p7)) {
h = Math.min(this.p7, 1);
}
var i = 1 - 0.5 * g;
var j = i / (this.qe - (this.qe - 1) * h);
var k = (i - j) / (this.qe - 1);
f = 0.25 * g + 0.5 * j + a * k;
}
return this.th(a, c, d, e) * f;
};
ProportionalCategoryAngleAxis.prototype.th = function (a, b, c, d) {
if (a < 0 || a > this.qd - 1) {
return this.getCategorySize(b, c, d);
}
this.ty();
var e = this.te._inner[a];
if (isNaN_(e)) {
return NaN;
}
var f = Math.PI * 2 * this.te._inner[a];
return f;
};
ProportionalCategoryAngleAxis.prototype.r4 = function (a, b, c, d) {
this.ty();
var e = this.p8(b, c, d);
var f = 0;
if (!isNaN_(this.p7)) {
f = Math.min(this.p7, 1);
}
var g = 1 - 0.5 * e;
if (a < 0 || a > this.qd - 1) {
return this.p1(b, c, d);
}
var h = this.te._inner[a];
if (isNaN_(h)) {
return NaN;
}
var i = Math.PI * 2 * h;
return i * g / (this.qe - (this.qe - 1) * f);
};
ProportionalCategoryAngleAxis.prototype.qf = function () {
if (this.po == null) {
return 0;
}
this.ty();
if (this.s9) {
return _super.prototype.qf.call(this) + 1;
}
return _super.prototype.qf.call(this);
};
ProportionalCategoryAngleAxis.prototype.rr = function (a) {
return this.hasOthersCategory && a == this.qd - 1;
};
ProportionalCategoryAngleAxis.prototype.sl = function () {
return this.tu();
};
ProportionalCategoryAngleAxis.prototype.rs = function (a) {
if (a >= 0 && a < this.qd) {
if (isNaN_(this.te._inner[a])) {
return true;
}
}
return _super.prototype.rs.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.l1 = function (a) {
this.ty();
_super.prototype.l1.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.ensureSum = function () {
this.ty();
};
ProportionalCategoryAngleAxis.prototype.ty = function () {
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;
var a = true;
for (var b = 0; b < this.s8.count; b++) {
var c = this.s8.item(b);
if (isNaN_(c) || isInfinity(c) || c < 0) {
continue;
}
if (a) {
a = false;
this.tg = 0;
}
this.tg += c;
}
var d = 0;
this.te.clear();
this.td.clear();
this.tc.clear();
var e = new List$1(Base.$, 0);
this.s4.items = null;
var f = 0;
for (var g = 0; g < this.s8.count; g++) {
var h = 0;
if (isNaN_(this.tg)) {
h = 1 / this.qd;
}
else {
var i = this.s8.item(g);
if (isNaN_(i) || isInfinity(i) || i < 0) {
h = 0;
}
else {
h = i;
}
}
var 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();
var k = 0;
for (var l = 0; l < this.qd; l++) {
this.td.add(k);
this.te.add(1 / this.qd);
k += (1 / this.qd);
}
}
}
this.qd = this.qf();
}
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersValue", {
get: function () {
return this.tf;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersIndex", {
get: function () {
return this.tk;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "hasOthersCategory", {
get: function () {
return this.s9;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.k3 = function (a, b, c, d) {
for (var e = b; e < c; e++) {
a.item(e, this.f7(a.item(e), d));
}
};
ProportionalCategoryAngleAxis.prototype.getUnscaledAngle = function (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;
}
var b = (a - this.rw) / (2 * Math.PI);
if (this.dn) {
b = 1 - b;
}
var c = -1;
c = ArrayExtension.binarySearch$11(Number_$type, this.td, function (d) { return 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;
}
var d = this.td._inner[c];
var e = this.te._inner[c];
if (isNaN_(e)) {
b = c;
}
else {
b = c + (b - d) / e;
}
return b;
};
ProportionalCategoryAngleAxis.prototype.isOthersValue = function (a) {
if (a < 0 || a > this.tc.count - 1) {
return false;
}
return this.tc._inner[a];
};
ProportionalCategoryAngleAxis.prototype.ja = function (a) {
var 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.prototype.ja.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.tu = function () {
if (this.tq != null) {
return this.tq;
}
return "Others";
};
ProportionalCategoryAngleAxis.prototype.getNormalizingValueAtIndex = function (a, b) {
if (a < 0 || this.s8 == null || a > this.s8.count - 1) {
return b;
}
return this.s8.item(a);
};
ProportionalCategoryAngleAxis.prototype.ti = function (a) {
this.ty();
var b = this.te._inner[a] * 100;
return b;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "isVertical", {
get: function () {
return this.dz;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.j$d = function (a, b) {
return this.ga.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$c = function (a, b) {
return this.f7.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$e = function (a, b, c, d, e) {
this.k2.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$f = function (a, b, c, d) {
this.k3.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$g = function (a, b, c, d) {
this.k4.apply(this, arguments);
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "j$b", {
get: function () {
return this.dn;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.j$a = function () {
return this.ag.apply(this, arguments);
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "itemsCount", {
get: function () {
return this.qd;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]);
ProportionalCategoryAngleAxis.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'lu', ['OthersCategoryText:tq:tz', [2, null], 'OthersCategoryThreshold:tj:t0', [1, 3], 'OthersCategoryType:s5:t1', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]);
return ProportionalCategoryAngleAxis;
}(CategoryAngleAxis));
export { ProportionalCategoryAngleAxis };