UNPKG

igniteui-react-charts

Version:

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

545 lines (544 loc) 17.9 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 { 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 */ var WaterfallSeries = /** @class */ /*@__PURE__*/ (function (_super) { __extends(WaterfallSeries, _super); function WaterfallSeries() { var _this = _super.call(this) || this; _this.ab = WaterfallSeries.$; return _this; } WaterfallSeries.prototype.bk = function () { return new WaterfallSeries(); }; WaterfallSeries.prototype.get_f7 = function () { return true; }; WaterfallSeries.prototype.get_fm = function () { return true; }; WaterfallSeries.prototype.hu = function () { var a = _super.prototype.hu.call(this); { var b = ((function () { var $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); } { var c = ((function () { var $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; }; WaterfallSeries.prototype.jn = function () { if (!isNaN_(this.jm)) { return _super.prototype.jn.call(this); } return Defaults.h; }; WaterfallSeries.prototype.get_fc = function () { return true; }; WaterfallSeries.prototype.ct = function () { return new WaterfallSeriesView(this); }; WaterfallSeries.prototype.q8 = function (a) { _super.prototype.q8.call(this, a); this.ac9 = a; }; WaterfallSeries.prototype.preferredCategoryMode = function (a) { return 2; }; WaterfallSeries.prototype.get_fn = function () { return true; }; WaterfallSeries.prototype.sc = function (a, b) { _super.prototype.sc.call(this, a, b); this.adk = a; this.adl = b; }; WaterfallSeries.prototype.v7 = function () { return this.adk; }; WaterfallSeries.prototype.v8 = function () { return this.adl; }; WaterfallSeries.prototype.cz = function () { if (this.c0 == 0) { return 2; } return _super.prototype.cz.call(this); }; WaterfallSeries.prototype.get_ef = function () { return true; }; WaterfallSeries.prototype.rh = function (a, b, c, d) { _super.prototype.rh.call(this, 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; } }; WaterfallSeries.prototype.gx = function (a, b) { if (this.g0(a, b)) { return true; } if (this.xs(a, b)) { return true; } return false; }; WaterfallSeries.prototype.wy = function (a) { var _this = this; if (this.ac9 == null || this.ac9.du == null || this.ac9.du.count == 0 || this.xAxis == null) { return Rect.empty; } var b = this.ac9.du; var c = this.wi(a); var d = -1; var e = this.xAxis.df; var f = this.w3.right * 2; if (e) { d = ArrayExtension.binarySearch$1(Rectangle.$, b, function (g) { var 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, function (g) { var 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; } var g = d; var h = d; if (g < 0) { g--; } if (h < b.count - 1) { h++; } var i = this.adm(g); var j = this.adm(d); var k = this.adm(h); var l = i.left + i.width / 2; var m = j.left + j.width / 2; var n = k.left + k.width / 2; var o = Math.abs(l - c.x); var p = Math.abs(m - c.x); var q = Math.abs(n - c.x); var r = i.containsPoint(c); var s = j.containsPoint(c); var 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; }; WaterfallSeries.prototype.adm = function (a) { return this.ac9.d0(a); }; WaterfallSeries.prototype.zf = function () { return 1; }; WaterfallSeries.prototype.pb = function (a, b) { _super.prototype.pb.call(this, a, b); this.ac9.du.count = 0; }; WaterfallSeries.prototype.get_abo = function () { return 1; }; WaterfallSeries.prototype.iy = function () { return this.acq.ou(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)); }; WaterfallSeries.prototype.aay = function (a, b) { var c = b; _super.prototype.aay.call(this, a, b); var d = b.ca; var e = b.b9; var f = this.getEffectiveViewport1(b); var g = this.acq.ou(d, e, f); var h = this.ada; var i = this.adb; var j; var k = this.abm(b); var l = NaN; var m = c.du; var n; var 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; var p = false; var q = this.zd.b; if (q != null) { p = true; } var r = this.acq.dm; var s = this.valueColumn.count; var t = a.h; var u = this.acq; var v = new ScalerParams(0, d, e, this.acq.df, f); var w = this.vk; var x = this.adk; var y = this.vo; var z = this.adl || y; if (a.h.count > 0) { j = a.h._inner[0][0] - 0.5 * g; var 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; var 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; var 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 (var ad = 1; ad < a.h.count; ++ad) { var ae = a.h._inner[ad]; j = a.h._inner[ad][0] - 0.5 * g; var 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; var 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); }; WaterfallSeries.prototype.qa = function (a, b, c) { this.aaq(a, b, c, this.y4, 1); }; WaterfallSeries.prototype.ak = function (a, b) { var c = new List$1(ChartSelection.$, 0); this.qa(a, c, b); return c.toArray(); }; WaterfallSeries.prototype.abh = function (a, b, c) { if (c == 0) { return 0 < b && a < this.valueColumn.item(c); } else { var d = this.valueColumn.item(c - 1); var e = Math.min(d, this.valueColumn.item(c)); var f = Math.max(d, this.valueColumn.item(c)); return e < b && a < f; } }; Object.defineProperty(WaterfallSeries.prototype, "useHighMarkerFidelity", { get: function () { return this.z1; }, enumerable: false, configurable: true }); WaterfallSeries.$t = markType(WaterfallSeries, 'WaterfallSeries', HorizontalAnchoredCategorySeries.$); WaterfallSeries.$$p = 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; }(HorizontalAnchoredCategorySeries)); export { WaterfallSeries }; /** * @hidden */ var WaterfallSeriesView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(WaterfallSeriesView, _super); function WaterfallSeriesView(a) { var _this = _super.call(this, a) || this; _this.dt = null; _this.dv = null; _this.d2 = new Rectangle(); _this.du = null; _this.dt = a; _this.du = ((function () { var $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; })()); return _this; } WaterfallSeriesView.prototype.a4 = function () { _super.prototype.a4.call(this); 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; } }; WaterfallSeriesView.prototype.d3 = function () { var a = new Rectangle(); this.dv.add(a); a._visibility = 1; return a; }; WaterfallSeriesView.prototype.dw = function (a) { a._visibility = 0; }; WaterfallSeriesView.prototype.dy = function (a) { a._visibility = 1; }; WaterfallSeriesView.prototype.dx = function (a) { this.dv.remove(a); }; WaterfallSeriesView.prototype.dz = function (a, b, c) { var d = false; if (a.o != c) { d = true; a.o = c; } if (a.n != b) { d = true; a.n = b; } if (d) { this.a2(); } }; WaterfallSeriesView.prototype.ak = function (a) { return this.dv._inner[a]; }; WaterfallSeriesView.prototype.aj = function (a) { var 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; var c = this.b4(a); this.d2._fill = c; this.d2._stroke = c; this.d2.ad = this.f.ig + 3; return this.d2; }; WaterfallSeriesView.prototype.bj = function (a, b) { _super.prototype.bj.call(this, a, b); if (a.d) { for (var c = 0; c < this.dv.count; c++) { var d = this.ai(c, b); this.br(d, c, b); a.w(d); } } }; WaterfallSeriesView.prototype.ax = function (a) { var e_1, _a, e_2, _b; _super.prototype.ax.call(this, a); var b = 0; var c = new List$1(Rectangle.$, 0); try { for (var _c = __values(fromEnum(this.du.a)), _d = _c.next(); !_d.done; _d = _c.next()) { var d = _d.value; c.add(d); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } c.aa(function (e, f) { if (e.n < f.n) { return -1; } else if (e.n > f.n) { return 1; } else { return 0; } }); try { for (var _e = __values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) { var e = _f.value; var f = "Negative"; if (BrushUtil.d(e._fill, this.f.vk)) { f = "Positive"; } this.f.bc.exportRectangleData(a, e, "column" + b, ["Main", f]); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_2) throw e_2.error; } } b++; }; WaterfallSeriesView.prototype.d0 = function (a) { var b = this.du.item(a); return new Rect(0, b.n, b.o, b.width, b.height); }; WaterfallSeriesView.prototype.d1 = function (a) { return new Rect(0, a.n, a.o, a.width, a.height); }; WaterfallSeriesView.$t = markType(WaterfallSeriesView, 'WaterfallSeriesView', AnchoredCategorySeriesView.$); return WaterfallSeriesView; }(AnchoredCategorySeriesView)); export { WaterfallSeriesView };