UNPKG

igniteui-react-charts

Version:

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

574 lines (573 loc) 21.7 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 { ScatterTriangulationSeries } from "./ScatterTriangulationSeries"; import { DependencyProperty } from "igniteui-react-core"; import { Point_$type, typeCast, Number_$type, fromEnum, runOn, delegateRemove, delegateCombine, markType, markDep } from "igniteui-react-core"; import { ValueBrushScale } from "./ValueBrushScale"; import { FastItemIntColumn } from "igniteui-react-core"; import { LinearContourValueResolver } from "./LinearContourValueResolver"; import { SeriesView } from "./SeriesView"; import { DataLegendSeriesValueInfo } from "igniteui-react-core"; import { DataLegendSeriesContext } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { IFastItemsSource_$type } from "igniteui-react-core"; import { ScalerParams } from "./ScalerParams"; import { ContourBuilder } from "./ContourBuilder"; import { Clipper } from "igniteui-react-core"; import { RectUtil } from "igniteui-react-core"; import { Brush } from "igniteui-react-core"; import { BrushUtil } from "igniteui-react-core"; import { BrushCollection } from "igniteui-react-core"; import { DataContext } from "igniteui-react-core"; import { Path } from "igniteui-react-core"; import { PropertyMetadata } from "igniteui-react-core"; import { boxArray$1 } from "igniteui-react-core"; import { isNaN_ } from "igniteui-react-core"; import { Pool$1 } from "igniteui-react-core"; import { PathGeometry } from "igniteui-react-core"; import { PathFigure } from "igniteui-react-core"; import { PointCollectionUtil } from "igniteui-react-core"; import { PolyLineSegment } from "igniteui-react-core"; import { Tuple$2 } from "igniteui-react-core"; import { GeometryUtil } from "igniteui-react-core"; import { stringIsNullOrEmpty } from "igniteui-react-core"; /** * @hidden */ export let ScatterContourSeries = /*@__PURE__*/ (() => { class ScatterContourSeries extends ScatterTriangulationSeries { bk() { return new ScatterContourSeries(); } get_fj() { return true; } constructor() { super(); this.yy = null; this.yt = null; FastItemIntColumn.m(); this.ab = ScatterContourSeries.$; this.yu = new LinearContourValueResolver(); } kq(a, b) { let c = this.nd(b); if (c == ScatterContourSeries.$$p[4]) { return this.kr(a, b, this.y7); } return super.kq(a, b); } md(a) { let b = this.nd(a); if (b == ScatterContourSeries.$$p[4]) { return this.y7; } return super.md(a); } ct() { this.yv = new ScatterContourSeriesView(this); return this.yv; } get yz() { return this.yy; } set yz(a) { let b = this.yz != a; if (b) { let c = this.yz; this.yy = a; this.raisePropertyChanged("ValueColumn", c, this.yz); } } getDataLegendSeriesContextAt(a, b) { let c = { $type: Point_$type, x: a, y: b }; let d = this.kn(c); let e = d == null ? NaN : this.ix(d, "XMemberPath"); let f = d == null ? NaN : this.ix(d, "YMemberPath"); let g = d == null ? NaN : this.ix(d, "ValueMemberPath"); let h = new DataLegendSeriesValueInfo(); h.a = 13; h.l = e; h.q = "X"; h.r = this.x2 != null ? this.x2 : "X"; h.s = this.xy != null ? this.xy : "X:"; h.t = this.x0 != null ? this.x0 : ""; let i = new DataLegendSeriesValueInfo(); i.a = 14; i.l = f; i.q = "Y"; i.r = this.ya != null ? this.ya : "Y"; i.s = this.x6 != null ? this.x6 : "Y:"; i.t = this.x8 != null ? this.x8 : ""; let j = new DataLegendSeriesValueInfo(); j.a = 0; j.l = g; j.q = "Value"; j.r = this.y7 != null ? this.y7 : "Value"; j.s = this.y3 != null ? this.y3 : "V:"; j.t = this.y5 != null ? this.y5 : ""; let k = new DataLegendSeriesContext(); k.e = ((() => { let $ret = new List$1(DataLegendSeriesValueInfo.$, 0); $ret.add(h); $ret.add(i); $ret.add(j); return $ret; })()); k.h = this.mc(); return k; } ra(a, b, c, d) { super.ra(a, b, c, d); switch (b) { case ScatterContourSeries.$$p[2]: case ScatterContourSeries.$$p[3]: this.qf(); break; case "FastItemsSource": let e = typeCast(IFastItemsSource_$type, c); if (e != null) { e.deregisterColumn(this.yz); this.yz = null; } let f = typeCast(IFastItemsSource_$type, d); if (f != null) { this.yz = this.dl(this.y7); } this.rs(this.gg && c != null); break; case ScatterContourSeries.$$p[4]: if (this.dp != null) { this.dp.deregisterColumn(this.yz); this.yz = this.dl(this.y7); } this.rs(false); this.ql(); break; case "ValueResolver": this.rs(false); this.ql(); break; case ScatterContourSeries.$$p[1]: let g = c; let h = d; if (g != null) { g.unregisterSeries(this); } if (h != null) { h.registerSeries(this); } this.zb(); this.rs(false); this.ql(); break; case "ActualBrush": this.zb(); this.rs(false); this.ql(); break; } } o5(a, b) { super.o5(a, b); if (a) { b.ca(a); } } rt(a) { super.rt(a); this.za(this.cw); } rr(a, b, c, d, e) { super.rr(a, b, c, d, e); let f = this.ba.a$j.item(d); f.a6(c); if (this.d6(f)) { return; } this.za(f); } za(a) { if (this.d6(a)) { return; } let b; let c; let d = a; let e = a.getViewInfo(c, b); c = e.p0; b = e.p1; let f = new ScalerParams(1, b, c, this.w0.ch); f.c = this.getEffectiveViewport1(a); let g = new ScalerParams(1, b, c, this.w1.ch); g.c = this.getEffectiveViewport1(a); let h = this.w0; let i = this.w1; let j = this.xa.count; let k; let xArr_ = this.xd.asArray(); k = (xArr_.slice(0)); let l; let yArr_ = this.xe.asArray(); l = (yArr_.slice(0)); let m = this.yz.asArray(); let n = this.xa.asArray(); let o = this.xb.asArray(); let p = this.xc.asArray(); let q = this.yu.j(this.yz); let r = new List$1(Number_$type, 1, q).toArray(); h.hq(boxArray$1(k), 0, k.length, f); i.hq(boxArray$1(l), 0, l.length, g); let s = r.length; let t = new Array(s); for (let u = 0; u < s; ++u) { t[u] = new ContourBuilder(); } let v = c.top; let w = c.left; let x = c.right; let y = c.bottom; let z; let aa; let ab; let ac; let ad = k.length; for (let ae = 0; ae < j; ae++) { let af = n[ae]; let ag = o[ae]; let ah = p[ae]; if ((af >= ad) || (ag >= ad) || (ah >= ad) || (af < 0) || (ag < 0) || (ah < 0)) { continue; } let ai = k[af]; let aj = l[af]; let ak = { $type: Point_$type, x: ai, y: aj }; let al = k[ag]; let am = l[ag]; let an = { $type: Point_$type, x: al, y: am }; let ao = k[ah]; let ap = l[ah]; let aq = { $type: Point_$type, x: ao, y: ap }; z = an.y < aq.y ? an.y : aq.y; z = ak.y < z ? ak.y : z; aa = an.y > aq.y ? an.y : aq.y; aa = ak.y > aa ? ak.y : aa; ab = an.x < aq.x ? an.x : aq.x; ab = ak.x < ab ? ak.x : ab; ac = an.x > aq.x ? an.x : aq.x; ac = ak.x > ac ? ak.x : ac; if (z < y && aa > v && ab < x && ac > w) { let ar = m[af]; let as = m[ag]; let at = m[ah]; if (isNaN_(ar) || isNaN_(as) || isNaN_(at)) { continue; } for (let au = 0; au < s; au++) { let av = r[au]; let aw = t[au]; switch ((ar < av ? 1 : 0) | (as < av ? 2 : 0) | (at < av ? 4 : 0)) { case 0: break; case 1: aw.d(aw.k(af, ak.x, ak.y, ar, ag, an.x, an.y, as, av), aw.k(ah, aq.x, aq.y, at, af, ak.x, ak.y, ar, av)); break; case 2: aw.d(aw.k(ag, an.x, an.y, as, ah, aq.x, aq.y, at, av), aw.k(af, ak.x, ak.y, ar, ag, an.x, an.y, as, av)); break; case 3: aw.d(aw.k(ag, an.x, an.y, as, ah, aq.x, aq.y, at, av), aw.k(ah, aq.x, aq.y, at, af, ak.x, ak.y, ar, av)); break; case 4: aw.d(aw.k(ah, aq.x, aq.y, at, af, ak.x, ak.y, ar, av), aw.k(ag, an.x, an.y, as, ah, aq.x, aq.y, at, av)); break; case 5: aw.d(aw.k(af, ak.x, ak.y, ar, ag, an.x, an.y, as, av), aw.k(ag, an.x, an.y, as, ah, aq.x, aq.y, at, av)); break; case 6: aw.d(aw.k(ah, aq.x, aq.y, at, af, ak.x, ak.y, ar, av), aw.k(af, ak.x, ak.y, ar, ag, an.x, an.y, as, av)); break; case 7: break; } } } } let ax = new Clipper(0, RectUtil.r(c, 2), false); let ay = new List$1(List$1.$.specialize(List$1.$.specialize(Point_$type)), 0); for (let az = 0; az < s; ++az) { let a0 = t[az]; let a1 = new List$1(List$1.$.specialize(Point_$type), 0); let a2 = a0.c(); for (let a3 = 0; a3 < a2.count; a3++) { let a4 = a2._inner[a3]; let a5 = new List$1(Point_$type, 0); ax.i = a5; for (let a6 of fromEnum(a4)) { ax.j({ $type: Point_$type, x: a0.g.item(a6), y: a0.h.item(a6) }); } ax.i = null; a1.add(a5); } ay.add(a1); } d.b9(ay, r); } sj() { super.sj(); this.zb(); } zb() { let a = this.vb; if (a == null) { a = this.vh; } if (a == null) { a = BrushUtil.h(255, 255, 255, 255); } let b = new ValueBrushScale(); b.brushes = new BrushCollection(); if (this.yx == null || this.yx.brushes == null || this.yx.brushes.count == 0) { b.brushes.add(BrushUtil.m(a, -0.5)); b.brushes.add(a); } else { for (let c of fromEnum(this.yx.brushes)) { b.brushes.add(c); } } if (this.yx != null) { if (!isNaN_(this.yx.minimumValue)) { b.minimumValue = this.yx.minimumValue; } if (!isNaN_(this.yx.maximumValue)) { b.maximumValue = this.yx.maximumValue; } b.logarithmBase = this.yx.logarithmBase; b.isLogarithmic = this.yx.isLogarithmic; } this.yw = b; } get yu() { return this.yt; } set yu(a) { let b = a != this.yu; if (b) { if (this.yt != null) { let c = this.yt; c.updated = delegateRemove(c.updated, runOn(this, this.zc)); } let d = this.yt; this.yt = a; if (this.yt != null) { let e = this.yt; e.updated = delegateCombine(e.updated, runOn(this, this.zc)); } this.raisePropertyChanged("ValueResolver", d, a); this.rs(false); } } zc(a, b) { this.rs(false); } he(a, b, c) { return super.he(a, b, c) && this.yu != null && this.xd != null && this.xe != null && this.xa != null && this.xb != null && this.xc != null && this.xd.count > 0 && this.xe.count > 0 && this.xa.count > 0 && this.xb.count > 0 && this.xc.count > 0; } a2(a, b) { let c = this.yv.ce(a, b); if (c != null) { return c.dataContext; } return null; } } ScatterContourSeries.$t = /*@__PURE__*/ markType(ScatterContourSeries, 'ScatterContourSeries', ScatterTriangulationSeries.$); ScatterContourSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterContourSeries, 'raisePropertyChanged', ['ActualFillScale:yw:zd', [ValueBrushScale.$, null], 'FillScale:yx:ze', [ValueBrushScale.$, null], 'ValueMemberAsLegendLabel:y3:zf', [2, null], 'ValueMemberAsLegendUnit:y5:zg', [2, null], 'ValueMemberPath:y7:zh', [2, null]]); return ScatterContourSeries; })(); /** * @hidden */ export let ScatterContourSeriesView = /*@__PURE__*/ (() => { class ScatterContourSeriesView extends SeriesView { constructor(a) { super(a); this.b6 = null; this.b5 = null; this.b8 = null; this.b7 = new List$1(Brush.$, 0); this.b4 = null; this.b8 = new List$1(Path.$, 0); this.b5 = a; this.b6 = ((() => { let $ret = new Pool$1(Path.$); $ret.create = runOn(this, this.cf); $ret.destroy = runOn(this, this.cd); $ret.activate = runOn(this, this.cb); $ret.disactivate = runOn(this, this.cc); return $ret; })()); } cf() { let a = new Path(); a.dataContext = ((() => { let $ret = new DataContext(); $ret.series = this.f; return $ret; })()); this.b8.add(a); return a; } cb(a) { a._visibility = 0; } cc(a) { a._visibility = 1; } cd(a) { this.b8.remove(a); } b9(a, b) { let c = 0; this.b4 = b; this.b7.clear(); let d = this.b5.yw; for (let e = 0; e < b.length; e++) { let f = b[e]; let g = a._inner[c]; let h = new PathGeometry(); for (let i = 0; i < g.count; i++) { let j = g._inner[i]; if (j.count == 0) { continue; } let k = PointCollectionUtil.f(j); let l = ((() => { let $ret = new PathFigure(); $ret.isClosed = false; $ret.isFilled = false; $ret.startPoint = k._inner[0]; return $ret; })()); l._segments.add(((() => { let $ret = new PolyLineSegment(); $ret.points = k; return $ret; })())); h.c.add(l); } this.b6.item(c).an = h; if (this.b6.item(c).dataContext != null) { this.b6.item(c).dataContext.item = f; } if (d != null) { let m = d.getBrushByValue(f, this.b5.yz); if (m == null) { m = this.f.vb; } this.b7.add(m); } else { this.b7.add(this.f.vb); } c++; } this.b6.count = c; this.av(); } bk(a, b) { super.bk(a, b); let c = a; c._stroke = this.b7._inner[b]; c.ad = this.f.ie; if (c.y != null) { this.l.j(c, c.y); } } bl(a, b) { super.bl(a, b); let c = a; let d = this.bw(b); c._stroke = d; c.ad = this.f.ie + 3; } bc(a, b) { super.bc(a, b); for (let c = 0; c < this.b8.count; c++) { let d = this.b8._inner[c]; if (d._visibility != 1) { this.bj(d, c, b); a.t(d); } } } ca(a) { this.b6.count = 0; this.av(); } aq(a) { super.aq(a); let b = new List$1(Tuple$2.$.specialize(Number_$type, Path.$), 0); if (this.b4 != null) { for (let c = 0; c < this.b6.count; c++) { b.add(new Tuple$2(Number_$type, Path.$, this.b4[c], this.b6.item(c))); } } b.aa((d, e) => { if (d.c < e.c) { return -1; } else if (d.c > e.c) { return 1; } return 0; }); for (let d = 0; d < b.count; d++) { let e = typeCast(Path.$, b._inner[d].d); if (e._visibility != 1) { this.f.bc.exportPathData(a, e, "contour" + d, ["Main "]); } } } 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.b5.title + "</span><br/>"; if (!stringIsNullOrEmpty(this.b5.y7)) { a += "<span>Value: ${item}</span>"; } a += "</div>"; return a; } ce(a, b) { for (let c = 0; c < this.b8.count; c++) { let d = this.b8._inner[c]; let e = typeCast(PathGeometry.$, d.an); if (e != null) { for (let f = 0; f < e.c.count; f++) { let g = e.c._inner[f]; let h = e.c._inner[f]._startPoint; for (let i = 0; i < g._segments.count; i++) { let j = typeCast(PolyLineSegment.$, g._segments._inner[i]); if (j != null) { let k = this.b5.ie / 2 + this.b5.iu(b); if (j._points.count > 0 && GeometryUtil.e(a, h, j._points, k)) { return d; } } } } } } return null; } } ScatterContourSeriesView.$t = /*@__PURE__*/ markType(ScatterContourSeriesView, 'ScatterContourSeriesView', SeriesView.$); return ScatterContourSeriesView; })();