igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
549 lines (548 loc) • 18.7 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, __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 !== null && _super.apply(this, arguments) || this;
_this.rk = new OthersCategoryContext();
_this.r3 = null;
_this.r6 = null;
_this.rn = null;
_this.rr = true;
_this.rx = NaN;
_this.rv = new List$1(Number_$type, 0);
_this.ru = new List$1(Number_$type, 0);
_this.rt = new List$1(Boolean_$type, 0);
_this.rq = false;
_this.rw = NaN;
_this.r1 = -1;
return _this;
}
ProportionalCategoryAngleAxis.prototype.get_rl = function () {
return this.rk;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "rl", {
get: function () {
return this.get_rl();
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.r2 = function () {
if (this.r3 == null) {
this.r3 = OthersCategoryContext.b(this.rk, this.b0);
}
return this.r3;
};
ProportionalCategoryAngleAxis.prototype.r5 = function (a) {
if (a) {
return this.r2();
}
else {
return this.rl;
}
};
ProportionalCategoryAngleAxis.prototype.rs = function (a) {
return a == this.rl || a == this.r3;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "sd", {
get: function () {
return this.r6;
},
set: function (a) {
var b = this.sd;
if (a != b) {
this.r6 = a;
this.kx("ValueMemberPath", b, this.sd);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.hd = function (a, b) {
var c = this.ix(b);
if (this.hasOthersCategory && c == "Label") {
if (typeCast(OthersCategoryContext.$, a) !== null) {
return this.sb();
}
else {
var int_ = this.r4(a);
if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) {
return this.sb();
}
}
}
return _super.prototype.hd.call(this, a, b);
};
ProportionalCategoryAngleAxis.prototype.r4 = function (a) {
if (a == null) {
return null;
}
return a.i ? a.i : a;
return null;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "normalizationMayContainUnknowns", {
get: function () {
return this.rp == null || this.rp.mayContainUnknowns;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "rp", {
get: function () {
return this.rn;
},
set: function (a) {
if (this.rn != a) {
var b = this.rn;
this.rn = a;
this.kx("ValueColumn", b, this.rn);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.ro = function (a) {
if (a == null) {
return this.oh.registerColumn(null, null, false);
}
var b = null;
var c = SeriesViewer.c7(a, this.coercionMethods);
b = c.a;
return this.oh.registerColumn(a, b, this.expectFunctions);
};
ProportionalCategoryAngleAxis.prototype.kf = function (a, b, c, d) {
var e_1, _a;
_super.prototype.kf.call(this, a, b, c, d);
switch (b) {
case "ValueMemberPath":
if (this.oh != null) {
this.oh.deregisterColumn(this.rp);
this.rp = this.ro(this.sd);
}
break;
case "ValueColumn":
this.rr = true;
this.rq = false;
this.k2();
break;
case ProportionalCategoryAngleAxis.$$p[0]:
case ProportionalCategoryAngleAxis.$$p[1]:
case ProportionalCategoryAngleAxis.$$p[2]:
this.rr = true;
this.rq = false;
this.k2();
try {
for (var _b = __values(fromEnum(this.ed())), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
e.rz(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.rr = true;
this.rq = false;
var f = typeCast(IFastItemsSource_$type, c);
if (f != null) {
f.deregisterColumn(this.rp);
this.rp = null;
}
var g = typeCast(IFastItemsSource_$type, d);
if (g != null) {
this.rp = this.ro(this.sd);
}
this.k2();
break;
}
};
ProportionalCategoryAngleAxis.prototype.pt = function (a) {
_super.prototype.pt.call(this, a);
this.rr = true;
this.rq = false;
};
ProportionalCategoryAngleAxis.prototype.getScaledAngle = function (a) {
this.sf();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
var b = this.o5;
var c = a % b;
if (c < 0) {
c = b + c;
}
var d = truncate(Math.floor(c));
var e = this.ru._inner[d];
var f = c - d;
var g = 0;
if (isNaN_(this.rv._inner[d])) {
g = 0 * f;
}
else {
g = this.rv._inner[d] * f;
}
var h = e + g;
if (this.dg) {
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.qo;
};
ProportionalCategoryAngleAxis.prototype.get_dj = function () {
return true;
};
ProportionalCategoryAngleAxis.prototype.qs = function (a, b, c, d, e) {
var f = 0.5;
if (this.o7 > 1) {
var g = this.o1(c, d, e);
var h = 0;
if (!isNaN_(this.o0)) {
h = Math.min(this.o0, 1);
}
var i = 1 - 0.5 * g;
var j = i / (this.o7 - (this.o7 - 1) * h);
var k = (i - j) / (this.o7 - 1);
f = 0.25 * g + 0.5 * j + a * k;
}
return this.ry(a, c, d, e) * f;
};
ProportionalCategoryAngleAxis.prototype.ry = function (a, b, c, d) {
if (a < 0 || a > this.o6 - 1) {
return this.getCategorySize(b, c, d);
}
this.sf();
var e = this.rv._inner[a];
if (isNaN_(e)) {
return NaN;
}
var f = Math.PI * 2 * this.rv._inner[a];
return f;
};
ProportionalCategoryAngleAxis.prototype.qt = function (a, b, c, d) {
this.sf();
var e = this.o1(b, c, d);
var f = 0;
if (!isNaN_(this.o0)) {
f = Math.min(this.o0, 1);
}
var g = 1 - 0.5 * e;
if (a < 0 || a > this.o6 - 1) {
return this.ou(b, c, d);
}
var h = this.rv._inner[a];
if (isNaN_(h)) {
return NaN;
}
var i = Math.PI * 2 * h;
return i * g / (this.o7 - (this.o7 - 1) * f);
};
ProportionalCategoryAngleAxis.prototype.o8 = function () {
if (this.oh == null) {
return 0;
}
this.sf();
if (this.rq) {
return _super.prototype.o8.call(this) + 1;
}
return _super.prototype.o8.call(this);
};
ProportionalCategoryAngleAxis.prototype.qj = function (a) {
return this.hasOthersCategory && a == this.o6 - 1;
};
ProportionalCategoryAngleAxis.prototype.q6 = function () {
return this.sb();
};
ProportionalCategoryAngleAxis.prototype.qk = function (a) {
if (a >= 0 && a < this.o6) {
if (isNaN_(this.rv._inner[a])) {
return true;
}
}
return _super.prototype.qk.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.k4 = function (a) {
this.sf();
_super.prototype.k4.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.ensureSum = function () {
this.sf();
};
ProportionalCategoryAngleAxis.prototype.sf = function () {
if (this.rr) {
this.rr = false;
this.rq = false;
this.o6 = this.o8();
this.rw = NaN;
this.r1 = -1;
if (this.rp != null && this.rp.count > 0) {
this.rx = NaN;
var a = true;
for (var b = 0; b < this.rp.count; b++) {
var c = this.rp.item(b);
if (isNaN_(c) || isInfinity(c) || c < 0) {
continue;
}
if (a) {
a = false;
this.rx = 0;
}
this.rx += c;
}
var d = 0;
this.rv.clear();
this.ru.clear();
this.rt.clear();
var e = new List$1(Base.$, 0);
this.rl.items = null;
var f = 0;
for (var g = 0; g < this.rp.count; g++) {
var h = 0;
if (isNaN_(this.rx)) {
h = 1 / this.o6;
}
else {
var i = this.rp.item(g);
if (isNaN_(i) || isInfinity(i) || i < 0) {
h = 0;
}
else {
h = i;
}
}
var j = false;
if (this.rm == 0) {
if (h < this.r0) {
j = true;
}
}
else {
if ((h / this.rx) * 100 < this.r0) {
j = true;
}
}
if (j) {
e.add1(this.oh.item(g));
this.ru.add(d);
this.rv.add(NaN);
this.rt.add(true);
f += h;
}
else {
this.ru.add(d);
this.rv.add(h / this.rx);
this.rt.add(false);
d += (h / this.rx);
}
}
if (f > 0) {
this.rq = true;
this.ru.add(d);
this.rv.add(f / this.rx);
this.rt.add(false);
this.rw = f;
this.r1 = this.ru.count - 1;
this.rl.items = e.toArray();
}
}
else {
if (this.o6 > 0) {
this.rv.clear();
this.ru.clear();
var k = 0;
for (var l = 0; l < this.o6; l++) {
this.ru.add(k);
this.rv.add(1 / this.o6);
k += (1 / this.o6);
}
}
}
this.o6 = this.o8();
}
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersValue", {
get: function () {
return this.rw;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersIndex", {
get: function () {
return this.r1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "hasOthersCategory", {
get: function () {
return this.rq;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.j6 = function (a, b, c, d) {
for (var e = b; e < c; e++) {
a.item(e, this.ft(a.item(e), d));
}
};
ProportionalCategoryAngleAxis.prototype.getUnscaledAngle = function (a) {
this.sf();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
if (this.ru == null || this.ru.count == 0 || this.rv == null || this.rv.count == 0) {
return NaN;
}
a = CoreGeometryUtil.b(a);
while (a < this.qo) {
a += 2 * Math.PI;
}
while (a > (this.qo + (2 * Math.PI))) {
a -= 2 * Math.PI;
}
var b = (a - this.qo) / (2 * Math.PI);
if (this.df) {
b = 1 - b;
}
var c = -1;
c = ArrayExtension.binarySearch$11(Number_$type, this.ru, function (d) { return b < d ? -1 : (b > d ? 1 : 0); });
if (c < 0) {
c = ~c;
c--;
}
if (c < 0) {
c = 0;
}
if (c > this.ru.count - 1) {
c = this.ru.count - 1;
}
var d = this.ru._inner[c];
var e = this.rv._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.rt.count - 1) {
return false;
}
return this.rt._inner[a];
};
ProportionalCategoryAngleAxis.prototype.ih = 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.o6 - 1) {
b = this.o6 - 1;
return this.sb();
}
return _super.prototype.ih.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.sb = function () {
if (this.r7 != null) {
return this.r7;
}
return "Others";
};
ProportionalCategoryAngleAxis.prototype.getNormalizingValueAtIndex = function (a, b) {
if (a < 0 || this.rp == null || a > this.rp.count - 1) {
return b;
}
return this.rp.item(a);
};
ProportionalCategoryAngleAxis.prototype.rz = function (a) {
this.sf();
var b = this.rv._inner[a] * 100;
return b;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "isVertical", {
get: function () {
return this.dq;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.j$d = function (a, b) {
return this.fw.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$c = function (a, b) {
return this.ft.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$e = function (a, b, c, d, e) {
this.j5.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$f = function (a, b, c, d) {
this.j6.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$g = function (a, b, c, d) {
this.j7.apply(this, arguments);
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "j$b", {
get: function () {
return this.df;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.j$a = function () {
return this.ag.apply(this, arguments);
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "itemsCount", {
get: function () {
return this.o6;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]);
ProportionalCategoryAngleAxis.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'kx', ['OthersCategoryText:r7:sg', [2, null], 'OthersCategoryThreshold:r0:sh', [1, 3], 'OthersCategoryType:rm:si', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]);
return ProportionalCategoryAngleAxis;
}(CategoryAngleAxis));
export { ProportionalCategoryAngleAxis };