igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
95 lines (94 loc) • 3.77 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, toEnum, fromEnum, markType } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
/**
* @hidden
*/
var PercentKCalculationStrategy = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PercentKCalculationStrategy, _super);
function PercentKCalculationStrategy() {
return _super !== null && _super.apply(this, arguments) || this;
}
PercentKCalculationStrategy.prototype.b = function (a, b) {
var c = new List$1(String_$type, 0);
c.add("HighColumn");
c.add("LowColumn");
c.add("CloseColumn");
return c;
};
PercentKCalculationStrategy.prototype._c = function (a, b) {
var c, d, e, f, g, h, i, j;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
c = a.period;
d = a.highColumn;
e = a.lowColumn;
f = 0;
_a.label = 1;
case 1:
if (!(f < a.count))
return [3 /*break*/, 4];
g = Math.min(c, f);
h = -1.7976931348623157E+308;
i = 1.7976931348623157E+308;
for (j = 0; j < g; j++) {
if (!isNaN_(d.item(f - j))) {
h = Math.max(h, d.item(f - j));
}
if (!isNaN_(e.item(f - j))) {
i = Math.min(i, e.item(f - j));
}
}
return [4 /*yield*/, b.i((a.closeColumn.item(f) - i) / (h - i) * 100)];
case 2:
_a.sent();
_a.label = 3;
case 3:
f++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/];
}
});
};
PercentKCalculationStrategy.prototype.c = function (a, b) {
var _this = this;
return toEnum(function () { return _this._c(a, b); });
};
PercentKCalculationStrategy.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;
};
PercentKCalculationStrategy.$t = markType(PercentKCalculationStrategy, 'PercentKCalculationStrategy', StreamingIndicatorCalculationStrategy.$);
return PercentKCalculationStrategy;
}(StreamingIndicatorCalculationStrategy));
export { PercentKCalculationStrategy };