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.s6 = new OthersCategoryContext();
_this.tp = null;
_this.ts = null;
_this.s9 = null;
_this.td = true;
_this.tj = NaN;
_this.th = new List$1(Number_$type, 0);
_this.tg = new List$1(Number_$type, 0);
_this.tf = new List$1(Boolean_$type, 0);
_this.tc = false;
_this.ti = NaN;
_this.tn = -1;
return _this;
}
ProportionalCategoryAngleAxis.prototype.get_s7 = function () {
return this.s6;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "s7", {
get: function () {
return this.get_s7();
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.to = function () {
if (this.tp == null) {
this.tp = OthersCategoryContext.b(this.s6, this.b7);
}
return this.tp;
};
ProportionalCategoryAngleAxis.prototype.tr = function (a) {
if (a) {
return this.to();
}
else {
return this.s7;
}
};
ProportionalCategoryAngleAxis.prototype.te = function (a) {
return a == this.s7 || a == this.tp;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "tz", {
get: function () {
return this.ts;
},
set: function (a) {
var b = this.tz;
if (a != b) {
this.ts = a;
this.lu("ValueMemberPath", b, this.tz);
}
},
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.tx();
}
else {
var int_ = this.tq(a);
if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) {
return this.tx();
}
}
}
return _super.prototype.hw.call(this, a, b);
};
ProportionalCategoryAngleAxis.prototype.tq = function (a) {
if (a == null) {
return null;
}
return a.i ? a.i : a;
return null;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "normalizationMayContainUnknowns", {
get: function () {
return this.tb == null || this.tb.mayContainUnknowns;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "tb", {
get: function () {
return this.s9;
},
set: function (a) {
if (this.s9 != a) {
var b = this.s9;
this.s9 = a;
this.lu("ValueColumn", b, this.s9);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.ta = 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.tb);
this.tb = this.ta(this.tz);
}
break;
case "ValueColumn":
this.td = true;
this.tc = false;
this.lz();
break;
case ProportionalCategoryAngleAxis.$$p[0]:
case ProportionalCategoryAngleAxis.$$p[1]:
case ProportionalCategoryAngleAxis.$$p[2]:
this.td = true;
this.tc = false;
this.lz();
try {
for (var _b = __values(fromEnum(this.ep())), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
e.sa(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.td = true;
this.tc = false;
var f = typeCast(IFastItemsSource_$type, c);
if (f != null) {
f.deregisterColumn(this.tb);
this.tb = null;
}
var g = typeCast(IFastItemsSource_$type, d);
if (g != null) {
this.tb = this.ta(this.tz);
}
this.lz();
break;
}
};
ProportionalCategoryAngleAxis.prototype.q2 = function (a) {
_super.prototype.q2.call(this, a);
this.td = true;
this.tc = false;
};
ProportionalCategoryAngleAxis.prototype.getScaledAngle = function (a) {
this.t1();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
var b = this.qd;
var c = a % b;
if (c < 0) {
c = b + c;
}
var d = truncate(Math.floor(c));
var e = this.tg._inner[d];
var f = c - d;
var g = 0;
if (isNaN_(this.th._inner[d])) {
g = 0 * f;
}
else {
g = this.th._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.rz;
};
ProportionalCategoryAngleAxis.prototype.get_ds = function () {
return true;
};
ProportionalCategoryAngleAxis.prototype.r6 = function (a, b, c, d, e) {
var f = 0.5;
if (this.qf > 1) {
var g = this.p9(c, d, e);
var h = 0;
if (!isNaN_(this.p8)) {
h = Math.min(this.p8, 1);
}
var i = 1 - 0.5 * g;
var j = i / (this.qf - (this.qf - 1) * h);
var k = (i - j) / (this.qf - 1);
f = 0.25 * g + 0.5 * j + a * k;
}
return this.tk(a, c, d, e) * f;
};
ProportionalCategoryAngleAxis.prototype.tk = function (a, b, c, d) {
if (a < 0 || a > this.qe - 1) {
return this.getCategorySize(b, c, d);
}
this.t1();
var e = this.th._inner[a];
if (isNaN_(e)) {
return NaN;
}
var f = Math.PI * 2 * this.th._inner[a];
return f;
};
ProportionalCategoryAngleAxis.prototype.r7 = function (a, b, c, d) {
this.t1();
var e = this.p9(b, c, d);
var f = 0;
if (!isNaN_(this.p8)) {
f = Math.min(this.p8, 1);
}
var g = 1 - 0.5 * e;
if (a < 0 || a > this.qe - 1) {
return this.p2(b, c, d);
}
var h = this.th._inner[a];
if (isNaN_(h)) {
return NaN;
}
var i = Math.PI * 2 * h;
return i * g / (this.qf - (this.qf - 1) * f);
};
ProportionalCategoryAngleAxis.prototype.qg = function () {
if (this.po == null) {
return 0;
}
this.t1();
if (this.tc) {
return _super.prototype.qg.call(this) + 1;
}
return _super.prototype.qg.call(this);
};
ProportionalCategoryAngleAxis.prototype.ru = function (a) {
return this.hasOthersCategory && a == this.qe - 1;
};
ProportionalCategoryAngleAxis.prototype.so = function () {
return this.tx();
};
ProportionalCategoryAngleAxis.prototype.rv = function (a) {
if (a >= 0 && a < this.qe) {
if (isNaN_(this.th._inner[a])) {
return true;
}
}
return _super.prototype.rv.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.l1 = function (a) {
this.t1();
_super.prototype.l1.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.ensureSum = function () {
this.t1();
};
ProportionalCategoryAngleAxis.prototype.t1 = function () {
if (this.td) {
this.td = false;
this.tc = false;
this.qe = this.qg();
this.ti = NaN;
this.tn = -1;
if (this.tb != null && this.tb.count > 0) {
this.tj = NaN;
var a = true;
for (var b = 0; b < this.tb.count; b++) {
var c = this.tb.item(b);
if (isNaN_(c) || isInfinity(c) || c < 0) {
continue;
}
if (a) {
a = false;
this.tj = 0;
}
this.tj += c;
}
var d = 0;
this.th.clear();
this.tg.clear();
this.tf.clear();
var e = new List$1(Base.$, 0);
this.s7.items = null;
var f = 0;
for (var g = 0; g < this.tb.count; g++) {
var h = 0;
if (isNaN_(this.tj)) {
h = 1 / this.qe;
}
else {
var i = this.tb.item(g);
if (isNaN_(i) || isInfinity(i) || i < 0) {
h = 0;
}
else {
h = i;
}
}
var j = false;
if (this.s8 == 0) {
if (h < this.tm) {
j = true;
}
}
else {
if ((h / this.tj) * 100 < this.tm) {
j = true;
}
}
if (j) {
e.add1(this.po.item(g));
this.tg.add(d);
this.th.add(NaN);
this.tf.add(true);
f += h;
}
else {
this.tg.add(d);
this.th.add(h / this.tj);
this.tf.add(false);
d += (h / this.tj);
}
}
if (f > 0) {
this.tc = true;
this.tg.add(d);
this.th.add(f / this.tj);
this.tf.add(false);
this.ti = f;
this.tn = this.tg.count - 1;
this.s7.items = e.toArray();
}
}
else {
if (this.qe > 0) {
this.th.clear();
this.tg.clear();
var k = 0;
for (var l = 0; l < this.qe; l++) {
this.tg.add(k);
this.th.add(1 / this.qe);
k += (1 / this.qe);
}
}
}
this.qe = this.qg();
}
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersValue", {
get: function () {
return this.ti;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersIndex", {
get: function () {
return this.tn;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "hasOthersCategory", {
get: function () {
return this.tc;
},
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.t1();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
if (this.tg == null || this.tg.count == 0 || this.th == null || this.th.count == 0) {
return NaN;
}
a = CoreGeometryUtil.s(a);
while (a < this.rz) {
a += 2 * Math.PI;
}
while (a > (this.rz + (2 * Math.PI))) {
a -= 2 * Math.PI;
}
var b = (a - this.rz) / (2 * Math.PI);
if (this.dn) {
b = 1 - b;
}
var c = -1;
c = ArrayExtension.binarySearch$11(Number_$type, this.tg, function (d) { return b < d ? -1 : (b > d ? 1 : 0); });
if (c < 0) {
c = ~c;
c--;
}
if (c < 0) {
c = 0;
}
if (c > this.tg.count - 1) {
c = this.tg.count - 1;
}
var d = this.tg._inner[c];
var e = this.th._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.tf.count - 1) {
return false;
}
return this.tf._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.qe - 1) {
b = this.qe - 1;
return this.tx();
}
return _super.prototype.ja.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.tx = function () {
if (this.tt != null) {
return this.tt;
}
return "Others";
};
ProportionalCategoryAngleAxis.prototype.getNormalizingValueAtIndex = function (a, b) {
if (a < 0 || this.tb == null || a > this.tb.count - 1) {
return b;
}
return this.tb.item(a);
};
ProportionalCategoryAngleAxis.prototype.tl = function (a) {
this.t1();
var b = this.th._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.qe;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]);
ProportionalCategoryAngleAxis.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'lu', ['OthersCategoryText:tt:t2', [2, null], 'OthersCategoryThreshold:tm:t3', [1, 3], 'OthersCategoryType:s8:t4', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]);
return ProportionalCategoryAngleAxis;
}(CategoryAngleAxis));
export { ProportionalCategoryAngleAxis };