UNPKG

igniteui-react-charts

Version:

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

383 lines (382 loc) 13 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 { VerticalRangeCategorySeries } from "./VerticalRangeCategorySeries"; import { DependencyProperty } from "igniteui-react-core"; import { Defaults } from "./Defaults"; import { typeCast, runOn, markType, markDep, fromEnum } from "igniteui-react-core"; import { Rect } from "igniteui-react-core"; import { ScalerParams } from "./ScalerParams"; import { List$1 } from "igniteui-react-core"; import { Pool$1 } from "igniteui-react-core"; import { Rectangle } from "igniteui-react-core"; import { ChartSelection } from "./ChartSelection"; import { PropertyMetadata } from "igniteui-react-core"; import { truncate, isNaN_, isInfinity } from "igniteui-react-core"; import { RangeCategoryBucketCalculator } from "./RangeCategoryBucketCalculator"; import { ISortingAxis_$type } from "./ISortingAxis"; import { RangeCategorySeriesView } from "./RangeCategorySeriesView"; /** * @hidden */ var RangeBarSeries = /** @class */ /*@__PURE__*/ (function (_super) { __extends(RangeBarSeries, _super); function RangeBarSeries() { var _this = _super.call(this) || this; _this.ab = RangeBarSeries.$; return _this; } RangeBarSeries.prototype.bk = function () { return new RangeBarSeries(); }; RangeBarSeries.prototype.get_e0 = function () { return true; }; RangeBarSeries.prototype.get_fp = function () { return true; }; RangeBarSeries.prototype.ju = function () { if (!isNaN_(this.jt)) { return _super.prototype.ju.call(this); } return Defaults.h; }; RangeBarSeries.prototype.ct = function () { return new RangeBarSeriesView(this); }; RangeBarSeries.prototype.rj = function (a) { _super.prototype.rj.call(this, a); this.acv = a; }; RangeBarSeries.prototype.get_ef = function () { return true; }; RangeBarSeries.prototype.preferredCategoryMode = function (a) { return 2; }; RangeBarSeries.prototype.xa = function (a) { if (this.xAxis == null || this.yAxis == null) { return Rect.empty; } var b = this.wt(a); var c = this.cw.ca; var d = this.cw.b9; var e = this.getEffectiveViewport1(this.cw); var f = new ScalerParams(0, c, d, this.yAxis.dn, e); f.b = this.i7(); var g = this.an(this.zi(), this.zk.k, this.aal(this.cw), this.aam(this.cw), a, true); if (g == null) { return Rect.empty; } var h = g[0]; var i = g[1]; var j = Math.abs(b.y - h[0]); var k = Math.abs(b.y - i[0]); var l = this.yAxis.p2(c, d, e); if (j < k) { var m = h[0] - 0.5 * l; var n = Math.min(h[1], h[2]); var o = Math.max(h[1], h[2]); return new Rect(0, n, m, o - n, l); } else { var p = i[0] - 0.5 * l; var q = Math.min(i[1], i[2]); var r = Math.max(i[1], i[2]); return new Rect(0, q, p, r - q, l); } }; RangeBarSeries.prototype.g4 = function (a, b) { if (this.g7(a, b)) { return true; } if (this.x4(a, b)) { return true; } return false; }; RangeBarSeries.prototype.pk = function (a, b) { _super.prototype.pk.call(this, a, b); var c = b; if (a && c.dl != null) { c.dl.count = 0; } }; RangeBarSeries.prototype.i5 = function () { return this.yAxis.p2(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)); }; RangeBarSeries.prototype.abd = function (a, b) { _super.prototype.abd.call(this, a, b); var c = typeCast(RangeBarSeriesView.$, b); var d = a.k; var e = b.ca; var f = b.b9; var g = this.getEffectiveViewport1(b); var h = this.yAxis.p2(e, f, g); if (isNaN_(h) || isInfinity(h)) { c.dl.count = 0; return; } this.zs.a2(this, this.aac(), runOn(this, this.zc), this.aal(b), this.aam(b)); this.zs.r = this.acw; this.zs.s = this.acx; this.zs.k = this.acw; this.zs.l = this.acx; var i = false; var j = this.zs.b; if (j != null) { i = true; } var k = this.yAxis.dw; var l = this.lowColumn.count; var m = this.yAxis; var n = new ScalerParams(0, e, f, this.yAxis.dn, g); var o = 0; for (var p = 0; p < d.count; ++p) { var q = d._inner[p][0] - 0.5 * h; var r = Math.min(d._inner[p][1], d._inner[p][2]); var s = Math.max(d._inner[p][1], d._inner[p][2]); var t = Math.abs(s - r); if (isInfinity(t) || isNaN_(t)) { continue; } var u = c.dl.item(o); o++; u.width = t; u.height = h; var v = this.zs.aw(l, p)[0]; if (k && a.r != null && p >= 0 && p < a.r.count) { v = truncate(Math.round(a.r._inner[p])); } if (i) { this.aa9(d, p, l, m, n, b.t, v); } this.zs.ad(u, false, false, false, false); u.ap = this.zs.k; u.aq = this.zs.l; c.dr(u, r, q); } c.dl.count = o; b.dg(a); }; RangeBarSeries.prototype.qk = function (a, b, c) { this.aa5(a, b, c, this.zj, 1); }; RangeBarSeries.prototype.ak = function (a, b) { var c = new List$1(ChartSelection.$, 0); this.qk(a, c, b); return c.toArray(); }; Object.defineProperty(RangeBarSeries.prototype, "useHighMarkerFidelity", { get: function () { return this.aag; }, enumerable: false, configurable: true }); RangeBarSeries.$t = markType(RangeBarSeries, 'RangeBarSeries', VerticalRangeCategorySeries.$); RangeBarSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RangeBarSeries, 'raisePropertyChanged', ['RadiusX:acw:ac0', [1, 0], 'RadiusY:acx:ac1', [1, 0]]); return RangeBarSeries; }(VerticalRangeCategorySeries)); export { RangeBarSeries }; /** * @hidden */ var VerticalRangeCategoryBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) { __extends(VerticalRangeCategoryBucketCalculator, _super); function VerticalRangeCategoryBucketCalculator(a) { var _this = _super.call(this, a) || this; _this.m = null; _this.m = a; return _this; } VerticalRangeCategoryBucketCalculator.prototype.g = function (a) { var b = this.c.ca; var c = this.c.b9; var d = typeCast(RangeBarSeries.$, this.c.db); if (d == null) { this.d = 0; return; } var e = d.yAxis; var f = d.dp; if (b.isEmpty || c.isEmpty || e == null || f == null || f.count == 0) { this.d = 0; return; } var g = d.getEffectiveViewport1(this.c); var h = d.w6(this.c); var i = typeCast(ISortingAxis_$type, e); if (i == null || i.i$b == null) { var j = new ScalerParams(0, b, c, e.dn, g); var k = void 0; var l = void 0; if (!e.dn) { k = Math.floor(e.ga(h.bottom, j)); l = Math.ceil(e.ga(h.top, j)); } else { k = Math.floor(e.ga(h.top, j)); l = Math.ceil(e.ga(h.bottom, j)); } l = Math.min(l, e.qe - 1); var m = Math.floor((l - k + 1) * a / h.height); this.d = truncate(Math.max(1, m)); this.e = truncate(Math.max(0, Math.floor(k / this.d) - 1)); this.f = truncate(Math.ceil(l / this.d)); } else { this.e = i.i$e(b, c, g, h); this.f = i.i$g(b, c, g, h); this.d = 1; } }; VerticalRangeCategoryBucketCalculator.$t = markType(VerticalRangeCategoryBucketCalculator, 'VerticalRangeCategoryBucketCalculator', RangeCategoryBucketCalculator.$); return VerticalRangeCategoryBucketCalculator; }(RangeCategoryBucketCalculator)); export { VerticalRangeCategoryBucketCalculator }; /** * @hidden */ var RangeBarSeriesView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(RangeBarSeriesView, _super); function RangeBarSeriesView(a) { var _this = _super.call(this, a) || this; _this.dk = null; _this.dl = null; _this.dm = null; _this.ds = new Rectangle(); _this.dk = a; _this.dl = ((function () { var $ret = new Pool$1(Rectangle.$); $ret.create = runOn(_this, _this.dt); $ret.activate = runOn(_this, _this.dn); $ret.disactivate = runOn(_this, _this.dq); $ret.destroy = runOn(_this, _this.dp); return $ret; })()); return _this; } RangeBarSeriesView.prototype.da = function () { return new VerticalRangeCategoryBucketCalculator(this); }; RangeBarSeriesView.prototype.a4 = function () { _super.prototype.a4.call(this); this.dm = new List$1(Rectangle.$, 0); if (!this.t) { this.dk.xx = Defaults.c; this.dk.j0 = Defaults.i; } }; RangeBarSeriesView.prototype.dt = function () { var a = new Rectangle(); this.dm.add(a); a._visibility = 1; return a; }; RangeBarSeriesView.prototype.dn = function (a) { a._visibility = 0; }; RangeBarSeriesView.prototype.dq = function (a) { a._visibility = 1; }; RangeBarSeriesView.prototype.dp = function (a) { this.dm.remove(a); }; RangeBarSeriesView.prototype.dr = function (a, b, c) { if (!this.isDirty) { this.a2(); } a.o = c; a.n = b; }; RangeBarSeriesView.prototype.ak = function (a) { return this.dm._inner[a]; }; RangeBarSeriesView.prototype.aj = function (a) { var b = this.dm._inner[a]; this.ds._visibility = b._visibility; this.ds.n = b.n; this.ds.o = b.o; this.ds.width = b.width; this.ds.height = b.height; var c = this.b4(a); this.ds._fill = c; this.ds._stroke = c; this.ds.ad = this.f.io + 3; return this.ds; }; RangeBarSeriesView.prototype.bj = function (a, b) { _super.prototype.bj.call(this, a, b); if (a.d) { for (var c = 0; c < this.dm.count; c++) { var d = this.ai(c, b); this.br(d, c, b); a.w(d); } } }; RangeBarSeriesView.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.dl.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.o < f.o) { return -1; } else if (e.o > f.o) { 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, "bar" + 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++; }; RangeBarSeriesView.$t = markType(RangeBarSeriesView, 'RangeBarSeriesView', RangeCategorySeriesView.$); return RangeBarSeriesView; }(RangeCategorySeriesView)); export { RangeBarSeriesView };