igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
844 lines (843 loc) • 28.8 kB
JavaScript
/*
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_fq() {
return true;
}
get_fl() {
return true;
}
constructor() {
super();
this.aan = null;
this.aak = new ScalerParams(1, ScatterPolygonSeries.abt, ScatterPolygonSeries.abt, false);
this.aal = new ScalerParams(1, ScatterPolygonSeries.abt, ScatterPolygonSeries.abt, false);
this.aa9 = null;
this.aaf = 1;
this.aab = 1;
this.ab = ScatterPolygonSeries.$;
}
yh() {
return this.aap();
}
zp(a) {
let b = a;
b.c2(this.abv);
b.c3(this.aao);
super.zp(a);
if (this.d6(a)) {
return;
}
let c, d;
let e = a.getViewInfo(c, d);
c = e.p0;
d = e.p1;
let f = this.getEffectiveViewport1(a);
this.aak = new ScalerParams(1, d, c, this.xg.ch);
this.aak.c = f;
this.aal = new ScalerParams(1, d, c, this.xi.ch);
this.aal.c = f;
if (c.width < 1 || c.height < 1) {
return;
}
this.aan = ((() => {
let $ret = new ShapeAxisInfoCache();
$ret.a = this.xg;
$ret.b = this.xi;
$ret.e = this.xg.ch;
$ret.f = this.xi.ch;
$ret.d = this.dp;
$ret.c = this.xy;
return $ret;
})());
if (this.aap()) {
let g = new Dictionary$2(Base.$, OwnedPoint.$, 0);
b.dk.l(g, 400, d, c, this.id);
b.dk.j(g, false);
if (this.yf()) {
this.aa6(a);
}
}
}
aa6(a) {
a.dp = true;
this.xn.ay(this, this.yf(), runOn(this, this.w6));
let b = this.xn.d;
let c = b != null;
let d = this.getEffectiveViewport1(a);
let e = this.dp == null ? 0 : this.dp.count;
a.d0((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.zk(g, e, a.r);
}
this.xn.ac(f, h);
}
});
}
aap() {
return this.aa9 != null && ((this.aaj != 1 && this.aaj != 0) || this.aba != null);
}
ct() {
return new ScatterPolygonSeriesView(this);
}
q1(a) {
super.q1(a);
this.aam = a;
}
get_hasMarkers() {
return true;
}
get_em() {
return this.aaj != 13 && this.aaj != 1;
}
vn() {
return this.abp;
}
vo() {
return this.abq;
}
s1() {
return this.aa8;
}
ma() {
return this.mb(this, this.aa9);
}
io() {
return this.aar;
}
get aag() {
return this.aaf;
}
set aag(a) {
this.aaf = a;
}
aai() {
if (this.aah == 0) {
return 1;
}
return this.aah;
}
sn(a) {
super.sn(a);
this.aah = a;
}
get aac() {
return this.aab;
}
set aac(a) {
this.aab = a;
}
aae() {
if (this.aad == 0) {
return 2;
}
return this.aad;
}
sm(a) {
super.sm(a);
this.aad = a;
}
so(a) {
super.so(a);
this.aar = a;
}
sj() {
super.sj();
if (this.index < 0) {
return;
}
if (this.aba != null) {
this.aam.dz();
this.aam.dw();
}
else {
let a = MarkerSeries.xd(this, this.aaj);
let b = MarkerSeries.xq(a);
if (b == null) {
this.aa8 = MarkerSeries.x5;
}
else {
this.aam.dt(b);
}
}
if (this.abr != null && this.aaj != 13) {
this.sa("ActualMarkerBrush");
let c = this.abp;
this.aam.dx();
this.aam.du();
let d = this.abp;
let e = this.fh("ActualMarkerBrush", this.hv.f > 0 ? this.hv.d() : null, c, d);
this.sc("ActualMarkerBrush", e);
}
else {
if (this.aaj == 13) {
this.abp = this.cw.bx();
}
else {
if (this.aac != 2) {
if (this.dc != null) {
let f = this.dc.vf(this.index);
if (!isNaN_(this.ic) && this.ic != 1) {
f = BrushUtil.q(f, this.ic);
}
this.abp = f;
}
else {
this.abp = null;
}
}
}
}
if (this.abs != null) {
this.aam.dy();
this.aam.dv();
}
else {
if (this.aaj == 13) {
this.abq = this.cw.bx();
}
else {
if (this.aah == 2) {
this.abq = this.abp;
}
else {
this.abq = this.dc == null ? null : this.dc.vg(this.index);
}
}
}
if (this.aac == 2 && this.abr == null && this.aaj != 13) {
if (this.abq != null) {
let g = this.abq;
if (!isNaN_(this.ic) && this.ic != 1) {
g = BrushUtil.q(g, this.ic);
}
this.abp = g;
}
else {
this.abp = null;
}
}
}
qs() {
super.qs();
this.aag = this.aai();
this.aac = this.aae();
}
ra(a, b, c, d) {
super.ra(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.rg(b);
this.q3();
break;
case ScatterPolygonSeries.$$p[6]:
this.aag = this.aai();
this.rg(null);
this.q3();
break;
case ScatterPolygonSeries.$$p[5]:
this.aac = this.aae();
this.rg(null);
this.q3();
break;
case ScatterPolygonSeries.$$p[2]:
this.aa9 = d;
if (c == MarkerSeries.x5 || d == MarkerSeries.x5 || (c == null || d != null)) {
this.aam.d1();
this.rs(false);
}
this.cw.bp();
if (this.toolTip != null && this.fi) {
this.ba.a$as(this, this.toolTip);
}
this.rs(false);
this.ql();
break;
case ScatterPolygonSeries.$$p[12]:
this.aam.c2(this.abv);
this.rs(false);
this.ql();
break;
case ScatterPolygonSeries.$$p[13]:
this.aam.c3(this.aao);
this.rs(false);
this.ql();
break;
case ScatterPolygonSeries.$$p[4]:
this.rs(false);
this.ql();
break;
case ScatterPolygonSeries.$$p[0]:
case ScatterPolygonSeries.$$p[1]:
if (this.aap()) {
this.rs(false);
}
break;
}
}
a2(a, b) {
let c = this.aam.b8(a);
let d = null;
if (c != null) {
d = c.content;
}
if (d != null) {
return d;
}
return super.a2(a, b);
}
aa7(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);
}
}
ec(a, b, c, d, e) {
if (!this.hasMarkers) {
return false;
}
let f = this.xg;
let g = new ScalerParams(1, this.dc.v5, this.wu, f.ch);
g.c = this.getEffectiveViewport1(this.cw);
let h = this.xi;
let i = new ScalerParams(1, this.dc.v5, this.wu, h.ch);
i.c = this.getEffectiveViewport1(this.cw);
a.clear();
this.aam.d0((j) => {
if (j._visibility == 0) {
let k = new SeriesPointOfInterest();
let l = j.n;
let m = j.o;
if (l < this.wu.left || l > this.wu.right || m < this.wu.top || m > this.wu.bottom) {
return;
}
k.d = f.eo(l, g);
k.e = h.eo(m, i);
k.b = j.content;
k.g = this.vi;
k.c = j.ak;
if (this.g9) {
k.g = this.vp(j.ak);
}
a.add(k);
}
});
return true;
}
z9(a, b, c, d, e) {
if (c == null || c.length != this.aan.d.count) {
c = new Array(this.aan.d.count);
for (let f = 0; f < this.aan.d.count; f++) {
c[f] = PointUtil.create();
}
}
let g = ((() => {
let $ret = new ScalerParams(1, d, e, this.xg.ch);
$ret.c = this.getEffectiveViewport1(a);
return $ret;
})());
let h = ((() => {
let $ret = new ScalerParams(1, d, e, this.xi.ch);
$ret.c = this.getEffectiveViewport1(a);
return $ret;
})());
let i = this.wl(a);
let j = this.aan.a.eo(i.left, g);
let k = this.aan.a.eo(i.right, g);
let l = this.aan.b.eo(i.bottom, h);
let m = this.aan.b.eo(i.top, h);
if (this.aan.e) {
let n = j;
j = k;
k = n;
}
if (this.aan.f) {
let o = l;
l = m;
m = o;
}
let p = this.aan;
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.aan.d.count; y++) {
s = 0;
t = 0;
let z = null;
let aa = a.cg.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;
}
aaq(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.p4(a, c, b);
return c.toArray();
}
p4(a, b, c) {
this.zh(a, b, c);
}
}
ScatterPolygonSeries.$t = /*@__PURE__*/ markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$);
ScatterPolygonSeries.abt = /*@__PURE__*/ new Rect(0, 0, 0, 1, 1);
ScatterPolygonSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:abp:abb', [Brush.$], 'ActualMarkerOutline:abq:abc', [Brush.$], 'ActualMarkerTemplate:aa8:abd', [DataTemplate.$, null], 'MarkerBrush:abr:abe', [Brush.$], 'MarkerCollisionAvoidance:aaa:abf', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerFillMode:aad:abg', [MarkerFillMode_$type, /*@__PURE__*/ enumGetBox(MarkerFillMode_$type, 0)], 'MarkerOutlineMode:aah:abh', [MarkerOutlineMode_$type, /*@__PURE__*/ enumGetBox(MarkerOutlineMode_$type, 0)], 'MarkerOutline:abs:abi', [Brush.$], 'MarkerStyle:abu:abj', [Style.$], 'MarkerTemplate:aba:abk', [DataTemplate.$, null], 'MarkerThickness:aar:abl', [1, /*@__PURE__*/ DeviceUtils.g(2)], 'MarkerType:aaj:abm', [MarkerType_$type, /*@__PURE__*/ enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:abv:abn', [Style.$, null], 'ShapeStyleSelector:aao:abo', [StyleSelector.$, null]]);
return ScatterPolygonSeries;
})();
/**
* @hidden
*/
export let ScatterPolygonSeriesView = /*@__PURE__*/ (() => {
class ScatterPolygonSeriesView extends ShapeSeriesViewBase {
constructor(a) {
super(a);
this.dp = false;
this.df = null;
this.dr = null;
this.dl = null;
this.dj = null;
this.dn = false;
this.dm = null;
this.ds = null;
this.dg = new Marker();
this.d8 = null;
this.dg = new Marker();
this.dg.content = new DataContext();
this.dl = a;
this.dm = new HashPool$2(Base.$, Marker.$);
this.ds = new List$1(Marker.$, 0);
this.d2(this.dm);
this.dj = new NumericMarkerManager(1, (b) => this.dm.item(b), (b) => this.dl.aan.d.item(b), runOn(this, this.d6), runOn(this, this.de), runOn(this, this.dq), () => this.dl.aaa);
this.dj.q = runOn(this, this.d9);
}
ax() {
super.ax();
if (!this.r) {
this.dl.abs = Defaults.am;
this.dl.jp = Defaults.z;
this.dl.aar = Defaults.y;
this.dl.aaj = Defaults.f;
this.dl.aad = Defaults.b;
}
}
get dk() {
return this.dj;
}
d6(a) {
this.dl.aa7(a, this.dm);
}
de() {
this.df = this.dl.z9(this, this.dm, this.df, this.b2, this.b1);
return this.df;
}
dq() {
this.dr = this.dl.aaq(this.dm, this.dr);
return this.dr;
}
c9(a, b) {
return this.da(a, b, true);
}
cq(a, b, c) {
super.cq(a, b, c);
ShapeSeriesViewBase.cp(this, a, b);
}
co(a, b) {
let c = a;
if (c == null) {
return;
}
c.an = b;
}
d0(a) {
this.dm.f(a);
}
d2(a) {
a.create = runOn(this, this.di);
a.destroy = runOn(this, this.d4);
a.activate = runOn(this, this.d3);
a.disactivate = runOn(this, this.d5);
}
di() {
let a = new Marker();
if (!this.dn) {
a.content = ((() => {
let $ret = new DataContext();
$ret.series = this.f;
return $ret;
})());
}
a.ah = this.f.aa8;
this.ds.add(a);
return a;
}
b8(a) {
let b = this.dh(a, 0);
if (b == null) {
b = this.dh(a, 3);
}
return b;
}
dh(a, b) {
let c;
let d;
let e;
let f;
for (let g = this.ds.count - 1; g >= 0; g--) {
let h = this.ds._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;
}
d4(a) {
a.content = null;
this.ds.remove(a);
}
d3(a) {
a._visibility = 0;
}
d5(a) {
if (a.content != null) {
(typeCast(DataContext.$, a.content)).item = null;
}
a._visibility = 1;
}
d7(a) {
this.dn = a;
}
bn(a, b) {
super.bn(a, b);
if (!this.dp) {
let c = a;
let d = c.content;
if (d != null) {
if (this.dl.abp != null) {
d.actualItemBrush = this.dl.abp;
}
else {
d.actualItemBrush = this.ca.vb;
}
if (this.dl.abp != null) {
d.outline = this.dl.abq;
}
else {
d.outline = this.ca.vf;
}
d.thickness = this.dl.aar;
}
}
}
bo(a, b) {
super.bo(a, b);
let c = a;
this.dg._visibility = c._visibility;
this.dg.ah = c.ah;
this.dg.width = c.width;
this.dg.height = c.height;
this.dg.m = c.m;
this.dg.l = c.l;
this.dg.n = c.n;
this.dg.o = c.o;
let d = this.bw(b);
let e = this.dg.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.dl.aar + 3;
}
}
bb(a, b) {
super.bb(a, b);
let c = new DataTemplatePassInfo();
c.isHitTestRender = b;
c.context = a.h();
c.viewportTop = this.b1.top;
c.viewportLeft = this.b1.left;
c.viewportWidth = this.b1.width;
c.viewportHeight = this.b1.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.dl.aa8 != null && this.dl.aa8.passStarting != null) {
this.dl.aa8.passStarting(c);
}
for (let j = 0; j < this.ds.count; j++) {
let k = this.ds._inner[j];
if (k._visibility == 1) {
continue;
}
this.bm(k, j, b);
if (b) {
k = this.dg;
}
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.dl.aa8 != null && this.dl.aa8.passCompleted != null) {
this.dl.aa8.passCompleted(c);
}
}
dz() {
this.dl.aa8 = null;
}
dw() {
this.dl.aa8 = null;
this.dl.aa8 = this.dl.aba;
}
dx() {
this.dl.abp = null;
}
du() {
this.dl.abp = null;
if (!isNaN_(this.f.ic) && this.f.ic != 1) {
let a = BrushUtil.q(this.dl.abr, this.f.ic);
this.dl.abp = a;
}
else {
this.dl.abp = this.dl.abr;
}
}
dy() {
this.dl.abq = null;
}
dv() {
this.dl.abq = null;
this.dl.abq = this.dl.abs;
}
dt(a) {
switch (a) {
case "CircleMarkerTemplate":
this.dl.aa8 = this.dl.dc.r2;
break;
case "TriangleMarkerTemplate":
this.dl.aa8 = this.dl.dc.sb;
break;
case "PyramidMarkerTemplate":
this.dl.aa8 = this.dl.dc.r8;
break;
case "SquareMarkerTemplate":
this.dl.aa8 = this.dl.dc.r9;
break;
case "DiamondMarkerTemplate":
this.dl.aa8 = this.dl.dc.r3;
break;
case "PentagonMarkerTemplate":
this.dl.aa8 = this.dl.dc.r6;
break;
case "HexagonMarkerTemplate":
this.dl.aa8 = this.dl.dc.r4;
break;
case "TetragramMarkerTemplate":
this.dl.aa8 = this.dl.dc.r6;
break;
case "PentagramMarkerTemplate":
this.dl.aa8 = this.dl.dc.r7;
break;
case "HexagramMarkerTemplate":
this.dl.aa8 = this.dl.dc.r5;
break;
}
}
d1() {
for (let a of fromEnum(this.ds)) {
a.ah = this.dl.aa8;
}
this.av();
}
d9(a) {
if (this.d8 == null) {
this.d8 = new DataTemplateMeasureInfo();
this.d8.context = this.l.h();
}
this.d8.width = a.width;
this.d8.height = a.height;
this.d8.data = a.content;
let b = a.ah;
if (b.measure != null) {
b.measure(this.d8);
}
return new Size(1, this.d8.width, this.d8.height);
}
aq(a) {
let b = a;
super.aq(b);
for (let c of fromEnum(this.dm.c)) {
let d = this.dm.item(c);
if (d._visibility != 1) {
let e = typeCast(ScatterPolygonSeries.$, this.f);
let f = this.f.bc.getMarkerVisualData(e, d, e.aa8);
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.dl.title + "</span><br/>";
a += "</div>";
return a;
}
}
ScatterPolygonSeriesView.$t = /*@__PURE__*/ markType(ScatterPolygonSeriesView, 'ScatterPolygonSeriesView', ShapeSeriesViewBase.$);
return ScatterPolygonSeriesView;
})();