UNPKG

igniteui-webcomponents-charts

Version:

Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.

475 lines (474 loc) 17 kB
/* 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-webcomponents-core"; import { Series } from "./Series"; import { List$1 } from "igniteui-webcomponents-core"; import { Number_$type, typeCast, runOn, markType, markDep, getEnumerator, Point_$type, fromEnum } from "igniteui-webcomponents-core"; import { CategoryFrame } from "./CategoryFrame"; import { SafeEnumerable } from "./SafeEnumerable"; import { TrendCalculators } from "igniteui-webcomponents-core"; import { AxisRange } from "./AxisRange"; import { FinancialSeriesView } from "./FinancialSeriesView"; import { ScalerParams } from "./ScalerParams"; import { ISortingAxis_$type } from "./ISortingAxis"; import { FinancialBucketCalculator } from "./FinancialBucketCalculator"; import { Polyline } from "igniteui-webcomponents-core"; import { Polygon } from "igniteui-webcomponents-core"; import { PropertyMetadata } from "igniteui-webcomponents-core"; import { isNaN_ } from "igniteui-webcomponents-core"; import { Flattener } from "igniteui-webcomponents-core"; /** * @hidden */ var BollingerBandsOverlay = /** @class */ /*@__PURE__*/ (function (_super) { __extends(BollingerBandsOverlay, _super); function BollingerBandsOverlay() { var _this = _super.call(this) || this; _this.abd = 0; _this.abe = 0; _this.abb = new List$1(Number_$type, 0); _this.abc = new List$1(Number_$type, 0); _this.ab = BollingerBandsOverlay.$; _this.xf = new CategoryFrame(4); _this.xh = new CategoryFrame(4); _this.xd = new CategoryFrame(4); return _this; } BollingerBandsOverlay.prototype.bk = function () { return new BollingerBandsOverlay(); }; BollingerBandsOverlay.prototype.rc = function (a, b, c, d) { if (this.yu().contains(b)) { this.aa5 = false; } _super.prototype.rc.call(this, a, b, c, d); switch (b) { case BollingerBandsOverlay.$$p[1]: this.aa5 = false; this.ru(false); break; case BollingerBandsOverlay.$$p[0]: this.ru(false); break; } }; BollingerBandsOverlay.prototype.aa6 = function () { this.abb.clear(); this.abc.clear(); var a = getEnumerator(TrendCalculators.e(new SafeEnumerable(this.yt), this.abg)); var b = getEnumerator(TrendCalculators.f(new SafeEnumerable(this.yt), this.abg)); this.abe = 1.7976931348623157E+308; this.abd = -1.7976931348623157E+308; var c = true; var d = true; var e = this.abf; while (c || d) { if (a.moveNext()) { this.abb.add(a.current); } else { c = false; } if (b.moveNext()) { this.abc.add(b.current); } else { d = false; } if (c && d) { this.abe = Math.min(this.abe, a.current - b.current * e); this.abd = Math.max(this.abd, a.current + b.current * e); } } return true; }; BollingerBandsOverlay.prototype.ay = function (a) { if (this.abb == null || this.abc == null || a == null || this.dp == null || a != this.xu) { return null; } var b = new AxisRange(this.abe, this.abd); return b; }; BollingerBandsOverlay.prototype.aah = function (a, b) { _super.prototype.aah.call(this, a, b); var c = b.ca; var d = b.b9; var e = this.getEffectiveViewport1(b); var f = this.xb; var g = this.xu; var h = new ScalerParams(0, c, d, f.ch, e); var i = new ScalerParams(0, c, d, g.ch, e); a.h.clear(); a.p.clear(); a.s.clear(); var j = typeCast(ISortingAxis_$type, this.xb); if (j != null && j.i$b.count != this.dp.count) { return; } var k = 0; k = this.y2(c, d, e); if (!this.aa5) { this.aa5 = this.aa6(); if (this.xu != null) { this.xu.c2(true); } } i.b = this.iz(); var l = this.xb.eo(2, h) - this.xb.eo(1, h); for (var m = b.cd.c; m <= b.cd.d; ++m) { var n = void 0; if (j == null) { n = b.cd.getBucket(m); } else { var o = j.i$b._inner[m]; var p = j.i$d(o); var q = this.abb._inner[m]; var r = this.abc._inner[m]; var s = q; var t = r; var u = p; var v = 1; while (m < b.cd.d) { o = j.i$b._inner[m + 1]; u = j.i$d(o); if (u - p > l) { break; } m++; s += this.abb._inner[m]; t += this.abc._inner[m]; v++; } s /= v; t /= v; var w = s - t * this.abf; var x = s; var y = s + t * this.abf; var z = NaN; if (!isNaN_(p)) { z = this.xb.el(p, h); } n = [z, w, x, y]; } var aa = Math.max(1, l); if (!isNaN_(n[0]) && m * aa >= this.aa7) { if (this.xb != null && typeCast(ISortingAxis_$type, this.xb) !== null) { n[0] = n[0] + k; } else { n[0] = f.el(n[0], h) + k; } n[1] = g.el(n[1], i); n[2] = g.el(n[2], i); n[3] = g.el(n[3], i); a.h.add(n); } } }; BollingerBandsOverlay.prototype.o7 = function (a, b) { _super.prototype.o7.call(this, a, b); var c = b; if (c != null) { c.ck(); } }; BollingerBandsOverlay.prototype.i6 = function (a, b, c) { if (this.abb == null) { return _super.prototype.i6.call(this, a, b, c); } var d = this.getEffectiveViewport1(this.cw); var e = this.y2(this.cw.ca, this.cw.b9, d); var f = new ScalerParams(0, this.cw.ca, this.cw.b9, this.xb.ch, d); f.c = this.dc.xb; return this.i8(this.abb, a, this.xb, f, e, runOn(this, this.y1), b, c); }; BollingerBandsOverlay.prototype.kb = function (a, b) { if (this.abb == null) { return _super.prototype.kb.call(this, a, b); } return this.kc(a, b, this.xb, runOn(this, this.y1), this.abb); }; BollingerBandsOverlay.prototype.j9 = function (a, b) { if (this.abb == null) { return _super.prototype.j9.call(this, a, b); } return this.ka(a, b, this.xb, runOn(this, this.y1), this.abb); }; BollingerBandsOverlay.prototype.hf = function (a, b, c) { var d = _super.prototype.hf.call(this, a, b, c); if (!this.yk(this.yu())) { d = false; } return d; }; BollingerBandsOverlay.prototype.aaj = function (a, b) { _super.prototype.aaj.call(this, a, b); var c = typeCast(BollingerBandsOverlayView.$, b); var d = this.getEffectiveViewport1(b); if (b.cg(a)) { c.ck(); var e_1 = a.h.count; var f = function (g) { return a.h._inner[g][0]; }; var g = function (h) { return a.h._inner[e_1 - 1 - h][0]; }; var h = function (i) { return a.h._inner[i][1]; }; var i = function (j) { return a.h._inner[j][2]; }; var j = function (k) { return a.h._inner[e_1 - 1 - k][3]; }; c.cl(e_1, f, g, h, i, j); b.ci(a); } this.xk.a2(this, this.yj(), runOn(this, this.w3), this.y8(b), this.za(b)); var k = false; var l = this.xk.b; var m = a.h; var n = this.dp.count; if (l != null) { k = true; } if (k) { var o = new ScalerParams(0, b.ca, b.b9, this.xb.ch, d); this.aag(m, -1, n, this.xb, o, b.t, -1); } var p = c.cs; var q = c.ct; var r = c.cu; var s = c.cn; this.xk.ad(q, true, false, true, true); this.xk.an = null; this.xk.am = null; this.xk.ad(p, true, false, false, true); this.xk.ad(r, true, false, false, true); this.xk.ad(s, false, true, false, false); s._opacity = this.xk.j * this.ia; }; BollingerBandsOverlay.prototype.ct = function () { return new BollingerBandsOverlayView(this); }; BollingerBandsOverlay.prototype.q3 = function (a) { _super.prototype.q3.call(this, a); this.aba = typeCast(BollingerBandsOverlayView.$, a); }; BollingerBandsOverlay.prototype.zb = function () { return 3; }; BollingerBandsOverlay.prototype.iz = function () { return Series.i1(this.abb, null); }; BollingerBandsOverlay.$t = markType(BollingerBandsOverlay, 'BollingerBandsOverlay', FinancialOverlay.$); BollingerBandsOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, BollingerBandsOverlay, 'raisePropertyChanged', ['Multiplier:abf:abj', [1, 2], 'Period:abg:abk', [1, 14]]); return BollingerBandsOverlay; }(FinancialOverlay)); export { BollingerBandsOverlay }; /** * @hidden */ var BollingerBandsBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) { __extends(BollingerBandsBucketCalculator, _super); function BollingerBandsBucketCalculator(a) { var _this = _super.call(this, a) || this; _this.f = null; _this.f = a; return _this; } BollingerBandsBucketCalculator.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 = this.f.cj.abf; var e = 0; var f = 0; var g = 0; for (var h = b; h <= c; ++h) { if (!isNaN_(this.f.cj.abb._inner[h]) && !isNaN_(this.f.cj.abc._inner[h])) { e += this.f.cj.abb._inner[h]; f += this.f.cj.abc._inner[h]; ++g; } } if (g > 0) { e = e / g; f = f / g; return [0.5 * (b + c), e - f * d, e, e + f * d]; } } return [NaN, NaN, NaN, NaN]; }; BollingerBandsBucketCalculator.$t = markType(BollingerBandsBucketCalculator, 'BollingerBandsBucketCalculator', FinancialBucketCalculator.$); return BollingerBandsBucketCalculator; }(FinancialBucketCalculator)); export { BollingerBandsBucketCalculator }; /** * @hidden */ var BollingerBandsOverlayView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(BollingerBandsOverlayView, _super); function BollingerBandsOverlayView(a) { var _this = _super.call(this, a) || this; _this.cj = null; _this.co = new Polygon(); _this.cv = new Polyline(); _this.cw = new Polyline(); _this.cx = new Polyline(); _this.cm = new Polygon(); _this.cp = new Polyline(); _this.cq = new Polyline(); _this.cr = new Polyline(); _this.cj = a; return _this; } BollingerBandsOverlayView.prototype.a4 = function () { _super.prototype.a4.call(this); if (!this.t) { } }; BollingerBandsOverlayView.prototype.ce = function () { return new BollingerBandsBucketCalculator(this); }; BollingerBandsOverlayView.prototype.cl = function (a, b, c, d, e, f) { var e_2, _a, e_3, _b, e_4, _c; try { for (var _d = __values(fromEnum(Flattener.d(a, b, d, this.f.ie))), _e = _d.next(); !_e.done; _e = _d.next()) { var g = _e.value; this.co.an.add({ $type: Point_$type, x: b(g), y: d(g) }); this.cv.an.add({ $type: Point_$type, x: b(g), y: d(g) }); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_e && !_e.done && (_a = _d.return)) _a.call(_d); } finally { if (e_2) throw e_2.error; } } try { for (var _f = __values(fromEnum(Flattener.d(a, b, e, this.f.ie))), _g = _f.next(); !_g.done; _g = _f.next()) { var h = _g.value; this.cw.an.add({ $type: Point_$type, x: b(h), y: e(h) }); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_g && !_g.done && (_b = _f.return)) _b.call(_f); } finally { if (e_3) throw e_3.error; } } try { for (var _h = __values(fromEnum(Flattener.d(a, c, f, this.f.ie))), _j = _h.next(); !_j.done; _j = _h.next()) { var i = _j.value; this.co.an.add({ $type: Point_$type, x: c(i), y: f(i) }); this.cx.an.add({ $type: Point_$type, x: c(i), y: f(i) }); } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_j && !_j.done && (_c = _h.return)) _c.call(_h); } finally { if (e_4) throw e_4.error; } } this.a2(); }; BollingerBandsOverlayView.prototype.ck = function () { this.co.an.clear(); this.cv.an.clear(); this.cw.an.clear(); this.cx.an.clear(); this.a2(); }; Object.defineProperty(BollingerBandsOverlayView.prototype, "cn", { get: function () { return this.co; }, enumerable: false, configurable: true }); Object.defineProperty(BollingerBandsOverlayView.prototype, "cs", { get: function () { return this.cv; }, enumerable: false, configurable: true }); Object.defineProperty(BollingerBandsOverlayView.prototype, "ct", { get: function () { return this.cw; }, enumerable: false, configurable: true }); Object.defineProperty(BollingerBandsOverlayView.prototype, "cu", { get: function () { return this.cx; }, enumerable: false, configurable: true }); BollingerBandsOverlayView.prototype.bq = function () { _super.prototype.bq.call(this); this.cm.an = this.co.an; this.cp.an = this.cv.an; this.cq.an = this.cw.an; this.cr.an = this.cx.an; var a = this.b3(); this.cm._fill = a; this.cm._opacity = 1; this.cp._stroke = a; this.cp.ad = this.f.ig + 3; this.cq._stroke = a; this.cq.ad = this.f.ig + 3; this.cr._stroke = a; this.cr.ad = this.f.ig + 3; }; BollingerBandsOverlayView.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); a.v(this.cr); } else { a.u(this.co); a.v(this.cv); a.v(this.cw); a.v(this.cx); } } }; BollingerBandsOverlayView.prototype.ax = function (a) { _super.prototype.ax.call(this, a); this.f.bc.exportPolygonData(a, this.co, "FillShape", ["Fill"]); this.f.bc.exportPolylineData(a, this.cv, "BottomLine", ["Lower", "Main"]); this.f.bc.exportPolylineData(a, this.cw, "CentralLine", ["Central"]); this.f.bc.exportPolylineData(a, this.cx, "TopLine", ["Upper"]); }; BollingerBandsOverlayView.$t = markType(BollingerBandsOverlayView, 'BollingerBandsOverlayView', FinancialSeriesView.$); return BollingerBandsOverlayView; }(FinancialSeriesView)); export { BollingerBandsOverlayView };