UNPKG

igniteui-react-charts

Version:

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

504 lines (503 loc) 16.6 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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries"; import { Brush } from "igniteui-react-core"; import { DependencyProperty } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay"; import { runOn, delegateCombine, markType, markDep, fromEnum } from "igniteui-react-core"; import { Defaults } from "./Defaults"; import { Rect } from "igniteui-react-core"; import { Pool$1 } from "igniteui-react-core"; import { Rectangle } from "igniteui-react-core"; import { ArrayExtension } from "igniteui-react-core"; import { ScalerParams } from "./ScalerParams"; import { ChartSelection } from "./ChartSelection"; import { PropertyMetadata } from "igniteui-react-core"; import { truncate, isNaN_ } from "igniteui-react-core"; import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView"; import { BrushUtil } from "igniteui-react-core"; /** * @hidden */ export let WaterfallSeries = /*@__PURE__*/ (() => { class WaterfallSeries extends HorizontalAnchoredCategorySeries { bk() { return new WaterfallSeries(); } get_f7() { return true; } get_fm() { return true; } hu() { let a = super.hu(); { let b = ((() => { let $ret = new SeriesLayerPropertyOverlay(); $ret.r = true; $ret.ad = "NegativeBrush"; $ret.p = true; $ret.q = true; return $ret; })()); b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.r9)); a.add(b); } { let c = ((() => { let $ret = new SeriesLayerPropertyOverlay(); $ret.r = true; $ret.ad = "NegativeOutline"; $ret.p = true; $ret.q = true; return $ret; })()); c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.r9)); a.add(c); } return a; } jn() { if (!isNaN_(this.jm)) { return super.jn(); } return Defaults.h; } get_fc() { return true; } ct() { return new WaterfallSeriesView(this); } q8(a) { super.q8(a); this.ac9 = a; } constructor() { super(); this.ab = WaterfallSeries.$; } preferredCategoryMode(a) { return 2; } get_fn() { return true; } sc(a, b) { super.sc(a, b); this.adk = a; this.adl = b; } v7() { return this.adk; } v8() { return this.adl; } cz() { if (this.c0 == 0) { return 2; } return super.cz(); } get_ef() { return true; } rh(a, b, c, d) { super.rh(a, b, c, d); switch (b) { case WaterfallSeries.$$p[3]: case WaterfallSeries.$$p[2]: case WaterfallSeries.$$p[0]: case WaterfallSeries.$$p[1]: this.rz(false); break; } } gx(a, b) { if (this.g0(a, b)) { return true; } if (this.xs(a, b)) { return true; } return false; } wy(a) { if (this.ac9 == null || this.ac9.du == null || this.ac9.du.count == 0 || this.xAxis == null) { return Rect.empty; } let b = this.ac9.du; let c = this.wi(a); let d = -1; let e = this.xAxis.df; let f = this.w3.right * 2; if (e) { d = ArrayExtension.binarySearch$1(Rectangle.$, b, (g) => { let h = this.ac9.d1(g); return (f - c.x) < (f - (h.left + h.width / 2)) ? -1 : ((f - c.x) > (f - (h.left + h.width / 2)) ? 1 : 0); }); } else { d = ArrayExtension.binarySearch$1(Rectangle.$, b, (g) => { let h = this.ac9.d1(g); return c.x < (h.left + h.width / 2) ? -1 : (c.x > (h.left + h.width / 2) ? 1 : 0); }); } if (d < 0) { d = ~d; d--; } if (d < 0) { d = 0; } if (d > b.count - 1) { d = b.count - 1; } let g = d; let h = d; if (g < 0) { g--; } if (h < b.count - 1) { h++; } let i = this.adm(g); let j = this.adm(d); let k = this.adm(h); let l = i.left + i.width / 2; let m = j.left + j.width / 2; let n = k.left + k.width / 2; let o = Math.abs(l - c.x); let p = Math.abs(m - c.x); let q = Math.abs(n - c.x); let r = i.containsPoint(c); let s = j.containsPoint(c); let t = k.containsPoint(c); if (p <= o && p <= q) { if (!e && t) { return k; } if (e && r) { return i; } return j; } if (o <= p && o <= q) { if (!e && s) { return j; } return i; } if (q <= p && q <= o) { if (e && s) { return j; } return k; } return Rect.empty; } adm(a) { return this.ac9.d0(a); } zf() { return 1; } pb(a, b) { super.pb(a, b); this.ac9.du.count = 0; } get_abo() { return 1; } iy() { return this.acq.ou(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)); } aay(a, b) { let c = b; super.aay(a, b); let d = b.ca; let e = b.b9; let f = this.getEffectiveViewport1(b); let g = this.acq.ou(d, e, f); let h = this.ada; let i = this.adb; let j; let k = this.abm(b); let l = NaN; let m = c.du; let n; let o = 0; this.zd.a2(this, this.zx(), runOn(this, this.yx), this.z6(b), this.z7(b)); this.zd.r = this.ada; this.zd.s = this.adb; this.zd.k = this.ada; this.zd.l = this.adb; let p = false; let q = this.zd.b; if (q != null) { p = true; } let r = this.acq.dm; let s = this.valueColumn.count; let t = a.h; let u = this.acq; let v = new ScalerParams(0, d, e, this.acq.df, f); let w = this.vk; let x = this.adk; let y = this.vo; let z = this.adl || y; if (a.h.count > 0) { j = a.h._inner[0][0] - 0.5 * g; let aa = a.h._inner[0][1]; if (!isNaN_(aa)) { if (aa > k) { n = m.item(o); o++; c.dz(n, j, k); n.width = g; n.height = Math.abs(k - aa); this.zd.ak = x; this.zd.ag = x; this.zd.al = z; this.zd.ah = z; this.zd.f = true; let ab = this.zd.aw(s, 0)[0]; if (r && a.o != null && 0 < a.o.count) { ab = truncate(Math.round(a.o._inner[0])); } if (p) { this.aau(t, 0, s, u, v, b.t, ab); } this.zd.ad(n, false, false, false, false); n.ap = this.zd.k; n.aq = this.zd.l; } else { n = m.item(o); o++; c.dz(n, j, aa); n.width = g; n.height = Math.abs(aa - k); this.zd.ak = w; this.zd.ag = w; this.zd.al = y; this.zd.ah = y; this.zd.f = false; let ac = this.zd.aw(s, o)[0]; if (r && a.o != null && o >= 0 && o < a.o.count) { ac = truncate(Math.round(a.o._inner[o])); } if (p) { this.aau(t, 0, s, u, v, b.t, ac); } this.zd.ad(n, false, false, false, false); n.ap = this.zd.k; n.aq = this.zd.l; } l = aa; } else { l = k; } } for (let ad = 1; ad < a.h.count; ++ad) { let ae = a.h._inner[ad]; j = a.h._inner[ad][0] - 0.5 * g; let af = ae[1]; if (!isNaN_(af)) { n = m.item(o); o++; c.dz(n, j, Math.min(l, af)); n.width = g; n.height = Math.abs(l - af); this.zd.ak = w; this.zd.ag = w; this.zd.al = y; this.zd.ah = y; this.zd.f = false; let ag = this.zd.aw(s, o)[0]; if (r && a.o != null && o >= 0 && o < a.o.count) { ag = truncate(Math.round(a.o._inner[o])); } if (l > af) { if (p) { this.aau(t, ad, s, u, v, b.t, ag); } } else { this.zd.ak = x; this.zd.ag = x; this.zd.al = z; this.zd.ah = z; this.zd.f = true; if (p) { this.aau(t, ad, s, u, v, b.t, ag); } } this.zd.ad(n, false, false, false, false); n.ap = this.zd.k; n.aq = this.zd.l; l = af; } } m.count = o; b.dg(a); } qa(a, b, c) { this.aaq(a, b, c, this.y4, 1); } ak(a, b) { let c = new List$1(ChartSelection.$, 0); this.qa(a, c, b); return c.toArray(); } abh(a, b, c) { if (c == 0) { return 0 < b && a < this.valueColumn.item(c); } else { let d = this.valueColumn.item(c - 1); let e = Math.min(d, this.valueColumn.item(c)); let f = Math.max(d, this.valueColumn.item(c)); return e < b && a < f; } } get useHighMarkerFidelity() { return this.z1; } } WaterfallSeries.$t = /*@__PURE__*/ markType(WaterfallSeries, 'WaterfallSeries', HorizontalAnchoredCategorySeries.$); WaterfallSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, WaterfallSeries, 'raisePropertyChanged', ['NegativeBrush:adk:adg', [Brush.$, null], 'NegativeOutline:adl:adh', [Brush.$, null], 'RadiusX:ada:adi', [1, 0], 'RadiusY:adb:adj', [1, 0]]); return WaterfallSeries; })(); /** * @hidden */ export let WaterfallSeriesView = /*@__PURE__*/ (() => { class WaterfallSeriesView extends AnchoredCategorySeriesView { a4() { super.a4(); this.dv = new List$1(Rectangle.$, 0); if (!this.t) { this.dt.xl = Defaults.c; this.dt.jt = Defaults.i; this.dt.adk = Defaults.financialSeries_NegativeBrush; this.dt.adl = Defaults.financialSeries_NegativeOutline; } } constructor(a) { super(a); this.dt = null; this.dv = null; this.d2 = new Rectangle(); this.du = null; this.dt = a; this.du = ((() => { let $ret = new Pool$1(Rectangle.$); $ret.create = runOn(this, this.d3); $ret.activate = runOn(this, this.dw); $ret.disactivate = runOn(this, this.dy); $ret.destroy = runOn(this, this.dx); return $ret; })()); } d3() { let a = new Rectangle(); this.dv.add(a); a._visibility = 1; return a; } dw(a) { a._visibility = 0; } dy(a) { a._visibility = 1; } dx(a) { this.dv.remove(a); } dz(a, b, c) { let d = false; if (a.o != c) { d = true; a.o = c; } if (a.n != b) { d = true; a.n = b; } if (d) { this.a2(); } } ak(a) { return this.dv._inner[a]; } aj(a) { let b = this.dv._inner[a]; this.d2._visibility = b._visibility; this.d2.n = b.n; this.d2.o = b.o; this.d2.width = b.width; this.d2.height = b.height; let c = this.b4(a); this.d2._fill = c; this.d2._stroke = c; this.d2.ad = this.f.ig + 3; return this.d2; } bj(a, b) { super.bj(a, b); if (a.d) { for (let c = 0; c < this.dv.count; c++) { let d = this.ai(c, b); this.br(d, c, b); a.w(d); } } } ax(a) { super.ax(a); let b = 0; let c = new List$1(Rectangle.$, 0); for (let d of fromEnum(this.du.a)) { c.add(d); } c.aa((e, f) => { if (e.n < f.n) { return -1; } else if (e.n > f.n) { return 1; } else { return 0; } }); for (let e of fromEnum(c)) { let f = "Negative"; if (BrushUtil.d(e._fill, this.f.vk)) { f = "Positive"; } this.f.bc.exportRectangleData(a, e, "column" + b, ["Main", f]); } b++; } d0(a) { let b = this.du.item(a); return new Rect(0, b.n, b.o, b.width, b.height); } d1(a) { return new Rect(0, a.n, a.o, a.width, a.height); } } WaterfallSeriesView.$t = /*@__PURE__*/ markType(WaterfallSeriesView, 'WaterfallSeriesView', AnchoredCategorySeriesView.$); return WaterfallSeriesView; })();