igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
114 lines (113 loc) • 4.55 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, __generator, __values } from "tslib";
import { StreamingIndicatorCalculationStrategy } from "./StreamingIndicatorCalculationStrategy";
import { String_$type, fromEnum, toEnum, markType } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
/**
* @hidden
*/
var RelativeStrengthIndexIndicatorStrategy = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(RelativeStrengthIndexIndicatorStrategy, _super);
function RelativeStrengthIndexIndicatorStrategy() {
return _super !== null && _super.apply(this, arguments) || this;
}
RelativeStrengthIndexIndicatorStrategy.prototype.b = function (a, b) {
var c = new List$1(String_$type, 0);
c.add("CloseColumn");
return c;
};
RelativeStrengthIndexIndicatorStrategy.prototype.a = function (a, b) {
var e_1, _a;
var c = 0;
try {
for (var _b = __values(fromEnum(this.c(a, b))), _d = _b.next(); !_d.done; _d = _b.next()) {
var d = _d.value;
a.indicatorColumn.item(c, d);
c++;
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
return true;
};
RelativeStrengthIndexIndicatorStrategy.prototype._c = function (a, b) {
var c, d, e, f, g, h, i, j, k, l, m, n, o, p;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
c = a.period;
d = 2 / (c + 1);
e = 0;
f = 0;
g = a.indicatorColumn;
h = a.closeColumn;
if (!(g.count > 0))
return [3 /*break*/, 2];
return [4 /*yield*/, 0];
case 1:
_a.sent();
_a.label = 2;
case 2:
i = 1;
_a.label = 3;
case 3:
if (!(i < Math.min(a.period, g.count)))
return [3 /*break*/, 6];
j = h.item(i) - h.item(i - 1);
k = j > 0 ? j : 0;
l = j > 0 ? 0 : -j;
e += k / (c - 1);
f += l / (c - 1);
return [4 /*yield*/, 0];
case 4:
_a.sent();
_a.label = 5;
case 5:
++i;
return [3 /*break*/, 3];
case 6:
m = a.period;
_a.label = 7;
case 7:
if (!(m < g.count))
return [3 /*break*/, 10];
n = h.item(m) - h.item(m - 1);
o = n > 0 ? n : 0;
p = n > 0 ? 0 : -n;
e = (e * (c - 1) + o) / c;
f = (f * (c - 1) + p) / c;
return [4 /*yield*/, b.i(e != 0 ? 100 * e / (e + f) : 0)];
case 8:
_a.sent();
_a.label = 9;
case 9:
++m;
return [3 /*break*/, 7];
case 10: return [2 /*return*/];
}
});
};
RelativeStrengthIndexIndicatorStrategy.prototype.c = function (a, b) {
var _this = this;
return toEnum(function () { return _this._c(a, b); });
};
RelativeStrengthIndexIndicatorStrategy.$t = markType(RelativeStrengthIndexIndicatorStrategy, 'RelativeStrengthIndexIndicatorStrategy', StreamingIndicatorCalculationStrategy.$);
return RelativeStrengthIndexIndicatorStrategy;
}(StreamingIndicatorCalculationStrategy));
export { RelativeStrengthIndexIndicatorStrategy };