UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

504 lines (503 loc) 17.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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries"; import { Brush } from "igniteui-angular-core"; import { DependencyProperty } from "igniteui-angular-core"; import { List$1 } from "igniteui-angular-core"; import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay"; import { runOn, delegateCombine, markType, markDep, fromEnum } from "igniteui-angular-core"; import { Defaults } from "./Defaults"; import { Rect } from "igniteui-angular-core"; import { Pool$1 } from "igniteui-angular-core"; import { Rectangle } from "igniteui-angular-core"; import { ArrayExtension } from "igniteui-angular-core"; import { ScalerParams } from "./ScalerParams"; import { ChartSelection } from "./ChartSelection"; import { PropertyMetadata } from "igniteui-angular-core"; import { truncate, isNaN_ } from "igniteui-angular-core"; import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView"; import { BrushUtil } from "igniteui-angular-core"; /** * @hidden */ export let WaterfallSeries = /*@__PURE__*/ (() => { class WaterfallSeries extends HorizontalAnchoredCategorySeries { constructor() { super(); this.ab = WaterfallSeries.$; } bk() { return new WaterfallSeries(); } get_gc() { return true; } get_fo() { return true; } hz() { let a = super.hz(); { 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.sh)); 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.sh)); a.add(c); } return a; } js() { if (!isNaN_(this.jr)) { return super.js(); } return Defaults.h; } get_fe() { return true; } ct() { return new WaterfallSeriesView(this); } rg(a) { super.rg(a); this.adi = a; } preferredCategoryMode(a) { return 2; } get_fp() { return true; } sk(a, b) { super.sk(a, b); this.adt = a; this.adu = b; } wf() { return this.adt; } wg() { return this.adu; } cz() { if (this.c0 == 0) { return 2; } return super.cz(); } get_ef() { return true; } rp(a, b, c, d) { super.rp(a, b, c, d); switch (b) { case WaterfallSeries.$$p[3]: case WaterfallSeries.$$p[2]: case WaterfallSeries.$$p[0]: case WaterfallSeries.$$p[1]: this.r7(false); break; } } g2(a, b) { if (this.g5(a, b)) { return true; } if (this.x1(a, b)) { return true; } return false; } w7(a) { if (this.adi == null || this.adi.du == null || this.adi.du.count == 0 || this.xAxis == null) { return Rect.empty; } let b = this.adi.du; let c = this.wq(a); let d = -1; let e = this.xAxis.dn; let f = this.xc.right * 2; if (e) { d = ArrayExtension.binarySearch$1(Rectangle.$, b, (g) => { let h = this.adi.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.adi.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.adv(g); let j = this.adv(d); let k = this.adv(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; } adv(a) { return this.adi.d0(a); } zo() { return 1; } ph(a, b) { super.ph(a, b); this.adi.du.count = 0; } get_abx() { return 1; } i3() { return this.acz.pw(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)); } aa7(a, b) { let c = b; super.aa7(a, b); let d = b.ca; let e = b.b9; let f = this.getEffectiveViewport1(b); let g = this.acz.pw(d, e, f); let h = this.adj; let i = this.adk; let j; let k = this.abv(b); let l = NaN; let m = c.du; let n; let o = 0; this.zm.a2(this, this.z6(), runOn(this, this.y6), this.aaf(b), this.aag(b)); this.zm.r = this.adj; this.zm.s = this.adk; this.zm.k = this.adj; this.zm.l = this.adk; let p = false; let q = this.zm.b; if (q != null) { p = true; } let r = this.acz.dv; let s = this.valueColumn.count; let t = a.k; let u = this.acz; let v = new ScalerParams(0, d, e, this.acz.dn, f); let w = this.vs; let x = this.adt; let y = this.vw; let z = this.adu || y; if (a.k.count > 0) { j = a.k._inner[0][0] - 0.5 * g; let aa = a.k._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.zm.ak = x; this.zm.ag = x; this.zm.al = z; this.zm.ah = z; this.zm.f = true; let ab = this.zm.aw(s, 0)[0]; if (r && a.r != null && 0 < a.r.count) { ab = truncate(Math.round(a.r._inner[0])); } if (p) { this.aa3(t, 0, s, u, v, b.t, ab); } this.zm.ad(n, false, false, false, false); n.ap = this.zm.k; n.aq = this.zm.l; } else { n = m.item(o); o++; c.dz(n, j, aa); n.width = g; n.height = Math.abs(aa - k); this.zm.ak = w; this.zm.ag = w; this.zm.al = y; this.zm.ah = y; this.zm.f = false; let ac = this.zm.aw(s, o)[0]; if (r && a.r != null && o >= 0 && o < a.r.count) { ac = truncate(Math.round(a.r._inner[o])); } if (p) { this.aa3(t, 0, s, u, v, b.t, ac); } this.zm.ad(n, false, false, false, false); n.ap = this.zm.k; n.aq = this.zm.l; } l = aa; } else { l = k; } } for (let ad = 1; ad < a.k.count; ++ad) { let ae = a.k._inner[ad]; j = a.k._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.zm.ak = w; this.zm.ag = w; this.zm.al = y; this.zm.ah = y; this.zm.f = false; let ag = this.zm.aw(s, o)[0]; if (r && a.r != null && o >= 0 && o < a.r.count) { ag = truncate(Math.round(a.r._inner[o])); } if (l > af) { if (p) { this.aa3(t, ad, s, u, v, b.t, ag); } } else { this.zm.ak = x; this.zm.ag = x; this.zm.al = z; this.zm.ah = z; this.zm.f = true; if (p) { this.aa3(t, ad, s, u, v, b.t, ag); } } this.zm.ad(n, false, false, false, false); n.ap = this.zm.k; n.aq = this.zm.l; l = af; } } m.count = o; b.dg(a); } qh(a, b, c) { this.aaz(a, b, c, this.zd, 1); } ak(a, b) { let c = new List$1(ChartSelection.$, 0); this.qh(a, c, b); return c.toArray(); } abq(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.aaa; } } WaterfallSeries.$t = markType(WaterfallSeries, 'WaterfallSeries', HorizontalAnchoredCategorySeries.$); WaterfallSeries.$$p = markDep(DependencyProperty, PropertyMetadata, WaterfallSeries, 'raisePropertyChanged', ['NegativeBrush:adt:adp', [Brush.$, null], 'NegativeOutline:adu:adq', [Brush.$, null], 'RadiusX:adj:adr', [1, 0], 'RadiusY:adk:ads', [1, 0]]); return WaterfallSeries; })(); /** * @hidden */ export let WaterfallSeriesView = /*@__PURE__*/ (() => { class WaterfallSeriesView extends AnchoredCategorySeriesView { 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; })()); } a4() { super.a4(); this.dv = new List$1(Rectangle.$, 0); if (!this.t) { this.dt.xu = Defaults.c; this.dt.jy = Defaults.i; this.dt.adt = Defaults.financialSeries_NegativeBrush; this.dt.adu = Defaults.financialSeries_NegativeOutline; } } 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.il + 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.vs)) { 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 = markType(WaterfallSeriesView, 'WaterfallSeriesView', AnchoredCategorySeriesView.$); return WaterfallSeriesView; })();