UNPKG

igniteui-react-charts

Version:

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

883 lines (882 loc) 29.9 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 { Base, runOn, enumGetBox, Number_$type, typeCast, fromEnum, markType, markDep, PointUtil } from "igniteui-react-core"; import { Rect } from "igniteui-react-core"; import { RectUtil } from "igniteui-react-core"; import { Marker } from "./Marker"; import { ShapeSeriesViewBase } from "./ShapeSeriesViewBase"; import { ScalerParams } from "./ScalerParams"; import { Dictionary$2 } from "igniteui-react-core"; import { OwnedPoint } from "./OwnedPoint"; 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 { 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_fu() { return true; } get_fp() { return true; } aba(a, b) { if (this.hasMarkers && this.aa9()) { let c = this.xc(a); if (c.isEmpty) { return false; } let d = RectUtil.r(c, this.i2(b)); if (d.containsPoint(a)) { return true; } } return false; } g3(a, b) { if (this.aba(a, b)) { return true; } if (this.g6(a, b)) { return true; } return false; } xb(a) { if (!this.hasMarkers || !this.aa9()) { return Rect.empty; } let b = this.aa6.ch(this.ws(a)); if (b != null) { return this.aa6.ei(b); } return Rect.empty; } constructor() { super(); this.aa7 = null; this.aa4 = new ScalerParams(1, ScatterPolygonSeries.ace, ScatterPolygonSeries.ace, false); this.aa5 = new ScalerParams(1, ScatterPolygonSeries.ace, ScatterPolygonSeries.ace, false); this.abu = null; this.aaz = 1; this.aav = 1; this.ab = ScatterPolygonSeries.$; } y1() { return this.aa9(); } z9(a) { let b = a; b.db(this.acg); b.dc(this.aa8); super.z9(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.aa4 = new ScalerParams(1, d, c, this.x0.dn); this.aa4.c = f; this.aa5 = new ScalerParams(1, d, c, this.x2.dn); this.aa5.c = f; if (c.width < 1 || c.height < 1) { return; } this.aa7 = ((() => { let $ret = new ShapeAxisInfoCache(); $ret.a = this.x0; $ret.b = this.x2; $ret.e = this.x0.dn; $ret.f = this.x2.dn; $ret.d = this.dp; $ret.c = this.yi; return $ret; })()); if (this.aa9()) { let g = new Dictionary$2(Base.$, OwnedPoint.$, 0); b.du.l(g, 400, d, c, this.il); b.du.j(g, false); if (this.yz()) { this.abr(a); } } } abr(a) { a.dy = true; this.x7.ay(this, this.yz(), runOn(this, this.xq)); let b = this.x7.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.z4(g, e, a.t); } this.x7.ac(f, h); } }); } aa9() { return this.abu != null && ((this.aa3 != 1 && this.aa3 != 0) || this.abv != null); } ct() { return new ScatterPolygonSeriesView(this); } ri(a) { super.ri(a); this.aa6 = a; } get_hasMarkers() { return true; } get_en() { return this.aa3 != 13 && this.aa3 != 1; } v6() { return this.aca; } v7() { return this.acb; } ti() { return this.abt; } mm() { return this.mn(this, this.abu); } iv() { return this.abc; } get aa0() { return this.aaz; } set aa0(a) { this.aaz = a; } aa2() { if (this.aa1 == 0) { return 1; } return this.aa1; } s4(a) { super.s4(a); this.aa1 = a; } get aaw() { return this.aav; } set aaw(a) { this.aav = a; } aay() { if (this.aax == 0) { return 2; } return this.aax; } s3(a) { super.s3(a); this.aax = a; } s5(a) { super.s5(a); this.abc = a; } s0() { super.s0(); if (this.index < 0) { return; } if (this.abv != null) { this.aa6.d8(); this.aa6.d5(); } else { let a = MarkerSeries.xx(this, this.aa3); let b = MarkerSeries.ya(a); if (b == null) { this.abt = MarkerSeries.yp; } else { this.aa6.d2(b); } } if (this.acc != null && this.aa3 != 13) { this.sr("ActualMarkerBrush"); let c = this.aca; this.aa6.d6(); this.aa6.d3(); let d = this.aca; let e = this.fk("ActualMarkerBrush", this.h2.f > 0 ? this.h2.d() : null, c, d); this.st("ActualMarkerBrush", e); } else { if (this.aa3 == 13) { this.aca = this.cw.b5(); } else { if (this.aaw != 2) { if (this.dc != null) { let f = this.dc.x2(this.index); if (!isNaN_(this.ik) && this.ik != 1) { f = BrushUtil.u(f, this.ik); } this.aca = f; } else { this.aca = null; } } } } if (this.acd != null) { this.aa6.d7(); this.aa6.d4(); } else { if (this.aa3 == 13) { this.acb = this.cw.b5(); } else { if (this.aa1 == 2) { this.acb = this.aca; } else { this.acb = this.dc == null ? null : this.dc.x3(this.index); } } } if (this.aaw == 2 && this.acc == null && this.aa3 != 13) { if (this.acb != null) { let g = this.acb; if (!isNaN_(this.ik) && this.ik != 1) { g = BrushUtil.u(g, this.ik); } this.aca = g; } else { this.aca = null; } } } q9() { super.q9(); this.aa0 = this.aa2(); this.aaw = this.aay(); } rr(a, b, c, d) { super.rr(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.rx(b); this.rk(); break; case ScatterPolygonSeries.$$p[6]: this.aa0 = this.aa2(); this.rx(null); this.rk(); break; case ScatterPolygonSeries.$$p[5]: this.aaw = this.aay(); this.rx(null); this.rk(); break; case ScatterPolygonSeries.$$p[2]: this.abu = d; if (c == MarkerSeries.yp || d == MarkerSeries.yp || (c == null || d != null)) { this.aa6.ea(); this.r9(false); } this.cw.bx(); if (this.toolTip != null && this.fl) { this.ba.a$at(this, this.toolTip); } this.r9(false); this.q1(); break; case ScatterPolygonSeries.$$p[12]: this.aa6.db(this.acg); this.r9(false); this.q1(); break; case ScatterPolygonSeries.$$p[13]: this.aa6.dc(this.aa8); this.r9(false); this.q1(); break; case ScatterPolygonSeries.$$p[4]: this.r9(false); this.q1(); break; case ScatterPolygonSeries.$$p[0]: case ScatterPolygonSeries.$$p[1]: if (this.aa9()) { this.r9(false); } break; } } a2(a, b) { let c = this.aa6.ch(a); let d = null; if (c != null) { d = c.content; } if (d != null) { return d; } return super.a2(a, b); } abs(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.x0; let g = new ScalerParams(1, this.dc.ys, this.xe, f.dn); g.c = this.getEffectiveViewport1(this.cw); let h = this.x2; let i = new ScalerParams(1, this.dc.ys, this.xe, h.dn); i.c = this.getEffectiveViewport1(this.cw); a.clear(); this.aa6.d9((j) => { if (j._visibility == 0) { let k = new SeriesPointOfInterest(); let l = j.n; let m = j.o; if (!e && (l < this.xe.left || l > this.xe.right || m < this.xe.top || m > this.xe.bottom)) { return; } k.d = f.ga(l, g); k.e = h.ga(m, i); k.b = j.content; k.g = this.v1; k.c = j.ak; if (this.hg) { k.g = this.v8(j.ak); } a.add(k); } }); return true; } aat(a, b, c, d, e) { if (c == null || c.length != this.aa7.d.count) { c = new Array(this.aa7.d.count); for (let f = 0; f < this.aa7.d.count; f++) { c[f] = PointUtil.create(); } } let g = ((() => { let $ret = new ScalerParams(1, d, e, this.x0.dn); $ret.c = this.getEffectiveViewport1(a); return $ret; })()); let h = ((() => { let $ret = new ScalerParams(1, d, e, this.x2.dn); $ret.c = this.getEffectiveViewport1(a); return $ret; })()); let i = this.w5(a); let j = this.aa7.a.ga(i.left, g); let k = this.aa7.a.ga(i.right, g); let l = this.aa7.b.ga(i.bottom, h); let m = this.aa7.b.ga(i.top, h); if (this.aa7.e) { let n = j; j = k; k = n; } if (this.aa7.f) { let o = l; l = m; m = o; } let p = this.aa7; 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.aa7.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; } abb(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.qj(a, c, b); return c.toArray(); } qj(a, b, c) { this.z1(a, b, c); } } ScatterPolygonSeries.$t = /*@__PURE__*/ markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$); ScatterPolygonSeries.ace = /*@__PURE__*/ new Rect(0, 0, 0, 1, 1); ScatterPolygonSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:aca:abw', [Brush.$], 'ActualMarkerOutline:acb:abx', [Brush.$], 'ActualMarkerTemplate:abt:aby', [DataTemplate.$, null], 'MarkerBrush:acc:abz', [Brush.$], 'MarkerCollisionAvoidance:aau:ab0', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerFillMode:aax:ab1', [MarkerFillMode_$type, /*@__PURE__*/ enumGetBox(MarkerFillMode_$type, 0)], 'MarkerOutlineMode:aa1:ab2', [MarkerOutlineMode_$type, /*@__PURE__*/ enumGetBox(MarkerOutlineMode_$type, 0)], 'MarkerOutline:acd:ab3', [Brush.$], 'MarkerStyle:acf:ab4', [Style.$], 'MarkerTemplate:abv:ab5', [DataTemplate.$, null], 'MarkerThickness:abc:ab6', [1, /*@__PURE__*/ DeviceUtils.g(2)], 'MarkerType:aa3:ab7', [MarkerType_$type, /*@__PURE__*/ enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:acg:ab8', [Style.$, null], 'ShapeStyleSelector:aa8:ab9', [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.aa7.d.item(b), runOn(this, this.ef), runOn(this, this.dn), runOn(this, this.dz), () => this.dv.aau); this.dt.q = runOn(this, this.ej); } a4() { super.a4(); if (!this.t) { this.dv.acd = Defaults.bb; this.dv.jz = Defaults.am; this.dv.abc = Defaults.al; this.dv.aa3 = Defaults.f; this.dv.aax = Defaults.b; } } get du() { return this.dt; } ei(a) { let b = a.n; let c = a.o; let d = a.m; let e = a.l; return new Rect(0, b - d / 2, c - d / 2, d, e); } ef(a) { this.dv.abs(a, this.dw); } dn() { this.dp = this.dv.aat(this, this.dw, this.dp, this.ca, this.b9); return this.dp; } dz() { this.d0 = this.dv.abb(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.abt; 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.aca != null) { d.actualItemBrush = this.dv.aca; } else { d.actualItemBrush = this.cj.vu; } if (this.dv.aca != null) { d.outline = this.dv.acb; } else { d.outline = this.cj.vy; } d.thickness = this.dv.abc; } } } 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.abc + 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.abt != null && this.dv.abt.passStarting != null) { this.dv.abt.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.abt != null && this.dv.abt.passCompleted != null) { this.dv.abt.passCompleted(c); } } d8() { this.dv.abt = null; } d5() { this.dv.abt = null; this.dv.abt = this.dv.abv; } d6() { this.dv.aca = null; } d3() { this.dv.aca = null; if (!isNaN_(this.f.ik) && this.f.ik != 1) { let a = BrushUtil.u(this.dv.acc, this.f.ik); this.dv.aca = a; } else { this.dv.aca = this.dv.acc; } } d7() { this.dv.acb = null; } d4() { this.dv.acb = null; this.dv.acb = this.dv.acd; } d2(a) { switch (a) { case "CircleMarkerTemplate": this.dv.abt = this.dv.dc.ui; break; case "TriangleMarkerTemplate": this.dv.abt = this.dv.dc.ur; break; case "PyramidMarkerTemplate": this.dv.abt = this.dv.dc.uo; break; case "SquareMarkerTemplate": this.dv.abt = this.dv.dc.up; break; case "DiamondMarkerTemplate": this.dv.abt = this.dv.dc.uj; break; case "PentagonMarkerTemplate": this.dv.abt = this.dv.dc.um; break; case "HexagonMarkerTemplate": this.dv.abt = this.dv.dc.uk; break; case "TetragramMarkerTemplate": this.dv.abt = this.dv.dc.um; break; case "PentagramMarkerTemplate": this.dv.abt = this.dv.dc.un; break; case "HexagramMarkerTemplate": this.dv.abt = this.dv.dc.ul; break; } } ea() { for (let a of fromEnum(this.d1)) { a.ah = this.dv.abt; } this.a2(); } ej(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.abt); b.markerShapes.add(typeCast(MarkerVisualData.$, f)); } } } getDefaultTooltipTemplate() { let a = "<div class='ui-chart-default-tooltip-content'><span"; let b = this.f.ba.a$v(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; })();