UNPKG

igniteui-react-charts

Version:

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

384 lines (383 loc) 12.7 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 { DependencyProperty } from "igniteui-react-core"; import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition"; import { Defaults } from "./Defaults"; import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-react-core"; import { Pool$1 } from "igniteui-react-core"; import { Rectangle } from "igniteui-react-core"; import { ChartSelection } from "./ChartSelection"; import { List$1 } from "igniteui-react-core"; import { ScalerParams } from "./ScalerParams"; import { PropertyMetadata } from "igniteui-react-core"; import { truncate, isNaN_, isInfinity } from "igniteui-react-core"; import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView"; /** * @hidden */ var ColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) { __extends(ColumnSeries, _super); function ColumnSeries() { var _this = _super.call(this) || this; _this.ac3 = null; _this.acy = 0; _this.ab = ColumnSeries.$; _this.ach = 2; return _this; } ColumnSeries.prototype.bk = function () { return new ColumnSeries(); }; ColumnSeries.prototype.get_e0 = function () { return true; }; ColumnSeries.prototype.get_fl = function () { return true; }; ColumnSeries.prototype.jk = function () { if (!isNaN_(this.jj)) { return _super.prototype.jk.call(this); } return Defaults.h; }; ColumnSeries.prototype.ct = function () { return new ColumnSeriesView(this); }; ColumnSeries.prototype.q1 = function (a) { _super.prototype.q1.call(this, a); this.acx = a; }; ColumnSeries.prototype.cz = function () { if (this.c0 == 0) { return 2; } return _super.prototype.cz.call(this); }; ColumnSeries.prototype.y6 = function () { return 1; }; ColumnSeries.prototype.get_ee = function () { return true; }; ColumnSeries.prototype.preferredCategoryMode = function (a) { return this.ach; }; ColumnSeries.prototype.wp = function (a) { if (this.ac3 == null) { this.ac3 = runOn(this, this.ac0); } var b = this.ack != null ? this.ack : this.yAxis; var c = this.ace; return this.aa1.c$d(this, a, c, b, this.yw, this.zx(this.cw), this.zy(this.cw), this.ac3); }; ColumnSeries.prototype.gw = function (a, b) { if (this.gz(a, b)) { return true; } if (this.xj(a, b)) { return true; } return false; }; ColumnSeries.prototype.o5 = function (a, b) { _super.prototype.o5.call(this, a, b); var c = b; if (a && c.dk != null) { c.dk.count = 0; } }; ColumnSeries.prototype.iw = function () { return this.ace.k8(this.cw.b2, this.cw.b1, this.getEffectiveViewport1(this.cw)); }; ColumnSeries.prototype.ak = function (a, b) { var c = new List$1(ChartSelection.$, 0); this.p4(a, c, b); return c.toArray(); }; ColumnSeries.prototype.p4 = function (a, b, c) { this.aae(a, b, c, this.yv, 1); }; ColumnSeries.prototype.aam = function (a, b) { _super.prototype.aam.call(this, a, b); var c = a.h; if (!b.u()) { return; } var d = b.b2; var e = b.b1; var f = this.getEffectiveViewport1(b); var g = new ScalerParams(0, d, e, this.ack.ch, f); g.b = this.iy(); var h = new ScalerParams(0, d, e, this.ace.ch, f); var i = this.ack; var j = i.el(i.me, g); var k = this.ace.k8(d, e, f); var l = this.ace; var m = b; if (isNaN_(k) || isInfinity(k)) { m.dk.count = 0; return; } this.y4.a2(this, this.zo(), runOn(this, this.yo), this.zx(b), this.zy(b)); this.y4.r = this.ac1; this.y4.s = this.ac2; this.y4.k = this.ac1; this.y4.l = this.ac2; var n = false; var o = this.y4.b; if (o != null) { n = true; } var p = this.ace.cn; var q = p ? this.ace : null; var r = this.valueColumn.count; var s = this.zx(b); var t = 0; for (var u = 0; u < c.count; ++u) { var v = c._inner[u][0] - 0.5 * k; var w = this.ac0(c._inner[u]); var x = j; w = Math.max(w, -100); x = Math.min(x, e.bottom + 100); var y = Math.abs(x - w); if (isInfinity(y) || isNaN_(y)) { continue; } var z = m.dk.item(t); t++; z.width = k; z.height = y; var aa = this.y4.aw(r, u)[0]; if (p && a.o != null && u >= 0 && u < a.o.count) { aa = truncate(Math.round(a.o._inner[u])); } if (n) { this.aai(c, u, r, l, h, b.r, aa); } if (z.dataContext != null) { var ab = z.dataContext; if (s == 1) { if (aa >= 0 && aa < this.dp.count) { if (q != null && q.i$b != null && q.i$b.count > aa) { aa = q.i$b._inner[aa]; } ab.item = this.dp.item(aa); } } else { ab.item = null; } } this.y4.ad(z, false, false, false, false); z.ap = this.y4.k; z.aq = this.y4.l; m.dq(z, v, Math.min(x, w)); } m.dk.count = t; b.c7(a); }; Object.defineProperty(ColumnSeries.prototype, "acz", { get: function () { return this.acy; }, set: function (a) { if (this.acz != a) { var b = this.acz; this.acy = a; this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.acz)); } }, enumerable: false, configurable: true }); ColumnSeries.prototype.ac0 = function (a) { if (a == null || a.length < 3) { return NaN; } switch (this.acz) { case 0: return a[1]; case 1: return a[2]; case 2: return (a[1] + a[2]) / 2; case 3: var b = (a[1] + a[2]) / 2; if (this.yAxis == null) { return b; } var c = this.yAxis.eo(b, new ScalerParams(1, this.dc.wo, this.dc.wn, this.yAxis.ch)); if (c < this.yAxis.me) { return a[2]; } else { return a[1]; } case 4: var d = (a[1] + a[2]) / 2; var e = this.yAxis.eo(d, new ScalerParams(1, this.dc.wo, this.dc.wn, this.yAxis.ch)); if (this.yAxis == null) { return d; } if (e < this.yAxis.me) { return a[1]; } else { return a[2]; } default: return (a[1] + a[2]) / 2; } }; Object.defineProperty(ColumnSeries.prototype, "useHighMarkerFidelity", { get: function () { return this.zs; }, enumerable: false, configurable: true }); ColumnSeries.$t = markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$); ColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:ac1:ac7', [1, 0], 'RadiusY:ac2:ac8', [1, 0]]); return ColumnSeries; }(HorizontalAnchoredCategorySeries)); export { ColumnSeries }; /** * @hidden */ var ColumnSeriesView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(ColumnSeriesView, _super); function ColumnSeriesView(a) { var _this = _super.call(this, a) || this; _this.dj = null; _this.dl = null; _this.dr = new Rectangle(); _this.dk = null; _this.dj = a; _this.dk = ((function () { var $ret = new Pool$1(Rectangle.$); $ret.create = runOn(_this, _this.ds); $ret.activate = runOn(_this, _this.dm); $ret.disactivate = runOn(_this, _this.dp); $ret.destroy = runOn(_this, _this.dn); return $ret; })()); return _this; } ColumnSeriesView.prototype.ax = function () { _super.prototype.ax.call(this); this.dl = new List$1(Rectangle.$, 0); if (!this.r) { this.dj.jp = Defaults.i; this.dj.xc = Defaults.c; } }; ColumnSeriesView.prototype.ds = function () { var a = new Rectangle(); this.dl.add(a); a._visibility = 1; return a; }; ColumnSeriesView.prototype.dm = function (a) { a._visibility = 0; }; ColumnSeriesView.prototype.dp = function (a) { a._visibility = 1; }; ColumnSeriesView.prototype.dn = function (a) { this.dl.remove(a); }; ColumnSeriesView.prototype.dq = function (a, b, c) { if (!this.isDirty) { this.av(); } a.o = c; a.n = b; }; ColumnSeriesView.prototype.af = function (a) { return this.dl._inner[a]; }; ColumnSeriesView.prototype.ae = function (a) { var b = this.dl._inner[a]; this.dr._visibility = b._visibility; this.dr.n = b.n; this.dr.o = b.o; this.dr.width = b.width; this.dr.height = b.height; var c = this.bw(a); this.dr._fill = c; this.dr._stroke = c; this.dr.ad = this.f.ie + 3; return this.dr; }; ColumnSeriesView.prototype.bc = function (a, b) { _super.prototype.bc.call(this, a, b); if (a.d) { for (var c = 0; c < this.dl.count; c++) { var d = this.ad(c, b); this.bj(d, c, b); a.w(d); } } }; ColumnSeriesView.prototype.aq = function (a) { var e_1, _a, e_2, _b; _super.prototype.aq.call(this, a); var b = 0; var c = new List$1(Rectangle.$, 0); try { for (var _c = __values(fromEnum(this.dk.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; this.f.bc.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]); } } 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++; }; ColumnSeriesView.$t = markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$); return ColumnSeriesView; }(AnchoredCategorySeriesView)); export { ColumnSeriesView };