UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

844 lines (843 loc) 29.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 { ShapeSeriesBase } from "./ShapeSeriesBase"; import { ShapeAxisInfoCache } from "./ShapeAxisInfoCache"; import { StyleSelector } from "./StyleSelector"; import { DependencyProperty } from "igniteui-angular-core"; import { Style } from "igniteui-angular-core"; import { MarkerType_$type } from "./MarkerType"; import { DataTemplate } from "igniteui-angular-core"; import { Brush } from "igniteui-angular-core"; import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType"; import { MarkerOutlineMode_$type } from "./MarkerOutlineMode"; import { MarkerFillMode_$type } from "./MarkerFillMode"; import { Rect } from "igniteui-angular-core"; import { ScalerParams } from "./ScalerParams"; import { Base, runOn, enumGetBox, Number_$type, typeCast, fromEnum, markType, markDep, PointUtil } from "igniteui-angular-core"; import { Dictionary$2 } from "igniteui-angular-core"; import { OwnedPoint } from "./OwnedPoint"; import { ShapeSeriesViewBase } from "./ShapeSeriesViewBase"; import { Marker } from "./Marker"; import { MarkerSeries } from "./MarkerSeries"; import { BrushUtil } from "igniteui-angular-core"; import { DataContext } from "igniteui-angular-core"; import { HashPool$2 } from "igniteui-angular-core"; import { List$1 } from "igniteui-angular-core"; import { SeriesPointOfInterest } from "./SeriesPointOfInterest"; import { RectUtil } from "igniteui-angular-core"; import { ChartSelection } from "./ChartSelection"; import { PropertyMetadata } from "igniteui-angular-core"; import { DeviceUtils } from "igniteui-angular-core"; import { isNaN_, isInfinity } from "igniteui-angular-core"; import { NumericMarkerManager } from "./NumericMarkerManager"; import { DataTemplateMeasureInfo } from "igniteui-angular-core"; import { Size } from "igniteui-angular-core"; import { Defaults } from "./Defaults"; import { DataTemplatePassInfo } from "igniteui-angular-core"; import { DataTemplateRenderInfo } from "igniteui-angular-core"; import { MarkerVisualData } from "./MarkerVisualData"; import { stringIsNullOrEmpty } from "igniteui-angular-core"; /** * @hidden */ export let ScatterPolygonSeries = /*@__PURE__*/ (() => { class ScatterPolygonSeries extends ShapeSeriesBase { constructor() { super(); this.aal = null; this.aai = new ScalerParams(1, ScatterPolygonSeries.abr, ScatterPolygonSeries.abr, false); this.aaj = new ScalerParams(1, ScatterPolygonSeries.abr, ScatterPolygonSeries.abr, false); this.aa7 = null; this.aad = 1; this.z9 = 1; this.ab = ScatterPolygonSeries.$; } bj() { return new ScatterPolygonSeries(); } get_fq() { return true; } get_fl() { return true; } yf() { return this.aan(); } zn(a) { let b = a; b.cy(this.abt); b.cz(this.aam); super.zn(a); if (this.d5(a)) { return; } let c, d; let e = a.getViewInfo(c, d); c = e.p0; d = e.p1; let f = this.getEffectiveViewport1(a); this.aai = new ScalerParams(1, d, c, this.xe.ch); this.aai.c = f; this.aaj = new ScalerParams(1, d, c, this.xg.ch); this.aaj.c = f; if (c.width < 1 || c.height < 1) { return; } this.aal = ((() => { let $ret = new ShapeAxisInfoCache(); $ret.a = this.xe; $ret.b = this.xg; $ret.e = this.xe.ch; $ret.f = this.xg.ch; $ret.d = this.dn; $ret.c = this.xw; return $ret; })()); if (this.aan()) { let g = new Dictionary$2(Base.$, OwnedPoint.$, 0); b.dg.l(g, 400, d, c, this.id); b.dg.j(g, false); if (this.yd()) { this.aa4(a); } } } aa4(a) { a.dk = true; this.xl.ay(this, this.yd(), runOn(this, this.w4)); let b = this.xl.d; let c = b != null; let d = this.getEffectiveViewport1(a); let e = this.dn == null ? 0 : this.dn.count; a.dw((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.zi(g, e, a.q); } this.xl.ac(f, h); } }); } aan() { return this.aa7 != null && ((this.aah != 1 && this.aah != 0) || this.aa8 != null); } cs() { return new ScatterPolygonSeriesView(this); } q1(a) { super.q1(a); this.aak = a; } get_hasMarkers() { return true; } get_el() { return this.aah != 13 && this.aah != 1; } vl() { return this.abn; } vm() { return this.abo; } sz() { return this.aa6; } ma() { return this.mb(this, this.aa7); } io() { return this.aap; } get aae() { return this.aad; } set aae(a) { this.aad = a; } aag() { if (this.aaf == 0) { return 1; } return this.aaf; } sl(a) { super.sl(a); this.aaf = a; } get aaa() { return this.z9; } set aaa(a) { this.z9 = a; } aac() { if (this.aab == 0) { return 2; } return this.aab; } sk(a) { super.sk(a); this.aab = a; } sm(a) { super.sm(a); this.aap = a; } sh() { super.sh(); if (this.index < 0) { return; } if (this.aa8 != null) { this.aak.dv(); this.aak.ds(); } else { let a = MarkerSeries.xb(this, this.aah); let b = MarkerSeries.xo(a); if (b == null) { this.aa6 = MarkerSeries.x3; } else { this.aak.dp(b); } } if (this.abp != null && this.aah != 13) { this.r8("ActualMarkerBrush"); let c = this.abn; this.aak.dt(); this.aak.dq(); let d = this.abn; let e = this.fh("ActualMarkerBrush", this.hv.f > 0 ? this.hv.d() : null, c, d); this.sa("ActualMarkerBrush", e); } else { if (this.aah == 13) { this.abn = this.cv.bt(); } else { if (this.aaa != 2) { if (this.db != null) { let f = this.db.ve(this.index); if (!isNaN_(this.ic) && this.ic != 1) { f = BrushUtil.q(f, this.ic); } this.abn = f; } else { this.abn = null; } } } } if (this.abq != null) { this.aak.du(); this.aak.dr(); } else { if (this.aah == 13) { this.abo = this.cv.bt(); } else { if (this.aaf == 2) { this.abo = this.abn; } else { this.abo = this.db == null ? null : this.db.vf(this.index); } } } if (this.aaa == 2 && this.abp == null && this.aah != 13) { if (this.abo != null) { let g = this.abo; if (!isNaN_(this.ic) && this.ic != 1) { g = BrushUtil.q(g, this.ic); } this.abn = g; } else { this.abn = null; } } } qs() { super.qs(); this.aae = this.aag(); this.aaa = this.aac(); } q9(a, b, c, d) { super.q9(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.rf(b); this.q3(); break; case ScatterPolygonSeries.$$p[6]: this.aae = this.aag(); this.rf(null); this.q3(); break; case ScatterPolygonSeries.$$p[5]: this.aaa = this.aac(); this.rf(null); this.q3(); break; case ScatterPolygonSeries.$$p[2]: this.aa7 = d; if (c == MarkerSeries.x3 || d == MarkerSeries.x3 || (c == null || d != null)) { this.aak.dx(); this.rr(false); } this.cv.bl(); if (this.toolTip != null && this.fi) { this.ba.a$as(this, this.toolTip); } this.rr(false); this.ql(); break; case ScatterPolygonSeries.$$p[12]: this.aak.cy(this.abt); this.rr(false); this.ql(); break; case ScatterPolygonSeries.$$p[13]: this.aak.cz(this.aam); this.rr(false); this.ql(); break; case ScatterPolygonSeries.$$p[4]: this.rr(false); this.ql(); break; case ScatterPolygonSeries.$$p[0]: case ScatterPolygonSeries.$$p[1]: if (this.aan()) { this.rr(false); } break; } } a2(a, b) { let c = this.aak.b4(a); let d = null; if (c != null) { d = c.content; } if (d != null) { return d; } return super.a2(a, b); } aa5(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); } } eb(a, b, c, d, e) { if (!this.hasMarkers) { return false; } let f = this.xe; let g = new ScalerParams(1, this.db.v4, this.ws, f.ch); g.c = this.getEffectiveViewport1(this.cv); let h = this.xg; let i = new ScalerParams(1, this.db.v4, this.ws, h.ch); i.c = this.getEffectiveViewport1(this.cv); a.clear(); this.aak.dw((j) => { if (j._visibility == 0) { let k = new SeriesPointOfInterest(); let l = j.n; let m = j.o; if (l < this.ws.left || l > this.ws.right || m < this.ws.top || m > this.ws.bottom) { return; } k.d = f.eo(l, g); k.e = h.eo(m, i); k.b = j.content; k.g = this.vg; k.c = j.ak; if (this.g9) { k.g = this.vn(j.ak); } a.add(k); } }); return true; } z7(a, b, c, d, e) { if (c == null || c.length != this.aal.d.count) { c = new Array(this.aal.d.count); for (let f = 0; f < this.aal.d.count; f++) { c[f] = PointUtil.create(); } } let g = ((() => { let $ret = new ScalerParams(1, d, e, this.xe.ch); $ret.c = this.getEffectiveViewport1(a); return $ret; })()); let h = ((() => { let $ret = new ScalerParams(1, d, e, this.xg.ch); $ret.c = this.getEffectiveViewport1(a); return $ret; })()); let i = this.wj(a); let j = this.aal.a.eo(i.left, g); let k = this.aal.a.eo(i.right, g); let l = this.aal.b.eo(i.bottom, h); let m = this.aal.b.eo(i.top, h); if (this.aal.e) { let n = j; j = k; k = n; } if (this.aal.f) { let o = l; l = m; m = o; } let p = this.aal; 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.aal.d.count; y++) { s = 0; t = 0; let z = null; let aa = a.cc.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; } aao(a, b) { if (b == null) { b = new List$1(Number_$type, 2, a.e); } else { b.clear(); } let c = 0; let d = this.dn; 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.p4(a, c, b); return c.toArray(); } p4(a, b, c) { this.zf(a, b, c); } } ScatterPolygonSeries.$t = markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$); ScatterPolygonSeries.abr = new Rect(0, 0, 0, 1, 1); ScatterPolygonSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:abn:aa9', [Brush.$], 'ActualMarkerOutline:abo:aba', [Brush.$], 'ActualMarkerTemplate:aa6:abb', [DataTemplate.$, null], 'MarkerBrush:abp:abc', [Brush.$], 'MarkerCollisionAvoidance:z8:abd', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerFillMode:aab:abe', [MarkerFillMode_$type, enumGetBox(MarkerFillMode_$type, 0)], 'MarkerOutlineMode:aaf:abf', [MarkerOutlineMode_$type, enumGetBox(MarkerOutlineMode_$type, 0)], 'MarkerOutline:abq:abg', [Brush.$], 'MarkerStyle:abs:abh', [Style.$], 'MarkerTemplate:aa8:abi', [DataTemplate.$, null], 'MarkerThickness:aap:abj', [1, DeviceUtils.g(2)], 'MarkerType:aah:abk', [MarkerType_$type, enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:abt:abl', [Style.$, null], 'ShapeStyleSelector:aam:abm', [StyleSelector.$, null]]); return ScatterPolygonSeries; })(); /** * @hidden */ export let ScatterPolygonSeriesView = /*@__PURE__*/ (() => { class ScatterPolygonSeriesView extends ShapeSeriesViewBase { constructor(a) { super(a); this.dk = false; this.db = null; this.dm = null; this.dh = null; this.df = null; this.dj = false; this.di = null; this.dn = null; this.dc = new Marker(); this.d4 = null; this.dc = new Marker(); this.dc.content = new DataContext(); this.dh = a; this.di = new HashPool$2(Base.$, Marker.$); this.dn = new List$1(Marker.$, 0); this.dy(this.di); this.df = new NumericMarkerManager(1, (b) => this.di.item(b), (b) => this.dh.aal.d.item(b), runOn(this, this.d2), runOn(this, this.da), runOn(this, this.dl), () => this.dh.z8); this.df.q = runOn(this, this.d5); } au() { super.au(); if (!this.q) { this.dh.abq = Defaults.am; this.dh.jp = Defaults.z; this.dh.aap = Defaults.y; this.dh.aah = Defaults.f; this.dh.aab = Defaults.b; } } get dg() { return this.df; } d2(a) { this.dh.aa5(a, this.di); } da() { this.db = this.dh.z7(this, this.di, this.db, this.by, this.bx); return this.db; } dl() { this.dm = this.dh.aao(this.di, this.dm); return this.dm; } c5(a, b) { return this.c6(a, b, true); } cm(a, b, c) { super.cm(a, b, c); ShapeSeriesViewBase.cl(this, a, b); } ck(a, b) { let c = a; if (c == null) { return; } c.an = b; } dw(a) { this.di.f(a); } dy(a) { a.create = runOn(this, this.de); a.destroy = runOn(this, this.d0); a.activate = runOn(this, this.dz); a.disactivate = runOn(this, this.d1); } de() { let a = new Marker(); if (!this.dj) { a.content = ((() => { let $ret = new DataContext(); $ret.series = this.e; return $ret; })()); } a.ah = this.e.aa6; this.dn.add(a); return a; } b4(a) { let b = this.dd(a, 0); if (b == null) { b = this.dd(a, 3); } return b; } dd(a, b) { let c; let d; let e; let f; for (let g = this.dn.count - 1; g >= 0; g--) { let h = this.dn._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; } d0(a) { a.content = null; this.dn.remove(a); } dz(a) { a._visibility = 0; } d1(a) { if (a.content != null) { (typeCast(DataContext.$, a.content)).item = null; } a._visibility = 1; } d3(a) { this.dj = a; } bj(a, b) { super.bj(a, b); if (!this.dk) { let c = a; let d = c.content; if (d != null) { if (this.dh.abn != null) { d.actualItemBrush = this.dh.abn; } else { d.actualItemBrush = this.b6.u9; } if (this.dh.abn != null) { d.outline = this.dh.abo; } else { d.outline = this.b6.vd; } d.thickness = this.dh.aap; } } } bk(a, b) { super.bk(a, b); let c = a; this.dc._visibility = c._visibility; this.dc.ah = c.ah; this.dc.width = c.width; this.dc.height = c.height; this.dc.m = c.m; this.dc.l = c.l; this.dc.n = c.n; this.dc.o = c.o; let d = this.bs(b); let e = this.dc.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.dh.aap + 3; } } a7(a, b) { super.a7(a, b); let c = new DataTemplatePassInfo(); c.isHitTestRender = b; c.context = a.h(); c.viewportTop = this.bx.top; c.viewportLeft = this.bx.left; c.viewportWidth = this.bx.width; c.viewportHeight = this.bx.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.dh.aa6 != null && this.dh.aa6.passStarting != null) { this.dh.aa6.passStarting(c); } for (let j = 0; j < this.dn.count; j++) { let k = this.dn._inner[j]; if (k._visibility == 1) { continue; } this.bi(k, j, b); if (b) { k = this.dc; } 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.dh.aa6 != null && this.dh.aa6.passCompleted != null) { this.dh.aa6.passCompleted(c); } } dv() { this.dh.aa6 = null; } ds() { this.dh.aa6 = null; this.dh.aa6 = this.dh.aa8; } dt() { this.dh.abn = null; } dq() { this.dh.abn = null; if (!isNaN_(this.e.ic) && this.e.ic != 1) { let a = BrushUtil.q(this.dh.abp, this.e.ic); this.dh.abn = a; } else { this.dh.abn = this.dh.abp; } } du() { this.dh.abo = null; } dr() { this.dh.abo = null; this.dh.abo = this.dh.abq; } dp(a) { switch (a) { case "CircleMarkerTemplate": this.dh.aa6 = this.dh.db.r1; break; case "TriangleMarkerTemplate": this.dh.aa6 = this.dh.db.sa; break; case "PyramidMarkerTemplate": this.dh.aa6 = this.dh.db.r7; break; case "SquareMarkerTemplate": this.dh.aa6 = this.dh.db.r8; break; case "DiamondMarkerTemplate": this.dh.aa6 = this.dh.db.r2; break; case "PentagonMarkerTemplate": this.dh.aa6 = this.dh.db.r5; break; case "HexagonMarkerTemplate": this.dh.aa6 = this.dh.db.r3; break; case "TetragramMarkerTemplate": this.dh.aa6 = this.dh.db.r5; break; case "PentagramMarkerTemplate": this.dh.aa6 = this.dh.db.r6; break; case "HexagramMarkerTemplate": this.dh.aa6 = this.dh.db.r4; break; } } dx() { for (let a of fromEnum(this.dn)) { a.ah = this.dh.aa6; } this.as(); } d5(a) { if (this.d4 == null) { this.d4 = new DataTemplateMeasureInfo(); this.d4.context = this.k.h(); } this.d4.width = a.width; this.d4.height = a.height; this.d4.data = a.content; let b = a.ah; if (b.measure != null) { b.measure(this.d4); } return new Size(1, this.d4.width, this.d4.height); } an(a) { let b = a; super.an(b); for (let c of fromEnum(this.di.c)) { let d = this.di.item(c); if (d._visibility != 1) { let e = typeCast(ScatterPolygonSeries.$, this.e); let f = this.e.bc.getMarkerVisualData(e, d, e.aa6); b.markerShapes.add(typeCast(MarkerVisualData.$, f)); } } } getDefaultTooltipTemplate() { let a = "<div class='ui-chart-default-tooltip-content'><span"; let b = this.e.ba.a$u(this.e); if (!stringIsNullOrEmpty(b)) { a += " style='color:" + b + "'"; } a += ">" + this.dh.title + "</span><br/>"; a += "</div>"; return a; } } ScatterPolygonSeriesView.$t = markType(ScatterPolygonSeriesView, 'ScatterPolygonSeriesView', ShapeSeriesViewBase.$); return ScatterPolygonSeriesView; })();