UNPKG

igniteui-react-charts

Version:

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

844 lines (843 loc) 28.8 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 { ShapeSeriesBase } from "./ShapeSeriesBase"; import { ShapeAxisInfoCache } from "./ShapeAxisInfoCache"; import { StyleSelector } from "./StyleSelector"; import { DependencyProperty } from "igniteui-react-core"; import { Style } from "igniteui-react-core"; import { MarkerType_$type } from "./MarkerType"; import { DataTemplate } from "igniteui-react-core"; import { Brush } from "igniteui-react-core"; import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType"; import { MarkerOutlineMode_$type } from "./MarkerOutlineMode"; import { MarkerFillMode_$type } from "./MarkerFillMode"; import { Rect } from "igniteui-react-core"; import { ScalerParams } from "./ScalerParams"; import { Base, runOn, enumGetBox, Number_$type, typeCast, fromEnum, markType, markDep, PointUtil } from "igniteui-react-core"; import { Dictionary$2 } from "igniteui-react-core"; import { OwnedPoint } from "./OwnedPoint"; import { ShapeSeriesViewBase } from "./ShapeSeriesViewBase"; import { Marker } from "./Marker"; import { MarkerSeries } from "./MarkerSeries"; import { BrushUtil } from "igniteui-react-core"; import { DataContext } from "igniteui-react-core"; import { HashPool$2 } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { SeriesPointOfInterest } from "./SeriesPointOfInterest"; import { RectUtil } from "igniteui-react-core"; import { ChartSelection } from "./ChartSelection"; import { PropertyMetadata } from "igniteui-react-core"; import { DeviceUtils } from "igniteui-react-core"; import { isNaN_, isInfinity } from "igniteui-react-core"; import { NumericMarkerManager } from "./NumericMarkerManager"; import { DataTemplateMeasureInfo } from "igniteui-react-core"; import { Size } from "igniteui-react-core"; import { Defaults } from "./Defaults"; import { DataTemplatePassInfo } from "igniteui-react-core"; import { DataTemplateRenderInfo } from "igniteui-react-core"; import { MarkerVisualData } from "./MarkerVisualData"; import { stringIsNullOrEmpty } from "igniteui-react-core"; /** * @hidden */ export let ScatterPolygonSeries = /*@__PURE__*/ (() => { class ScatterPolygonSeries extends ShapeSeriesBase { bk() { return new ScatterPolygonSeries(); } get_fr() { return true; } get_fm() { return true; } constructor() { super(); this.aaw = null; this.aat = new ScalerParams(1, ScatterPolygonSeries.ab2, ScatterPolygonSeries.ab2, false); this.aau = new ScalerParams(1, ScatterPolygonSeries.ab2, ScatterPolygonSeries.ab2, false); this.abi = null; this.aao = 1; this.aak = 1; this.ab = ScatterPolygonSeries.$; } yq() { return this.aay(); } zy(a) { let b = a; b.db(this.ab4); b.dc(this.aax); super.zy(a); if (this.d7(a)) { return; } let c, d; let e = a.getViewInfo(c, d); c = e.p0; d = e.p1; let f = this.getEffectiveViewport1(a); this.aat = new ScalerParams(1, d, c, this.xp.df); this.aat.c = f; this.aau = new ScalerParams(1, d, c, this.xr.df); this.aau.c = f; if (c.width < 1 || c.height < 1) { return; } this.aaw = ((() => { let $ret = new ShapeAxisInfoCache(); $ret.a = this.xp; $ret.b = this.xr; $ret.e = this.xp.df; $ret.f = this.xr.df; $ret.d = this.dp; $ret.c = this.x7; return $ret; })()); if (this.aay()) { let g = new Dictionary$2(Base.$, OwnedPoint.$, 0); b.du.l(g, 400, d, c, this.ie); b.du.j(g, false); if (this.yo()) { this.abf(a); } } } abf(a) { a.dy = true; this.xw.ay(this, this.yo(), runOn(this, this.xf)); let b = this.xw.d; let c = b != null; let d = this.getEffectiveViewport1(a); let e = this.dp == null ? 0 : this.dp.count; a.d9((f) => { if (f._visibility == 0) { let g = f.ak; let h = f.content; if (h == null) { h = new DataContext(); f.content = h; } if (c) { this.zt(g, e, a.t); } this.xw.ac(f, h); } }); } aay() { return this.abi != null && ((this.aas != 1 && this.aas != 0) || this.abj != null); } ct() { return new ScatterPolygonSeriesView(this); } q8(a) { super.q8(a); this.aav = a; } get_hasMarkers() { return true; } get_en() { return this.aas != 13 && this.aas != 1; } vw() { return this.aby; } vx() { return this.abz; } s8() { return this.abh; } mf() { return this.mg(this, this.abi); } ip() { return this.aa0; } get aap() { return this.aao; } set aap(a) { this.aao = a; } aar() { if (this.aaq == 0) { return 1; } return this.aaq; } su(a) { super.su(a); this.aaq = a; } get aal() { return this.aak; } set aal(a) { this.aak = a; } aan() { if (this.aam == 0) { return 2; } return this.aam; } st(a) { super.st(a); this.aam = a; } sv(a) { super.sv(a); this.aa0 = a; } sq() { super.sq(); if (this.index < 0) { return; } if (this.abj != null) { this.aav.d8(); this.aav.d5(); } else { let a = MarkerSeries.xm(this, this.aas); let b = MarkerSeries.xz(a); if (b == null) { this.abh = MarkerSeries.ye; } else { this.aav.d2(b); } } if (this.ab0 != null && this.aas != 13) { this.sh("ActualMarkerBrush"); let c = this.aby; this.aav.d6(); this.aav.d3(); let d = this.aby; let e = this.fi("ActualMarkerBrush", this.hw.f > 0 ? this.hw.d() : null, c, d); this.sj("ActualMarkerBrush", e); } else { if (this.aas == 13) { this.aby = this.cw.b5(); } else { if (this.aal != 2) { if (this.dc != null) { let f = this.dc.wx(this.index); if (!isNaN_(this.id) && this.id != 1) { f = BrushUtil.s(f, this.id); } this.aby = f; } else { this.aby = null; } } } } if (this.ab1 != null) { this.aav.d7(); this.aav.d4(); } else { if (this.aas == 13) { this.abz = this.cw.b5(); } else { if (this.aaq == 2) { this.abz = this.aby; } else { this.abz = this.dc == null ? null : this.dc.wy(this.index); } } } if (this.aal == 2 && this.ab0 == null && this.aas != 13) { if (this.abz != null) { let g = this.abz; if (!isNaN_(this.id) && this.id != 1) { g = BrushUtil.s(g, this.id); } this.aby = g; } else { this.aby = null; } } } qz() { super.qz(); this.aap = this.aar(); this.aal = this.aan(); } rh(a, b, c, d) { super.rh(a, b, c, d); switch (b) { case ScatterPolygonSeries.$$p[3]: case ScatterPolygonSeries.$$p[11]: case ScatterPolygonSeries.$$p[7]: case ScatterPolygonSeries.$$p[9]: case ScatterPolygonSeries.$$p[10]: this.rn(b); this.ra(); break; case ScatterPolygonSeries.$$p[6]: this.aap = this.aar(); this.rn(null); this.ra(); break; case ScatterPolygonSeries.$$p[5]: this.aal = this.aan(); this.rn(null); this.ra(); break; case ScatterPolygonSeries.$$p[2]: this.abi = d; if (c == MarkerSeries.ye || d == MarkerSeries.ye || (c == null || d != null)) { this.aav.ea(); this.rz(false); } this.cw.bx(); if (this.toolTip != null && this.fj) { this.ba.a$as(this, this.toolTip); } this.rz(false); this.qs(); break; case ScatterPolygonSeries.$$p[12]: this.aav.db(this.ab4); this.rz(false); this.qs(); break; case ScatterPolygonSeries.$$p[13]: this.aav.dc(this.aax); this.rz(false); this.qs(); break; case ScatterPolygonSeries.$$p[4]: this.rz(false); this.qs(); break; case ScatterPolygonSeries.$$p[0]: case ScatterPolygonSeries.$$p[1]: if (this.aay()) { this.rz(false); } break; } } a2(a, b) { let c = this.aav.ch(a); let d = null; if (c != null) { d = c.content; } if (d != null) { return d; } return super.a2(a, b); } abg(a, b) { let c = new List$1(Base.$, 0); for (let d of fromEnum(b.c)) { if (!a.containsKey(d)) { c.add1(d); } } for (let e of fromEnum(c)) { b.h(e); } } ed(a, b, c, d, e) { if (!this.hasMarkers) { return false; } let f = this.xp; let g = new ScalerParams(1, this.dc.xn, this.w3, f.df); g.c = this.getEffectiveViewport1(this.cw); let h = this.xr; let i = new ScalerParams(1, this.dc.xn, this.w3, h.df); i.c = this.getEffectiveViewport1(this.cw); a.clear(); this.aav.d9((j) => { if (j._visibility == 0) { let k = new SeriesPointOfInterest(); let l = j.n; let m = j.o; if (!e && (l < this.w3.left || l > this.w3.right || m < this.w3.top || m > this.w3.bottom)) { return; } k.d = f.fw(l, g); k.e = h.fw(m, i); k.b = j.content; k.g = this.vr; k.c = j.ak; if (this.ha) { k.g = this.vy(j.ak); } a.add(k); } }); return true; } aai(a, b, c, d, e) { if (c == null || c.length != this.aaw.d.count) { c = new Array(this.aaw.d.count); for (let f = 0; f < this.aaw.d.count; f++) { c[f] = PointUtil.create(); } } let g = ((() => { let $ret = new ScalerParams(1, d, e, this.xp.df); $ret.c = this.getEffectiveViewport1(a); return $ret; })()); let h = ((() => { let $ret = new ScalerParams(1, d, e, this.xr.df); $ret.c = this.getEffectiveViewport1(a); return $ret; })()); let i = this.wu(a); let j = this.aaw.a.fw(i.left, g); let k = this.aaw.a.fw(i.right, g); let l = this.aaw.b.fw(i.bottom, h); let m = this.aaw.b.fw(i.top, h); if (this.aaw.e) { let n = j; j = k; k = n; } if (this.aaw.f) { let o = l; l = m; m = o; } let p = this.aaw; let q = p.a; let r = p.b; let s; let t; let u = g.d.left; let v = g.d.right; let w = h.d.top; let x = h.d.bottom; for (let y = 0; y < this.aaw.d.count; y++) { s = 0; t = 0; let z = null; let aa = a.cp.tryGetValue(y, z); z = aa.p1; if (z == null) { c[y].x = NaN; c[y].y = NaN; } else { let ab = z.c; let ac = RectUtil.l(ab); s = ac.x; t = ac.y; if (s >= u && s <= v && t >= w && t <= x) { c[y].x = s; c[y].y = t; } else { c[y].x = NaN; c[y].y = NaN; } } } return c; } aaz(a, b) { if (b == null) { b = new List$1(Number_$type, 2, a.e); } else { b.clear(); } let c = 0; let d = this.dp; for (let e of fromEnum(a.c)) { b.add(d.indexOf(e)); c++; } return b; } ak(a, b) { let c = new List$1(ChartSelection.$, 0); this.qa(a, c, b); return c.toArray(); } qa(a, b, c) { this.zq(a, b, c); } } ScatterPolygonSeries.$t = /*@__PURE__*/ markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$); ScatterPolygonSeries.ab2 = /*@__PURE__*/ new Rect(0, 0, 0, 1, 1); ScatterPolygonSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:aby:abk', [Brush.$], 'ActualMarkerOutline:abz:abl', [Brush.$], 'ActualMarkerTemplate:abh:abm', [DataTemplate.$, null], 'MarkerBrush:ab0:abn', [Brush.$], 'MarkerCollisionAvoidance:aaj:abo', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerFillMode:aam:abp', [MarkerFillMode_$type, /*@__PURE__*/ enumGetBox(MarkerFillMode_$type, 0)], 'MarkerOutlineMode:aaq:abq', [MarkerOutlineMode_$type, /*@__PURE__*/ enumGetBox(MarkerOutlineMode_$type, 0)], 'MarkerOutline:ab1:abr', [Brush.$], 'MarkerStyle:ab3:abs', [Style.$], 'MarkerTemplate:abj:abt', [DataTemplate.$, null], 'MarkerThickness:aa0:abu', [1, /*@__PURE__*/ DeviceUtils.g(2)], 'MarkerType:aas:abv', [MarkerType_$type, /*@__PURE__*/ enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:ab4:abw', [Style.$, null], 'ShapeStyleSelector:aax:abx', [StyleSelector.$, null]]); return ScatterPolygonSeries; })(); /** * @hidden */ export let ScatterPolygonSeriesView = /*@__PURE__*/ (() => { class ScatterPolygonSeriesView extends ShapeSeriesViewBase { constructor(a) { super(a); this.dy = false; this.dp = null; this.d0 = null; this.dv = null; this.dt = null; this.dx = false; this.dw = null; this.d1 = null; this.dq = new Marker(); this.eh = null; this.dq = new Marker(); this.dq.content = new DataContext(); this.dv = a; this.dw = new HashPool$2(Base.$, Marker.$); this.d1 = new List$1(Marker.$, 0); this.eb(this.dw); this.dt = new NumericMarkerManager(1, (b) => this.dw.item(b), (b) => this.dv.aaw.d.item(b), runOn(this, this.ef), runOn(this, this.dn), runOn(this, this.dz), () => this.dv.aaj); this.dt.q = runOn(this, this.ei); } a4() { super.a4(); if (!this.t) { this.dv.ab1 = Defaults.bb; this.dv.jt = Defaults.am; this.dv.aa0 = Defaults.al; this.dv.aas = Defaults.f; this.dv.aam = Defaults.b; } } get du() { return this.dt; } ef(a) { this.dv.abg(a, this.dw); } dn() { this.dp = this.dv.aai(this, this.dw, this.dp, this.ca, this.b9); return this.dp; } dz() { this.d0 = this.dv.aaz(this.dw, this.d0); return this.d0; } di(a, b) { return this.dj(a, b, true); } cz(a, b, c) { super.cz(a, b, c); ShapeSeriesViewBase.cy(this, a, b); } cx(a, b) { let c = a; if (c == null) { return; } c.an = b; } d9(a) { this.dw.f(a); } eb(a) { a.create = runOn(this, this.ds); a.destroy = runOn(this, this.ed); a.activate = runOn(this, this.ec); a.disactivate = runOn(this, this.ee); } ds() { let a = new Marker(); if (!this.dx) { a.content = ((() => { let $ret = new DataContext(); $ret.series = this.f; return $ret; })()); } a.ah = this.f.abh; this.d1.add(a); return a; } ch(a) { let b = this.dr(a, 0); if (b == null) { b = this.dr(a, 3); } return b; } dr(a, b) { let c; let d; let e; let f; for (let g = this.d1.count - 1; g >= 0; g--) { let h = this.d1._inner[g]; if (h._visibility == 1 || h._opacity == 0) { continue; } c = (h.m / 2) + b; d = (h.l / 2) + b; e = h.ai; f = h.aj; if ((h.n + e) - c <= a.x && (h.n + e) + c >= a.x && (h.o + f) - d <= a.y && (h.o + f) + d >= a.y) { return h; } } return null; } ed(a) { a.content = null; this.d1.remove(a); } ec(a) { a._visibility = 0; } ee(a) { if (a.content != null) { (typeCast(DataContext.$, a.content)).item = null; } a._visibility = 1; } eg(a) { this.dx = a; } bv(a, b) { super.bv(a, b); if (!this.dy) { let c = a; let d = c.content; if (d != null) { if (this.dv.aby != null) { d.actualItemBrush = this.dv.aby; } else { d.actualItemBrush = this.cj.vk; } if (this.dv.aby != null) { d.outline = this.dv.abz; } else { d.outline = this.cj.vo; } d.thickness = this.dv.aa0; } } } bw(a, b) { super.bw(a, b); let c = a; this.dq._visibility = c._visibility; this.dq.ah = c.ah; this.dq.width = c.width; this.dq.height = c.height; this.dq.m = c.m; this.dq.l = c.l; this.dq.n = c.n; this.dq.o = c.o; let d = this.b4(b); let e = this.dq.content; let f = c.content; e.item = f.item; e.series = f.series; e.thickness = f.thickness; if (e != null) { e.actualItemBrush = d; e.outline = d; e.thickness = this.dv.aa0 + 3; } } bi(a, b) { super.bi(a, b); let c = new DataTemplatePassInfo(); c.isHitTestRender = b; c.context = a.h(); c.viewportTop = this.b9.top; c.viewportLeft = this.b9.left; c.viewportWidth = this.b9.width; c.viewportHeight = this.b9.height; c.passID = "Markers"; let d = new DataTemplateRenderInfo(); d.passInfo = c; d.isHitTestRender = b; let e = new DataTemplateMeasureInfo(); e.passInfo = c; let f = false; let g = a.h(); e.context = g; d.context = g; let h = 0; let i = 0; if (this.dv.abh != null && this.dv.abh.passStarting != null) { this.dv.abh.passStarting(c); } for (let j = 0; j < this.d1.count; j++) { let k = this.d1._inner[j]; if (k._visibility == 1) { continue; } this.bu(k, j, b); if (b) { k = this.dq; } if (!f) { e.width = k.width; e.height = k.height; e.renderOffsetX = 0; e.renderOffsetY = 0; e.renderContext = a; let l = k.ah; if (l.measure != null) { e.data = k.content; l.measure(e); f = e.isConstant; if (f) { h = e.width; i = e.height; } } d.availableWidth = e.width; d.availableHeight = e.height; d.renderOffsetX = e.renderOffsetX; d.renderOffsetY = e.renderOffsetY; d.renderContext = a; } else { d.availableWidth = h; d.availableHeight = i; } if (!isNaN_(k.width) && !isInfinity(k.width)) { d.availableWidth = k.width; } if (!isNaN_(k.height) && !isInfinity(k.height)) { d.availableHeight = k.height; } a.q(d, k); k.m = d.availableWidth; k.l = d.availableHeight; k.ai = d.renderOffsetX; k.aj = d.renderOffsetY; } if (this.dv.abh != null && this.dv.abh.passCompleted != null) { this.dv.abh.passCompleted(c); } } d8() { this.dv.abh = null; } d5() { this.dv.abh = null; this.dv.abh = this.dv.abj; } d6() { this.dv.aby = null; } d3() { this.dv.aby = null; if (!isNaN_(this.f.id) && this.f.id != 1) { let a = BrushUtil.s(this.dv.ab0, this.f.id); this.dv.aby = a; } else { this.dv.aby = this.dv.ab0; } } d7() { this.dv.abz = null; } d4() { this.dv.abz = null; this.dv.abz = this.dv.ab1; } d2(a) { switch (a) { case "CircleMarkerTemplate": this.dv.abh = this.dv.dc.te; break; case "TriangleMarkerTemplate": this.dv.abh = this.dv.dc.tn; break; case "PyramidMarkerTemplate": this.dv.abh = this.dv.dc.tk; break; case "SquareMarkerTemplate": this.dv.abh = this.dv.dc.tl; break; case "DiamondMarkerTemplate": this.dv.abh = this.dv.dc.tf; break; case "PentagonMarkerTemplate": this.dv.abh = this.dv.dc.ti; break; case "HexagonMarkerTemplate": this.dv.abh = this.dv.dc.tg; break; case "TetragramMarkerTemplate": this.dv.abh = this.dv.dc.ti; break; case "PentagramMarkerTemplate": this.dv.abh = this.dv.dc.tj; break; case "HexagramMarkerTemplate": this.dv.abh = this.dv.dc.th; break; } } ea() { for (let a of fromEnum(this.d1)) { a.ah = this.dv.abh; } this.a2(); } ei(a) { if (this.eh == null) { this.eh = new DataTemplateMeasureInfo(); this.eh.context = this.m.h(); } this.eh.width = a.width; this.eh.height = a.height; this.eh.data = a.content; let b = a.ah; if (b.measure != null) { b.measure(this.eh); } return new Size(1, this.eh.width, this.eh.height); } ax(a) { let b = a; super.ax(b); for (let c of fromEnum(this.dw.c)) { let d = this.dw.item(c); if (d._visibility != 1) { let e = typeCast(ScatterPolygonSeries.$, this.f); let f = this.f.bc.getMarkerVisualData(e, d, e.abh); b.markerShapes.add(typeCast(MarkerVisualData.$, f)); } } } getDefaultTooltipTemplate() { let a = "<div class='ui-chart-default-tooltip-content'><span"; let b = this.f.ba.a$u(this.f); if (!stringIsNullOrEmpty(b)) { a += " style='color:" + b + "'"; } a += ">" + this.dv.title + "</span><br/>"; a += "</div>"; return a; } } ScatterPolygonSeriesView.$t = /*@__PURE__*/ markType(ScatterPolygonSeriesView, 'ScatterPolygonSeriesView', ShapeSeriesViewBase.$); return ScatterPolygonSeriesView; })();