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.abt = new List$1(Number_$type, 0); this.abs = new List$1(Number_$type, 0); this.ab = PriceChannelOverlay.$; this.xw = new CategoryFrame(3); this.xy = new CategoryFrame(3); this.xu = new CategoryFrame(3); } rr(a, b, c, d) { switch (b) { case "HighColumn": case "LowColumn": this.abm = false; break; } super.rr(a, b, c, d); switch (b) { case PriceChannelOverlay.$$p[0]: this.abm = false; this.r9(false); break; } } hl(a, b, c) { let d = super.hl(a, b, c); if (this.ym == null || this.yn == null) { d = false; } return d; } abn() { this.abt.clear(); this.abs.clear(); let a = truncate(MathUtil.e(this.abu, 0, this.dp.count)); let b = Math.min(this.ym.count, this.yn.count); let c = this.zc(this.ym); let d = this.zc(this.yn); 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.abt.add(g); this.abs.add(h); } return true; } aay(a, b) { super.aay(a, b); let c = b.ca; let d = b.b9; let e = this.getEffectiveViewport1(b); let f = new ScalerParams(0, c, d, this.xs.dn, e); let g = new ScalerParams(0, c, d, this.yb.dn, e); g.b = this.i6(); let h = this.xs; let i = this.yb; a.k.clear(); a.s.clear(); a.v.clear(); let j = 0; let k = typeCast(ISortingAxis_$type, this.xs); if (k != null && k.i$b.count != this.dp.count) { return; } j = this.zj(c, d, e); if (!this.abm) { this.abm = this.abn(); } g.b = this.i6(); let l = this.xs.ga(2, f) - this.xs.ga(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.abt._inner[m]; let r = this.abs._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.abt._inner[m]); t = Math.min(r, this.abs._inner[m]); } if (!isInfinity(t) && !isInfinity(s)) { let v = NaN; if (!isNaN_(p)) { v = this.xs.f7(p, f); } n = [v, t, s]; } else { n = [NaN, NaN, NaN]; } } let w = Math.max(1, l); if (!isNaN_(n[0]) && m * w >= this.abo) { if (this.xs != null && typeCast(ISortingAxis_$type, this.xs) !== null) { n[0] = n[0] + j; } else { n[0] = h.f7(n[0], f) + j; } n[1] = i.f7(n[1], g); n[2] = i.f7(n[2], g); a.k.add(n); } } } pj(a, b) { super.pj(a, b); let c = b; if (c != null) { c.ck(); } } aa0(a, b) { super.aa0(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.k.count; let f = (g) => a.k._inner[g][0]; let g = (h) => a.k._inner[e - 1 - h][0]; let h = (i) => a.k._inner[i][1]; let i = (j) => a.k._inner[e - 1 - j][2]; c.cl(e, f, g, h, i); b.ci(a); } this.x1.a2(this, this.y0(), runOn(this, this.xk), this.zp(b), this.zr(b)); let j = false; let k = this.x1.b; let l = a.k; let m = this.dp.count; if (k != null) { j = true; } if (j) { let n = new ScalerParams(0, b.ca, b.b9, this.xs.dn, d); this.aax(l, -1, m, this.xs, n, b.t, -1); } let o = c.cr; let p = c.cs; let q = c.cn; this.x1.ad(o, true, false, true, true); this.x1.ad(p, true, false, true, true); this.x1.ad(q, false, true, false, false); q._opacity = this.x1.j * this.ih; } ct() { return new PriceChannelOverlayView(this); } ri(a) { super.ri(a); this.abr = typeCast(PriceChannelOverlayView.$, a); } je(a, b, c) { if (this.dc == null) { return NaN; } let d = this.getEffectiveViewport1(this.cw); let e = new ScalerParams(0, this.dc.ys, this.cw.b9, this.xs.dn, d); let f = this.zj(this.dc.ys, this.cw.b9, d); return this.jg(new RangeValueList(this.abt, this.abs), a, this.xs, e, f, runOn(this, this.zi), b, c); } ki(a, b) { if (this.abt == null || this.abs == null) { return super.ki(a, b); } return this.kj(a, b, this.xs, runOn(this, this.zi), new RangeValueList(this.abt, this.abs)); } kk(a, b) { if (this.abt == null || this.abs == null) { return super.kk(a, b); } return this.kl(a, b, this.xs, runOn(this, this.zi), new RangeValueList(this.abt, this.abs)); } i6() { return Series.i8(this.abs, null); } } PriceChannelOverlay.$t = /*@__PURE__*/ markType(PriceChannelOverlay, 'PriceChannelOverlay', FinancialOverlay.$); PriceChannelOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, PriceChannelOverlay, 'raisePropertyChanged', ['Period:abu:abw', [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.abt._inner[g]) && !isNaN_(this.f.cj.abs._inner[g])) { d = Math.max(d, this.f.cj.abt._inner[g]); e = Math.min(e, this.f.cj.abs._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.il))) { 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.il))) { 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.im + 3; this.cq._stroke = a; this.cq.ad = this.f.im + 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; })();