UNPKG

igniteui-react-charts

Version:

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

342 lines (341 loc) 11.5 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 { 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 */ export let RangeBarSeries = /*@__PURE__*/ (() => { class RangeBarSeries extends VerticalRangeCategorySeries { bk() { return new RangeBarSeries(); } get_e0() { return true; } get_fp() { return true; } ju() { if (!isNaN_(this.jt)) { return super.ju(); } return Defaults.h; } ct() { return new RangeBarSeriesView(this); } rj(a) { super.rj(a); this.acv = a; } constructor() { super(); this.ab = RangeBarSeries.$; } get_ef() { return true; } preferredCategoryMode(a) { return 2; } xa(a) { if (this.xAxis == null || this.yAxis == null) { return Rect.empty; } let b = this.wt(a); let c = this.cw.ca; let d = this.cw.b9; let e = this.getEffectiveViewport1(this.cw); let f = new ScalerParams(0, c, d, this.yAxis.dn, e); f.b = this.i7(); let g = this.an(this.zi(), this.zk.k, this.aal(this.cw), this.aam(this.cw), a, true); if (g == null) { return Rect.empty; } let h = g[0]; let i = g[1]; let j = Math.abs(b.y - h[0]); let k = Math.abs(b.y - i[0]); let l = this.yAxis.p2(c, d, e); if (j < k) { let m = h[0] - 0.5 * l; let n = Math.min(h[1], h[2]); let o = Math.max(h[1], h[2]); return new Rect(0, n, m, o - n, l); } else { let p = i[0] - 0.5 * l; let q = Math.min(i[1], i[2]); let r = Math.max(i[1], i[2]); return new Rect(0, q, p, r - q, l); } } g4(a, b) { if (this.g7(a, b)) { return true; } if (this.x4(a, b)) { return true; } return false; } pk(a, b) { super.pk(a, b); let c = b; if (a && c.dl != null) { c.dl.count = 0; } } i5() { return this.yAxis.p2(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)); } abd(a, b) { super.abd(a, b); let c = typeCast(RangeBarSeriesView.$, b); let d = a.k; let e = b.ca; let f = b.b9; let g = this.getEffectiveViewport1(b); let 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; let i = false; let j = this.zs.b; if (j != null) { i = true; } let k = this.yAxis.dw; let l = this.lowColumn.count; let m = this.yAxis; let n = new ScalerParams(0, e, f, this.yAxis.dn, g); let o = 0; for (let p = 0; p < d.count; ++p) { let q = d._inner[p][0] - 0.5 * h; let r = Math.min(d._inner[p][1], d._inner[p][2]); let s = Math.max(d._inner[p][1], d._inner[p][2]); let t = Math.abs(s - r); if (isInfinity(t) || isNaN_(t)) { continue; } let u = c.dl.item(o); o++; u.width = t; u.height = h; let 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); } qk(a, b, c) { this.aa5(a, b, c, this.zj, 1); } ak(a, b) { let c = new List$1(ChartSelection.$, 0); this.qk(a, c, b); return c.toArray(); } get useHighMarkerFidelity() { return this.aag; } } RangeBarSeries.$t = /*@__PURE__*/ markType(RangeBarSeries, 'RangeBarSeries', VerticalRangeCategorySeries.$); RangeBarSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RangeBarSeries, 'raisePropertyChanged', ['RadiusX:acw:ac0', [1, 0], 'RadiusY:acx:ac1', [1, 0]]); return RangeBarSeries; })(); /** * @hidden */ export let VerticalRangeCategoryBucketCalculator = /*@__PURE__*/ (() => { class VerticalRangeCategoryBucketCalculator extends RangeCategoryBucketCalculator { constructor(a) { super(a); this.m = null; this.m = a; } g(a) { let b = this.c.ca; let c = this.c.b9; let d = typeCast(RangeBarSeries.$, this.c.db); if (d == null) { this.d = 0; return; } let e = d.yAxis; let f = d.dp; if (b.isEmpty || c.isEmpty || e == null || f == null || f.count == 0) { this.d = 0; return; } let g = d.getEffectiveViewport1(this.c); let h = d.w6(this.c); let i = typeCast(ISortingAxis_$type, e); if (i == null || i.i$b == null) { let j = new ScalerParams(0, b, c, e.dn, g); let k; let l; 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); let 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 = /*@__PURE__*/ markType(VerticalRangeCategoryBucketCalculator, 'VerticalRangeCategoryBucketCalculator', RangeCategoryBucketCalculator.$); return VerticalRangeCategoryBucketCalculator; })(); /** * @hidden */ export let RangeBarSeriesView = /*@__PURE__*/ (() => { class RangeBarSeriesView extends RangeCategorySeriesView { constructor(a) { super(a); this.dk = null; this.dl = null; this.dm = null; this.ds = new Rectangle(); this.dk = a; this.dl = ((() => { let $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; })()); } da() { return new VerticalRangeCategoryBucketCalculator(this); } a4() { super.a4(); this.dm = new List$1(Rectangle.$, 0); if (!this.t) { this.dk.xx = Defaults.c; this.dk.j0 = Defaults.i; } } dt() { let a = new Rectangle(); this.dm.add(a); a._visibility = 1; return a; } dn(a) { a._visibility = 0; } dq(a) { a._visibility = 1; } dp(a) { this.dm.remove(a); } dr(a, b, c) { if (!this.isDirty) { this.a2(); } a.o = c; a.n = b; } ak(a) { return this.dm._inner[a]; } aj(a) { let 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; let c = this.b4(a); this.ds._fill = c; this.ds._stroke = c; this.ds.ad = this.f.io + 3; return this.ds; } bj(a, b) { super.bj(a, b); if (a.d) { for (let c = 0; c < this.dm.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.dl.a)) { c.add(d); } c.aa((e, f) => { if (e.o < f.o) { return -1; } else if (e.o > f.o) { return 1; } else { return 0; } }); for (let e of fromEnum(c)) { this.f.bc.exportRectangleData(a, e, "bar" + b, ["Main", "Fill"]); } b++; } } RangeBarSeriesView.$t = /*@__PURE__*/ markType(RangeBarSeriesView, 'RangeBarSeriesView', RangeCategorySeriesView.$); return RangeBarSeriesView; })();