UNPKG

igniteui-webcomponents-charts

Version:

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

414 lines (413 loc) 15.1 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, Point_$type, fromEnum } from "igniteui-webcomponents-core"; import { CategoryFrame } from "./CategoryFrame"; import { MathUtil } from "igniteui-webcomponents-core"; 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 { RangeValueList } from "./RangeValueList"; import { PropertyMetadata } from "igniteui-webcomponents-core"; import { truncate, isNaN_, isInfinity } from "igniteui-webcomponents-core"; import { Flattener } from "igniteui-webcomponents-core"; /** * @hidden */ var PriceChannelOverlay = /** @class */ /*@__PURE__*/ (function (_super) { __extends(PriceChannelOverlay, _super); function PriceChannelOverlay() { var _this = _super.call(this) || this; _this.abc = new List$1(Number_$type, 0); _this.abb = new List$1(Number_$type, 0); _this.ab = PriceChannelOverlay.$; _this.xf = new CategoryFrame(3); _this.xh = new CategoryFrame(3); _this.xd = new CategoryFrame(3); return _this; } PriceChannelOverlay.prototype.bk = function () { return new PriceChannelOverlay(); }; PriceChannelOverlay.prototype.rc = function (a, b, c, d) { switch (b) { case "HighColumn": case "LowColumn": this.aa5 = false; break; } _super.prototype.rc.call(this, a, b, c, d); switch (b) { case PriceChannelOverlay.$$p[0]: this.aa5 = false; this.ru(false); break; } }; PriceChannelOverlay.prototype.hf = function (a, b, c) { var d = _super.prototype.hf.call(this, a, b, c); if (this.x5 == null || this.x6 == null) { d = false; } return d; }; PriceChannelOverlay.prototype.aa6 = function () { this.abc.clear(); this.abb.clear(); var a = truncate(MathUtil.d(this.abd, 0, this.dp.count)); var b = Math.min(this.x5.count, this.x6.count); var c = this.yv(this.x5); var d = this.yv(this.x6); 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.abc.add(g); this.abb.add(h); } return true; }; PriceChannelOverlay.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 = new ScalerParams(0, c, d, this.xb.ch, e); var g = new ScalerParams(0, c, d, this.xu.ch, e); g.b = this.iz(); var h = this.xb; var i = this.xu; a.h.clear(); a.p.clear(); a.s.clear(); var j = 0; var k = typeCast(ISortingAxis_$type, this.xb); if (k != null && k.i$b.count != this.dp.count) { return; } j = this.y2(c, d, e); if (!this.aa5) { this.aa5 = this.aa6(); } g.b = this.iz(); var l = this.xb.eo(2, f) - this.xb.eo(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.abc._inner[m]; var r = this.abb._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.abc._inner[m]); t = Math.min(r, this.abb._inner[m]); } if (!isInfinity(t) && !isInfinity(s)) { var v = NaN; if (!isNaN_(p)) { v = this.xb.el(p, f); } n = [v, t, s]; } else { n = [NaN, NaN, NaN]; } } var w = Math.max(1, l); if (!isNaN_(n[0]) && m * w >= this.aa7) { if (this.xb != null && typeCast(ISortingAxis_$type, this.xb) !== null) { n[0] = n[0] + j; } else { n[0] = h.el(n[0], f) + j; } n[1] = i.el(n[1], g); n[2] = i.el(n[2], g); a.h.add(n); } } }; PriceChannelOverlay.prototype.o7 = function (a, b) { _super.prototype.o7.call(this, a, b); var c = b; if (c != null) { c.ck(); } }; PriceChannelOverlay.prototype.aaj = function (a, b) { _super.prototype.aaj.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.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[e_1 - 1 - j][2]; }; c.cl(e_1, f, g, h, i); b.ci(a); } this.xk.a2(this, this.yj(), runOn(this, this.w3), this.y8(b), this.za(b)); var j = false; var k = this.xk.b; var l = a.h; var m = this.dp.count; if (k != null) { j = true; } if (j) { var n = new ScalerParams(0, b.ca, b.b9, this.xb.ch, d); this.aag(l, -1, m, this.xb, n, b.t, -1); } var o = c.cr; var p = c.cs; var q = c.cn; this.xk.ad(o, true, false, true, true); this.xk.ad(p, true, false, true, true); this.xk.ad(q, false, true, false, false); q._opacity = this.xk.j * this.ia; }; PriceChannelOverlay.prototype.ct = function () { return new PriceChannelOverlayView(this); }; PriceChannelOverlay.prototype.q3 = function (a) { _super.prototype.q3.call(this, a); this.aba = typeCast(PriceChannelOverlayView.$, a); }; PriceChannelOverlay.prototype.i6 = function (a, b, c) { if (this.dc == null) { return NaN; } var d = this.getEffectiveViewport1(this.cw); var e = new ScalerParams(0, this.dc.wt, this.cw.b9, this.xb.ch, d); var f = this.y2(this.dc.wt, this.cw.b9, d); return this.i8(new RangeValueList(this.abc, this.abb), a, this.xb, e, f, runOn(this, this.y1), b, c); }; PriceChannelOverlay.prototype.j9 = function (a, b) { if (this.abc == null || this.abb == null) { return _super.prototype.j9.call(this, a, b); } return this.ka(a, b, this.xb, runOn(this, this.y1), new RangeValueList(this.abc, this.abb)); }; PriceChannelOverlay.prototype.kb = function (a, b) { if (this.abc == null || this.abb == null) { return _super.prototype.kb.call(this, a, b); } return this.kc(a, b, this.xb, runOn(this, this.y1), new RangeValueList(this.abc, this.abb)); }; PriceChannelOverlay.prototype.iz = function () { return Series.i1(this.abb, null); }; PriceChannelOverlay.$t = markType(PriceChannelOverlay, 'PriceChannelOverlay', FinancialOverlay.$); PriceChannelOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, PriceChannelOverlay, 'raisePropertyChanged', ['Period:abd:abf', [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.abc._inner[g]) && !isNaN_(this.f.cj.abb._inner[g])) { d = Math.max(d, this.f.cj.abc._inner[g]); e = Math.min(e, this.f.cj.abb._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.ie))), _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.ie))), _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.ig + 3; this.cq._stroke = a; this.cq.ad = this.f.ig + 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 };