igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
414 lines (413 loc) • 15 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 { FinancialOverlay } from "./FinancialOverlay";
import { DependencyProperty } from "igniteui-react-core";
import { Series } from "./Series";
import { List$1 } from "igniteui-react-core";
import { Number_$type, typeCast, runOn, markType, markDep, Point_$type, fromEnum } from "igniteui-react-core";
import { CategoryFrame } from "./CategoryFrame";
import { MathUtil } from "igniteui-react-core";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialBucketCalculator } from "./FinancialBucketCalculator";
import { Polyline } from "igniteui-react-core";
import { Polygon } from "igniteui-react-core";
import { RangeValueList } from "./RangeValueList";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { Flattener } from "igniteui-react-core";
/**
* @hidden
*/
var PriceChannelOverlay = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PriceChannelOverlay, _super);
function PriceChannelOverlay() {
var _this = _super.call(this) || this;
_this.abs = new List$1(Number_$type, 0);
_this.abr = new List$1(Number_$type, 0);
_this.ab = PriceChannelOverlay.$;
_this.xv = new CategoryFrame(3);
_this.xx = new CategoryFrame(3);
_this.xt = new CategoryFrame(3);
return _this;
}
PriceChannelOverlay.prototype.bk = function () {
return new PriceChannelOverlay();
};
PriceChannelOverlay.prototype.rq = function (a, b, c, d) {
switch (b) {
case "HighColumn":
case "LowColumn":
this.abl = false;
break;
}
_super.prototype.rq.call(this, a, b, c, d);
switch (b) {
case PriceChannelOverlay.$$p[0]:
this.abl = false;
this.r8(false);
break;
}
};
PriceChannelOverlay.prototype.hk = function (a, b, c) {
var d = _super.prototype.hk.call(this, a, b, c);
if (this.yl == null || this.ym == null) {
d = false;
}
return d;
};
PriceChannelOverlay.prototype.abm = function () {
this.abs.clear();
this.abr.clear();
var a = truncate(MathUtil.e(this.abt, 0, this.dp.count));
var b = Math.min(this.yl.count, this.ym.count);
var c = this.zb(this.yl);
var d = this.zb(this.ym);
for (var e = 0; e < b; e++) {
var f = Math.min(a, e);
var g = -1.7976931348623157E+308;
var h = 1.7976931348623157E+308;
for (var i = 0; i < f; i++) {
if (!isNaN_(c.item(e - i))) {
g = Math.max(g, c.item(e - i));
}
if (!isNaN_(d.item(e - i))) {
h = Math.min(h, d.item(e - i));
}
}
if (e == 0) {
h = d.item(0);
g = c.item(0);
}
this.abs.add(g);
this.abr.add(h);
}
return true;
};
PriceChannelOverlay.prototype.aax = function (a, b) {
_super.prototype.aax.call(this, a, b);
var c = b.ca;
var d = b.b9;
var e = this.getEffectiveViewport1(b);
var f = new ScalerParams(0, c, d, this.xr.dn, e);
var g = new ScalerParams(0, c, d, this.ya.dn, e);
g.b = this.i5();
var h = this.xr;
var i = this.ya;
a.k.clear();
a.s.clear();
a.v.clear();
var j = 0;
var k = typeCast(ISortingAxis_$type, this.xr);
if (k != null && k.i$b.count != this.dp.count) {
return;
}
j = this.zi(c, d, e);
if (!this.abl) {
this.abl = this.abm();
}
g.b = this.i5();
var l = this.xr.f9(2, f) - this.xr.f9(1, f);
for (var m = b.cd.c; m <= b.cd.d; ++m) {
var n = void 0;
if (k == null) {
n = b.cd.getBucket(m);
}
else {
var o = k.i$b._inner[m];
var p = k.i$d(o);
var q = this.abs._inner[m];
var r = this.abr._inner[m];
var s = q;
var t = r;
var u = p;
while (m < b.cd.d) {
o = k.i$b._inner[m + 1];
u = k.i$d(o);
if (u - p > l) {
break;
}
m++;
s = Math.max(q, this.abs._inner[m]);
t = Math.min(r, this.abr._inner[m]);
}
if (!isInfinity(t) && !isInfinity(s)) {
var v = NaN;
if (!isNaN_(p)) {
v = this.xr.f6(p, f);
}
n = [v, t, s];
}
else {
n = [NaN, NaN, NaN];
}
}
var w = Math.max(1, l);
if (!isNaN_(n[0]) && m * w >= this.abn) {
if (this.xr != null && typeCast(ISortingAxis_$type, this.xr) !== null) {
n[0] = n[0] + j;
}
else {
n[0] = h.f6(n[0], f) + j;
}
n[1] = i.f6(n[1], g);
n[2] = i.f6(n[2], g);
a.k.add(n);
}
}
};
PriceChannelOverlay.prototype.pi = function (a, b) {
_super.prototype.pi.call(this, a, b);
var c = b;
if (c != null) {
c.ck();
}
};
PriceChannelOverlay.prototype.aaz = function (a, b) {
_super.prototype.aaz.call(this, a, b);
var c = typeCast(PriceChannelOverlayView.$, b);
if (c == null) {
return;
}
var d = this.getEffectiveViewport1(b);
if (b.cg(a)) {
c.ck();
var e_1 = a.k.count;
var f = function (g) { return a.k._inner[g][0]; };
var g = function (h) { return a.k._inner[e_1 - 1 - h][0]; };
var h = function (i) { return a.k._inner[i][1]; };
var i = function (j) { return a.k._inner[e_1 - 1 - j][2]; };
c.cl(e_1, f, g, h, i);
b.ci(a);
}
this.x0.a2(this, this.yz(), runOn(this, this.xj), this.zo(b), this.zq(b));
var j = false;
var k = this.x0.b;
var l = a.k;
var m = this.dp.count;
if (k != null) {
j = true;
}
if (j) {
var n = new ScalerParams(0, b.ca, b.b9, this.xr.dn, d);
this.aaw(l, -1, m, this.xr, n, b.t, -1);
}
var o = c.cr;
var p = c.cs;
var q = c.cn;
this.x0.ad(o, true, false, true, true);
this.x0.ad(p, true, false, true, true);
this.x0.ad(q, false, true, false, false);
q._opacity = this.x0.j * this.ig;
};
PriceChannelOverlay.prototype.ct = function () {
return new PriceChannelOverlayView(this);
};
PriceChannelOverlay.prototype.rh = function (a) {
_super.prototype.rh.call(this, a);
this.abq = typeCast(PriceChannelOverlayView.$, a);
};
PriceChannelOverlay.prototype.jd = function (a, b, c) {
if (this.dc == null) {
return NaN;
}
var d = this.getEffectiveViewport1(this.cw);
var e = new ScalerParams(0, this.dc.yr, this.cw.b9, this.xr.dn, d);
var f = this.zi(this.dc.yr, this.cw.b9, d);
return this.jf(new RangeValueList(this.abs, this.abr), a, this.xr, e, f, runOn(this, this.zh), b, c);
};
PriceChannelOverlay.prototype.kh = function (a, b) {
if (this.abs == null || this.abr == null) {
return _super.prototype.kh.call(this, a, b);
}
return this.ki(a, b, this.xr, runOn(this, this.zh), new RangeValueList(this.abs, this.abr));
};
PriceChannelOverlay.prototype.kj = function (a, b) {
if (this.abs == null || this.abr == null) {
return _super.prototype.kj.call(this, a, b);
}
return this.kk(a, b, this.xr, runOn(this, this.zh), new RangeValueList(this.abs, this.abr));
};
PriceChannelOverlay.prototype.i5 = function () {
return Series.i7(this.abr, null);
};
PriceChannelOverlay.$t = markType(PriceChannelOverlay, 'PriceChannelOverlay', FinancialOverlay.$);
PriceChannelOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, PriceChannelOverlay, 'raisePropertyChanged', ['Period:abt:abv', [1, 14]]);
return PriceChannelOverlay;
}(FinancialOverlay));
export { PriceChannelOverlay };
/**
* @hidden
*/
var PriceChannelBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PriceChannelBucketCalculator, _super);
function PriceChannelBucketCalculator(a) {
var _this = _super.call(this, a) || this;
_this.f = null;
_this.f = a;
return _this;
}
PriceChannelBucketCalculator.prototype.getBucket = function (a) {
var b = a * this.b;
var c = Math.min(b + this.b - 1, this.a.cf.dp.count - 1);
if (b <= c) {
var d = -1.7976931348623157E+308;
var e = 1.7976931348623157E+308;
var f = 0;
for (var g = b; g <= c; ++g) {
if (!isNaN_(this.f.cj.abs._inner[g]) && !isNaN_(this.f.cj.abr._inner[g])) {
d = Math.max(d, this.f.cj.abs._inner[g]);
e = Math.min(e, this.f.cj.abr._inner[g]);
++f;
}
}
if (f > 0 && e != 1.7976931348623157E+308 && d != -1.7976931348623157E+308) {
return [0.5 * (b + c), e, d];
}
}
return [NaN, NaN, NaN];
};
PriceChannelBucketCalculator.$t = markType(PriceChannelBucketCalculator, 'PriceChannelBucketCalculator', FinancialBucketCalculator.$);
return PriceChannelBucketCalculator;
}(FinancialBucketCalculator));
export { PriceChannelBucketCalculator };
/**
* @hidden
*/
var PriceChannelOverlayView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PriceChannelOverlayView, _super);
function PriceChannelOverlayView(a) {
var _this = _super.call(this, a) || this;
_this.co = new Polygon();
_this.ct = new Polyline();
_this.cu = new Polyline();
_this.cj = null;
_this.cm = new Polygon();
_this.cp = new Polyline();
_this.cq = new Polyline();
_this.cj = a;
return _this;
}
Object.defineProperty(PriceChannelOverlayView.prototype, "cn", {
get: function () {
return this.co;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PriceChannelOverlayView.prototype, "cr", {
get: function () {
return this.ct;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PriceChannelOverlayView.prototype, "cs", {
get: function () {
return this.cu;
},
enumerable: false,
configurable: true
});
PriceChannelOverlayView.prototype.a4 = function () {
_super.prototype.a4.call(this);
if (!this.t) {
}
};
PriceChannelOverlayView.prototype.ce = function () {
return new PriceChannelBucketCalculator(this);
};
PriceChannelOverlayView.prototype.ck = function () {
this.co.an.clear();
this.ct.an.clear();
this.cu.an.clear();
this.a2();
};
PriceChannelOverlayView.prototype.cl = function (a, b, c, d, e) {
var e_2, _a, e_3, _b;
try {
for (var _c = __values(fromEnum(Flattener.d(a, b, d, this.f.ik))), _d = _c.next(); !_d.done; _d = _c.next()) {
var f = _d.value;
this.co.an.add({ $type: Point_$type, x: b(f), y: d(f) });
this.ct.an.add({ $type: Point_$type, x: b(f), y: d(f) });
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _c.return))
_a.call(_c);
}
finally {
if (e_2)
throw e_2.error;
}
}
try {
for (var _e = __values(fromEnum(Flattener.d(a, c, e, this.f.ik))), _f = _e.next(); !_f.done; _f = _e.next()) {
var g = _f.value;
this.co.an.add({ $type: Point_$type, x: c(g), y: e(g) });
this.cu.an.add({ $type: Point_$type, x: c(g), y: e(g) });
}
}
catch (e_3_1) {
e_3 = { error: e_3_1 };
}
finally {
try {
if (_f && !_f.done && (_b = _e.return))
_b.call(_e);
}
finally {
if (e_3)
throw e_3.error;
}
}
this.a2();
};
PriceChannelOverlayView.prototype.bq = function () {
_super.prototype.bq.call(this);
this.cm.an = this.co.an;
this.cp.an = this.ct.an;
this.cq.an = this.cu.an;
var a = this.b3();
this.cm._fill = a;
this.cm._opacity = 1;
this.cp._stroke = a;
this.cp.ad = this.f.il + 3;
this.cq._stroke = a;
this.cq.ad = this.f.il + 3;
};
PriceChannelOverlayView.prototype.bj = function (a, b) {
_super.prototype.bj.call(this, a, b);
if (a.d) {
if (b) {
a.u(this.cm);
a.v(this.cp);
a.v(this.cq);
}
else {
a.u(this.co);
a.v(this.ct);
a.v(this.cu);
}
}
};
PriceChannelOverlayView.prototype.ax = function (a) {
_super.prototype.ax.call(this, a);
this.f.bc.exportPolygonData(a, this.co, "fill", ["Fill"]);
this.f.bc.exportPolylineData(a, this.ct, "bottom", ["Lower", "Main"]);
this.f.bc.exportPolylineData(a, this.cu, "top", ["Upper"]);
};
PriceChannelOverlayView.$t = markType(PriceChannelOverlayView, 'PriceChannelOverlayView', FinancialSeriesView.$);
return PriceChannelOverlayView;
}(FinancialSeriesView));
export { PriceChannelOverlayView };