UNPKG

igniteui-react-charts

Version:

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

340 lines (339 loc) 11.2 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 { 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 */ export let ColumnSeries = /*@__PURE__*/ (() => { class ColumnSeries extends HorizontalAnchoredCategorySeries { bk() { return new ColumnSeries(); } get_e1() { return true; } get_fm() { return true; } jl() { if (!isNaN_(this.jk)) { return super.jl(); } return Defaults.h; } ct() { return new ColumnSeriesView(this); } q3(a) { super.q3(a); this.ac3 = a; } cz() { if (this.c0 == 0) { return 2; } return super.cz(); } y9() { return 1; } constructor() { super(); this.ac9 = null; this.ac4 = 0; this.ab = ColumnSeries.$; this.acn = 2; } get_ef() { return true; } preferredCategoryMode(a) { return this.acn; } ws(a) { if (this.ac9 == null) { this.ac9 = runOn(this, this.ac6); } let b = this.acq != null ? this.acq : this.yAxis; let c = this.ack; return this.aa7.c$d(this, a, c, b, this.yz, this.z0(this.cw), this.z1(this.cw), this.ac9); } gx(a, b) { if (this.g0(a, b)) { return true; } if (this.xm(a, b)) { return true; } return false; } o7(a, b) { super.o7(a, b); let c = b; if (a && c.du != null) { c.du.count = 0; } } ix() { return this.ack.k8(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)); } ak(a, b) { let c = new List$1(ChartSelection.$, 0); this.p6(a, c, b); return c.toArray(); } p6(a, b, c) { this.aak(a, b, c, this.yy, 1); } aas(a, b) { super.aas(a, b); let c = a.h; if (!b.w()) { return; } let d = b.ca; let e = b.b9; let f = this.getEffectiveViewport1(b); let g = new ScalerParams(0, d, e, this.acq.ch, f); g.b = this.iz(); let h = new ScalerParams(0, d, e, this.ack.ch, f); let i = this.acq; let j = i.el(i.me, g); let k = this.ack.k8(d, e, f); let l = this.ack; let m = b; if (isNaN_(k) || isInfinity(k)) { m.du.count = 0; return; } this.y7.a2(this, this.zr(), runOn(this, this.yr), this.z0(b), this.z1(b)); this.y7.r = this.ac7; this.y7.s = this.ac8; this.y7.k = this.ac7; this.y7.l = this.ac8; let n = false; let o = this.y7.b; if (o != null) { n = true; } let p = this.ack.cn; let q = p ? this.ack : null; let r = this.valueColumn.count; let s = this.z0(b); let t = 0; for (let u = 0; u < c.count; ++u) { let v = c._inner[u][0] - 0.5 * k; let w = this.ac6(c._inner[u]); let x = j; w = Math.max(w, -100); x = Math.min(x, e.bottom + 100); let y = Math.abs(x - w); if (isInfinity(y) || isNaN_(y)) { continue; } let z = m.du.item(t); t++; z.width = k; z.height = y; let aa = this.y7.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.aao(c, u, r, l, h, b.t, aa); } if (z.dataContext != null) { let 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.y7.ad(z, false, false, false, false); z.ap = this.y7.k; z.aq = this.y7.l; m.dz(z, v, Math.min(x, w)); } m.du.count = t; b.dg(a); } get ac5() { return this.ac4; } set ac5(a) { if (this.ac5 != a) { let b = this.ac5; this.ac4 = a; this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.ac5)); } } ac6(a) { if (a == null || a.length < 3) { return NaN; } switch (this.ac5) { case 0: return a[1]; case 1: return a[2]; case 2: return (a[1] + a[2]) / 2; case 3: let b = (a[1] + a[2]) / 2; if (this.yAxis == null) { return b; } let c = this.yAxis.eo(b, new ScalerParams(1, this.dc.xc, this.dc.xb, this.yAxis.ch)); if (c < this.yAxis.me) { return a[2]; } else { return a[1]; } case 4: let d = (a[1] + a[2]) / 2; let e = this.yAxis.eo(d, new ScalerParams(1, this.dc.xc, this.dc.xb, 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; } } get useHighMarkerFidelity() { return this.zv; } } ColumnSeries.$t = /*@__PURE__*/ markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$); ColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:ac7:add', [1, 0], 'RadiusY:ac8:ade', [1, 0]]); return ColumnSeries; })(); /** * @hidden */ export let ColumnSeriesView = /*@__PURE__*/ (() => { class ColumnSeriesView extends AnchoredCategorySeriesView { a4() { super.a4(); this.dv = new List$1(Rectangle.$, 0); if (!this.t) { this.dt.jq = Defaults.i; this.dt.xf = Defaults.c; } } constructor(a) { super(a); this.dt = null; this.dv = null; this.d0 = new Rectangle(); this.du = null; this.dt = a; this.du = ((() => { let $ret = new Pool$1(Rectangle.$); $ret.create = runOn(this, this.d1); $ret.activate = runOn(this, this.dw); $ret.disactivate = runOn(this, this.dy); $ret.destroy = runOn(this, this.dx); return $ret; })()); } d1() { 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) { if (!this.isDirty) { this.a2(); } a.o = c; a.n = b; } ak(a) { return this.dv._inner[a]; } aj(a) { let b = this.dv._inner[a]; this.d0._visibility = b._visibility; this.d0.n = b.n; this.d0.o = b.o; this.d0.width = b.width; this.d0.height = b.height; let c = this.b4(a); this.d0._fill = c; this.d0._stroke = c; this.d0.ad = this.f.ig + 3; return this.d0; } 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)) { this.f.bc.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]); } b++; } } ColumnSeriesView.$t = /*@__PURE__*/ markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$); return ColumnSeriesView; })();