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.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;
return _this;
}
ProportionalCategoryAngleAxis.prototype.get_s2 = function () {
return this.s1;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "s2", {
get: function () {
return this.get_s2();
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.tj = function () {
if (this.tk == null) {
this.tk = OthersCategoryContext.b(this.s1, this.b7);
}
return this.tk;
};
ProportionalCategoryAngleAxis.prototype.tm = function (a) {
if (a) {
return this.tj();
}
else {
return this.s2;
}
};
ProportionalCategoryAngleAxis.prototype.s9 = function (a) {
return a == this.s2 || a == this.tk;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "tu", {
get: function () {
return this.tn;
},
set: function (a) {
var b = this.tu;
if (a != b) {
this.tn = a;
this.ls("ValueMemberPath", b, this.tu);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.hu = function (a, b) {
var c = this.jn(b);
if (this.hasOthersCategory && c == "Label") {
if (typeCast(OthersCategoryContext.$, a) !== null) {
return this.ts();
}
else {
var int_ = this.tl(a);
if (int_ != null && typeCast(OthersCategoryContext.$, int_) !== null) {
return this.ts();
}
}
}
return _super.prototype.hu.call(this, a, b);
};
ProportionalCategoryAngleAxis.prototype.tl = function (a) {
if (a == null) {
return null;
}
return a.i ? a.i : a;
return null;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "normalizationMayContainUnknowns", {
get: function () {
return this.s6 == null || this.s6.mayContainUnknowns;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "s6", {
get: function () {
return this.s4;
},
set: function (a) {
if (this.s4 != a) {
var b = this.s4;
this.s4 = a;
this.ls("ValueColumn", b, this.s4);
}
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.s5 = function (a) {
if (a == null) {
return this.pm.registerColumn(null, null, false);
}
var b = null;
var c = SeriesViewer.de(a, this.coercionMethods);
b = c.a;
return this.pm.registerColumn(a, b, this.expectFunctions);
};
ProportionalCategoryAngleAxis.prototype.la = function (a, b, c, d) {
var e_1, _a;
_super.prototype.la.call(this, 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();
try {
for (var _b = __values(fromEnum(this.eo())), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
e.r8(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.s8 = true;
this.s7 = false;
var f = typeCast(IFastItemsSource_$type, c);
if (f != null) {
f.deregisterColumn(this.s6);
this.s6 = null;
}
var g = typeCast(IFastItemsSource_$type, d);
if (g != null) {
this.s6 = this.s5(this.tu);
}
this.lx();
break;
}
};
ProportionalCategoryAngleAxis.prototype.qy = function (a) {
_super.prototype.qy.call(this, a);
this.s8 = true;
this.s7 = false;
};
ProportionalCategoryAngleAxis.prototype.getScaledAngle = function (a) {
this.tw();
if (isNaN_(a) || isInfinity(a)) {
return NaN;
}
var b = this.qa;
var c = a % b;
if (c < 0) {
c = b + c;
}
var d = truncate(Math.floor(c));
var e = this.tb._inner[d];
var f = c - d;
var g = 0;
if (isNaN_(this.tc._inner[d])) {
g = 0 * f;
}
else {
g = this.tc._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.ru;
};
ProportionalCategoryAngleAxis.prototype.get_ds = function () {
return true;
};
ProportionalCategoryAngleAxis.prototype.r1 = function (a, b, c, d, e) {
var f = 0.5;
if (this.qc > 1) {
var g = this.p6(c, d, e);
var h = 0;
if (!isNaN_(this.p5)) {
h = Math.min(this.p5, 1);
}
var i = 1 - 0.5 * g;
var j = i / (this.qc - (this.qc - 1) * h);
var k = (i - j) / (this.qc - 1);
f = 0.25 * g + 0.5 * j + a * k;
}
return this.tf(a, c, d, e) * f;
};
ProportionalCategoryAngleAxis.prototype.tf = function (a, b, c, d) {
if (a < 0 || a > this.qb - 1) {
return this.getCategorySize(b, c, d);
}
this.tw();
var e = this.tc._inner[a];
if (isNaN_(e)) {
return NaN;
}
var f = Math.PI * 2 * this.tc._inner[a];
return f;
};
ProportionalCategoryAngleAxis.prototype.r2 = function (a, b, c, d) {
this.tw();
var e = this.p6(b, c, d);
var f = 0;
if (!isNaN_(this.p5)) {
f = Math.min(this.p5, 1);
}
var g = 1 - 0.5 * e;
if (a < 0 || a > this.qb - 1) {
return this.pz(b, c, d);
}
var h = this.tc._inner[a];
if (isNaN_(h)) {
return NaN;
}
var i = Math.PI * 2 * h;
return i * g / (this.qc - (this.qc - 1) * f);
};
ProportionalCategoryAngleAxis.prototype.qd = function () {
if (this.pm == null) {
return 0;
}
this.tw();
if (this.s7) {
return _super.prototype.qd.call(this) + 1;
}
return _super.prototype.qd.call(this);
};
ProportionalCategoryAngleAxis.prototype.rp = function (a) {
return this.hasOthersCategory && a == this.qb - 1;
};
ProportionalCategoryAngleAxis.prototype.sj = function () {
return this.ts();
};
ProportionalCategoryAngleAxis.prototype.rq = function (a) {
if (a >= 0 && a < this.qb) {
if (isNaN_(this.tc._inner[a])) {
return true;
}
}
return _super.prototype.rq.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.lz = function (a) {
this.tw();
_super.prototype.lz.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.ensureSum = function () {
this.tw();
};
ProportionalCategoryAngleAxis.prototype.tw = function () {
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;
var a = true;
for (var b = 0; b < this.s6.count; b++) {
var c = this.s6.item(b);
if (isNaN_(c) || isInfinity(c) || c < 0) {
continue;
}
if (a) {
a = false;
this.te = 0;
}
this.te += c;
}
var d = 0;
this.tc.clear();
this.tb.clear();
this.ta.clear();
var e = new List$1(Base.$, 0);
this.s2.items = null;
var f = 0;
for (var g = 0; g < this.s6.count; g++) {
var h = 0;
if (isNaN_(this.te)) {
h = 1 / this.qb;
}
else {
var i = this.s6.item(g);
if (isNaN_(i) || isInfinity(i) || i < 0) {
h = 0;
}
else {
h = i;
}
}
var 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();
var k = 0;
for (var l = 0; l < this.qb; l++) {
this.tb.add(k);
this.tc.add(1 / this.qb);
k += (1 / this.qb);
}
}
}
this.qb = this.qd();
}
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersValue", {
get: function () {
return this.td;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "othersIndex", {
get: function () {
return this.ti;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "hasOthersCategory", {
get: function () {
return this.s7;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.k1 = function (a, b, c, d) {
for (var e = b; e < c; e++) {
a.item(e, this.f6(a.item(e), d));
}
};
ProportionalCategoryAngleAxis.prototype.getUnscaledAngle = function (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;
}
var b = (a - this.ru) / (2 * Math.PI);
if (this.dn) {
b = 1 - b;
}
var c = -1;
c = ArrayExtension.binarySearch$11(Number_$type, this.tb, function (d) { return 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;
}
var d = this.tb._inner[c];
var e = this.tc._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.ta.count - 1) {
return false;
}
return this.ta._inner[a];
};
ProportionalCategoryAngleAxis.prototype.i8 = 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.qb - 1) {
b = this.qb - 1;
return this.ts();
}
return _super.prototype.i8.call(this, a);
};
ProportionalCategoryAngleAxis.prototype.ts = function () {
if (this.to != null) {
return this.to;
}
return "Others";
};
ProportionalCategoryAngleAxis.prototype.getNormalizingValueAtIndex = function (a, b) {
if (a < 0 || this.s6 == null || a > this.s6.count - 1) {
return b;
}
return this.s6.item(a);
};
ProportionalCategoryAngleAxis.prototype.tg = function (a) {
this.tw();
var b = this.tc._inner[a] * 100;
return b;
};
Object.defineProperty(ProportionalCategoryAngleAxis.prototype, "isVertical", {
get: function () {
return this.dy;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.prototype.j$d = function (a, b) {
return this.f9.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$c = function (a, b) {
return this.f6.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$e = function (a, b, c, d, e) {
this.k0.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$f = function (a, b, c, d) {
this.k1.apply(this, arguments);
};
ProportionalCategoryAngleAxis.prototype.j$g = function (a, b, c, d) {
this.k2.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.qb;
},
enumerable: false,
configurable: true
});
ProportionalCategoryAngleAxis.$t = markType(ProportionalCategoryAngleAxis, 'ProportionalCategoryAngleAxis', CategoryAngleAxis.$, [ICoalescingModerator_$type]);
ProportionalCategoryAngleAxis.$$p = markDep(DependencyProperty, PropertyMetadata, ProportionalCategoryAngleAxis, 'ls', ['OthersCategoryText:to:tx', [2, null], 'OthersCategoryThreshold:th:ty', [1, 3], 'OthersCategoryType:s3:tz', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)]]);
return ProportionalCategoryAngleAxis;
}(CategoryAngleAxis));
export { ProportionalCategoryAngleAxis };