UNPKG

igniteui-react-charts

Version:

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

365 lines (364 loc) 13.2 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 { 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 */ export let PriceChannelOverlay = /*@__PURE__*/ (() => { class PriceChannelOverlay extends FinancialOverlay { bk() { return new PriceChannelOverlay(); } constructor() { super(); this.abi = new List$1(Number_$type, 0); this.abh = new List$1(Number_$type, 0); this.ab = PriceChannelOverlay.$; this.xl = new CategoryFrame(3); this.xn = new CategoryFrame(3); this.xj = new CategoryFrame(3); } rh(a, b, c, d) { switch (b) { case "HighColumn": case "LowColumn": this.abb = false; break; } super.rh(a, b, c, d); switch (b) { case PriceChannelOverlay.$$p[0]: this.abb = false; this.rz(false); break; } } hf(a, b, c) { let d = super.hf(a, b, c); if (this.yb == null || this.yc == null) { d = false; } return d; } abc() { this.abi.clear(); this.abh.clear(); let a = truncate(MathUtil.d(this.abj, 0, this.dp.count)); let b = Math.min(this.yb.count, this.yc.count); let c = this.y1(this.yb); let d = this.y1(this.yc); for (let e = 0; e < b; e++) { let f = Math.min(a, e); let g = -1.7976931348623157E+308; let h = 1.7976931348623157E+308; for (let 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.abi.add(g); this.abh.add(h); } return true; } aan(a, b) { super.aan(a, b); let c = b.ca; let d = b.b9; let e = this.getEffectiveViewport1(b); let f = new ScalerParams(0, c, d, this.xh.df, e); let g = new ScalerParams(0, c, d, this.x0.df, e); g.b = this.i0(); let h = this.xh; let i = this.x0; a.h.clear(); a.p.clear(); a.s.clear(); let j = 0; let k = typeCast(ISortingAxis_$type, this.xh); if (k != null && k.i$b.count != this.dp.count) { return; } j = this.y8(c, d, e); if (!this.abb) { this.abb = this.abc(); } g.b = this.i0(); let l = this.xh.fw(2, f) - this.xh.fw(1, f); for (let m = b.cd.c; m <= b.cd.d; ++m) { let n; if (k == null) { n = b.cd.getBucket(m); } else { let o = k.i$b._inner[m]; let p = k.i$d(o); let q = this.abi._inner[m]; let r = this.abh._inner[m]; let s = q; let t = r; let 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.abi._inner[m]); t = Math.min(r, this.abh._inner[m]); } if (!isInfinity(t) && !isInfinity(s)) { let v = NaN; if (!isNaN_(p)) { v = this.xh.ft(p, f); } n = [v, t, s]; } else { n = [NaN, NaN, NaN]; } } let w = Math.max(1, l); if (!isNaN_(n[0]) && m * w >= this.abd) { if (this.xh != null && typeCast(ISortingAxis_$type, this.xh) !== null) { n[0] = n[0] + j; } else { n[0] = h.ft(n[0], f) + j; } n[1] = i.ft(n[1], g); n[2] = i.ft(n[2], g); a.h.add(n); } } } pb(a, b) { super.pb(a, b); let c = b; if (c != null) { c.ck(); } } aap(a, b) { super.aap(a, b); let c = typeCast(PriceChannelOverlayView.$, b); if (c == null) { return; } let d = this.getEffectiveViewport1(b); if (b.cg(a)) { c.ck(); let e = a.h.count; let f = (g) => a.h._inner[g][0]; let g = (h) => a.h._inner[e - 1 - h][0]; let h = (i) => a.h._inner[i][1]; let i = (j) => a.h._inner[e - 1 - j][2]; c.cl(e, f, g, h, i); b.ci(a); } this.xq.a2(this, this.yp(), runOn(this, this.w9), this.ze(b), this.zg(b)); let j = false; let k = this.xq.b; let l = a.h; let m = this.dp.count; if (k != null) { j = true; } if (j) { let n = new ScalerParams(0, b.ca, b.b9, this.xh.df, d); this.aam(l, -1, m, this.xh, n, b.t, -1); } let o = c.cr; let p = c.cs; let q = c.cn; this.xq.ad(o, true, false, true, true); this.xq.ad(p, true, false, true, true); this.xq.ad(q, false, true, false, false); q._opacity = this.xq.j * this.ia; } ct() { return new PriceChannelOverlayView(this); } q8(a) { super.q8(a); this.abg = typeCast(PriceChannelOverlayView.$, a); } i8(a, b, c) { if (this.dc == null) { return NaN; } let d = this.getEffectiveViewport1(this.cw); let e = new ScalerParams(0, this.dc.xn, this.cw.b9, this.xh.df, d); let f = this.y8(this.dc.xn, this.cw.b9, d); return this.ja(new RangeValueList(this.abi, this.abh), a, this.xh, e, f, runOn(this, this.y7), b, c); } kc(a, b) { if (this.abi == null || this.abh == null) { return super.kc(a, b); } return this.kd(a, b, this.xh, runOn(this, this.y7), new RangeValueList(this.abi, this.abh)); } ke(a, b) { if (this.abi == null || this.abh == null) { return super.ke(a, b); } return this.kf(a, b, this.xh, runOn(this, this.y7), new RangeValueList(this.abi, this.abh)); } i0() { return Series.i2(this.abh, null); } } PriceChannelOverlay.$t = /*@__PURE__*/ markType(PriceChannelOverlay, 'PriceChannelOverlay', FinancialOverlay.$); PriceChannelOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, PriceChannelOverlay, 'raisePropertyChanged', ['Period:abj:abl', [1, 14]]); return PriceChannelOverlay; })(); /** * @hidden */ export let PriceChannelBucketCalculator = /*@__PURE__*/ (() => { class PriceChannelBucketCalculator extends FinancialBucketCalculator { constructor(a) { super(a); this.f = null; this.f = a; } getBucket(a) { let b = a * this.b; let c = Math.min(b + this.b - 1, this.a.cf.dp.count - 1); if (b <= c) { let d = -1.7976931348623157E+308; let e = 1.7976931348623157E+308; let f = 0; for (let g = b; g <= c; ++g) { if (!isNaN_(this.f.cj.abi._inner[g]) && !isNaN_(this.f.cj.abh._inner[g])) { d = Math.max(d, this.f.cj.abi._inner[g]); e = Math.min(e, this.f.cj.abh._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 = /*@__PURE__*/ markType(PriceChannelBucketCalculator, 'PriceChannelBucketCalculator', FinancialBucketCalculator.$); return PriceChannelBucketCalculator; })(); /** * @hidden */ export let PriceChannelOverlayView = /*@__PURE__*/ (() => { class PriceChannelOverlayView extends FinancialSeriesView { get cn() { return this.co; } get cr() { return this.ct; } get cs() { return this.cu; } constructor(a) { super(a); 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; } a4() { super.a4(); if (!this.t) { } } ce() { return new PriceChannelBucketCalculator(this); } ck() { this.co.an.clear(); this.ct.an.clear(); this.cu.an.clear(); this.a2(); } cl(a, b, c, d, e) { for (let f of fromEnum(Flattener.d(a, b, d, this.f.ie))) { 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) }); } for (let g of fromEnum(Flattener.d(a, c, e, this.f.ie))) { 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) }); } this.a2(); } bq() { super.bq(); this.cm.an = this.co.an; this.cp.an = this.ct.an; this.cq.an = this.cu.an; let 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; } bj(a, b) { super.bj(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); } } } ax(a) { super.ax(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 = /*@__PURE__*/ markType(PriceChannelOverlayView, 'PriceChannelOverlayView', FinancialSeriesView.$); return PriceChannelOverlayView; })();