igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
883 lines (882 loc) • 30.7 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-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 { Base, runOn, enumGetBox, Number_$type, typeCast, fromEnum, markType, markDep, PointUtil } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { Marker } from "./Marker";
import { ShapeSeriesViewBase } from "./ShapeSeriesViewBase";
import { ScalerParams } from "./ScalerParams";
import { Dictionary$2 } from "igniteui-angular-core";
import { OwnedPoint } from "./OwnedPoint";
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 { 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.aa5 = null;
this.aa2 = new ScalerParams(1, ScatterPolygonSeries.acc, ScatterPolygonSeries.acc, false);
this.aa3 = new ScalerParams(1, ScatterPolygonSeries.acc, ScatterPolygonSeries.acc, false);
this.abs = null;
this.aax = 1;
this.aat = 1;
this.ab = ScatterPolygonSeries.$;
}
bk() {
return new ScatterPolygonSeries();
}
get_ft() {
return true;
}
get_fo() {
return true;
}
aa8(a, b) {
if (this.hasMarkers && this.aa7()) {
let c = this.xa(a);
if (c.isEmpty) {
return false;
}
let d = RectUtil.r(c, this.i1(b));
if (d.containsPoint(a)) {
return true;
}
}
return false;
}
g2(a, b) {
if (this.aa8(a, b)) {
return true;
}
if (this.g5(a, b)) {
return true;
}
return false;
}
w9(a) {
if (!this.hasMarkers || !this.aa7()) {
return Rect.empty;
}
let b = this.aa4.ch(this.wq(a));
if (b != null) {
return this.aa4.ei(b);
}
return Rect.empty;
}
yz() {
return this.aa7();
}
z7(a) {
let b = a;
b.db(this.ace);
b.dc(this.aa6);
super.z7(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.aa2 = new ScalerParams(1, d, c, this.xy.dn);
this.aa2.c = f;
this.aa3 = new ScalerParams(1, d, c, this.x0.dn);
this.aa3.c = f;
if (c.width < 1 || c.height < 1) {
return;
}
this.aa5 = ((() => {
let $ret = new ShapeAxisInfoCache();
$ret.a = this.xy;
$ret.b = this.x0;
$ret.e = this.xy.dn;
$ret.f = this.x0.dn;
$ret.d = this.dp;
$ret.c = this.yg;
return $ret;
})());
if (this.aa7()) {
let g = new Dictionary$2(Base.$, OwnedPoint.$, 0);
b.du.l(g, 400, d, c, this.ik);
b.du.j(g, false);
if (this.yx()) {
this.abp(a);
}
}
}
abp(a) {
a.dy = true;
this.x5.ay(this, this.yx(), runOn(this, this.xo));
let b = this.x5.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.z2(g, e, a.t);
}
this.x5.ac(f, h);
}
});
}
aa7() {
return this.abs != null && ((this.aa1 != 1 && this.aa1 != 0) || this.abt != null);
}
ct() {
return new ScatterPolygonSeriesView(this);
}
rg(a) {
super.rg(a);
this.aa4 = a;
}
get_hasMarkers() {
return true;
}
get_en() {
return this.aa1 != 13 && this.aa1 != 1;
}
v4() {
return this.ab8;
}
v5() {
return this.ab9;
}
tg() {
return this.abr;
}
ml() {
return this.mm(this, this.abs);
}
iu() {
return this.aba;
}
get aay() {
return this.aax;
}
set aay(a) {
this.aax = a;
}
aa0() {
if (this.aaz == 0) {
return 1;
}
return this.aaz;
}
s2(a) {
super.s2(a);
this.aaz = a;
}
get aau() {
return this.aat;
}
set aau(a) {
this.aat = a;
}
aaw() {
if (this.aav == 0) {
return 2;
}
return this.aav;
}
s1(a) {
super.s1(a);
this.aav = a;
}
s3(a) {
super.s3(a);
this.aba = a;
}
sy() {
super.sy();
if (this.index < 0) {
return;
}
if (this.abt != null) {
this.aa4.d8();
this.aa4.d5();
}
else {
let a = MarkerSeries.xv(this, this.aa1);
let b = MarkerSeries.x8(a);
if (b == null) {
this.abr = MarkerSeries.yn;
}
else {
this.aa4.d2(b);
}
}
if (this.aca != null && this.aa1 != 13) {
this.sp("ActualMarkerBrush");
let c = this.ab8;
this.aa4.d6();
this.aa4.d3();
let d = this.ab8;
let e = this.fk("ActualMarkerBrush", this.h1.f > 0 ? this.h1.d() : null, c, d);
this.sr("ActualMarkerBrush", e);
}
else {
if (this.aa1 == 13) {
this.ab8 = this.cw.b5();
}
else {
if (this.aau != 2) {
if (this.dc != null) {
let f = this.dc.x1(this.index);
if (!isNaN_(this.ij) && this.ij != 1) {
f = BrushUtil.s(f, this.ij);
}
this.ab8 = f;
}
else {
this.ab8 = null;
}
}
}
}
if (this.acb != null) {
this.aa4.d7();
this.aa4.d4();
}
else {
if (this.aa1 == 13) {
this.ab9 = this.cw.b5();
}
else {
if (this.aaz == 2) {
this.ab9 = this.ab8;
}
else {
this.ab9 = this.dc == null ? null : this.dc.x2(this.index);
}
}
}
if (this.aau == 2 && this.aca == null && this.aa1 != 13) {
if (this.ab9 != null) {
let g = this.ab9;
if (!isNaN_(this.ij) && this.ij != 1) {
g = BrushUtil.s(g, this.ij);
}
this.ab8 = g;
}
else {
this.ab8 = null;
}
}
}
q7() {
super.q7();
this.aay = this.aa0();
this.aau = this.aaw();
}
rp(a, b, c, d) {
super.rp(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.rv(b);
this.ri();
break;
case ScatterPolygonSeries.$$p[6]:
this.aay = this.aa0();
this.rv(null);
this.ri();
break;
case ScatterPolygonSeries.$$p[5]:
this.aau = this.aaw();
this.rv(null);
this.ri();
break;
case ScatterPolygonSeries.$$p[2]:
this.abs = d;
if (c == MarkerSeries.yn || d == MarkerSeries.yn || (c == null || d != null)) {
this.aa4.ea();
this.r7(false);
}
this.cw.bx();
if (this.toolTip != null && this.fl) {
this.ba.a$at(this, this.toolTip);
}
this.r7(false);
this.qz();
break;
case ScatterPolygonSeries.$$p[12]:
this.aa4.db(this.ace);
this.r7(false);
this.qz();
break;
case ScatterPolygonSeries.$$p[13]:
this.aa4.dc(this.aa6);
this.r7(false);
this.qz();
break;
case ScatterPolygonSeries.$$p[4]:
this.r7(false);
this.qz();
break;
case ScatterPolygonSeries.$$p[0]:
case ScatterPolygonSeries.$$p[1]:
if (this.aa7()) {
this.r7(false);
}
break;
}
}
a2(a, b) {
let c = this.aa4.ch(a);
let d = null;
if (c != null) {
d = c.content;
}
if (d != null) {
return d;
}
return super.a2(a, b);
}
abq(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.xy;
let g = new ScalerParams(1, this.dc.yr, this.xc, f.dn);
g.c = this.getEffectiveViewport1(this.cw);
let h = this.x0;
let i = new ScalerParams(1, this.dc.yr, this.xc, h.dn);
i.c = this.getEffectiveViewport1(this.cw);
a.clear();
this.aa4.d9((j) => {
if (j._visibility == 0) {
let k = new SeriesPointOfInterest();
let l = j.n;
let m = j.o;
if (!e && (l < this.xc.left || l > this.xc.right || m < this.xc.top || m > this.xc.bottom)) {
return;
}
k.d = f.f8(l, g);
k.e = h.f8(m, i);
k.b = j.content;
k.g = this.vz;
k.c = j.ak;
if (this.hf) {
k.g = this.v6(j.ak);
}
a.add(k);
}
});
return true;
}
aar(a, b, c, d, e) {
if (c == null || c.length != this.aa5.d.count) {
c = new Array(this.aa5.d.count);
for (let f = 0; f < this.aa5.d.count; f++) {
c[f] = PointUtil.create();
}
}
let g = ((() => {
let $ret = new ScalerParams(1, d, e, this.xy.dn);
$ret.c = this.getEffectiveViewport1(a);
return $ret;
})());
let h = ((() => {
let $ret = new ScalerParams(1, d, e, this.x0.dn);
$ret.c = this.getEffectiveViewport1(a);
return $ret;
})());
let i = this.w3(a);
let j = this.aa5.a.f8(i.left, g);
let k = this.aa5.a.f8(i.right, g);
let l = this.aa5.b.f8(i.bottom, h);
let m = this.aa5.b.f8(i.top, h);
if (this.aa5.e) {
let n = j;
j = k;
k = n;
}
if (this.aa5.f) {
let o = l;
l = m;
m = o;
}
let p = this.aa5;
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.aa5.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;
}
aa9(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.qh(a, c, b);
return c.toArray();
}
qh(a, b, c) {
this.zz(a, b, c);
}
}
ScatterPolygonSeries.$t = markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$);
ScatterPolygonSeries.acc = new Rect(0, 0, 0, 1, 1);
ScatterPolygonSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:ab8:abu', [Brush.$], 'ActualMarkerOutline:ab9:abv', [Brush.$], 'ActualMarkerTemplate:abr:abw', [DataTemplate.$, null], 'MarkerBrush:aca:abx', [Brush.$], 'MarkerCollisionAvoidance:aas:aby', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerFillMode:aav:abz', [MarkerFillMode_$type, enumGetBox(MarkerFillMode_$type, 0)], 'MarkerOutlineMode:aaz:ab0', [MarkerOutlineMode_$type, enumGetBox(MarkerOutlineMode_$type, 0)], 'MarkerOutline:acb:ab1', [Brush.$], 'MarkerStyle:acd:ab2', [Style.$], 'MarkerTemplate:abt:ab3', [DataTemplate.$, null], 'MarkerThickness:aba:ab4', [1, DeviceUtils.g(2)], 'MarkerType:aa1:ab5', [MarkerType_$type, enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:ace:ab6', [Style.$, null], 'ShapeStyleSelector:aa6:ab7', [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.aa5.d.item(b), runOn(this, this.ef), runOn(this, this.dn), runOn(this, this.dz), () => this.dv.aas);
this.dt.q = runOn(this, this.ej);
}
a4() {
super.a4();
if (!this.t) {
this.dv.acb = Defaults.bb;
this.dv.jy = Defaults.am;
this.dv.aba = Defaults.al;
this.dv.aa1 = Defaults.f;
this.dv.aav = 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.abq(a, this.dw);
}
dn() {
this.dp = this.dv.aar(this, this.dw, this.dp, this.ca, this.b9);
return this.dp;
}
dz() {
this.d0 = this.dv.aa9(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.abr;
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.ab8 != null) {
d.actualItemBrush = this.dv.ab8;
}
else {
d.actualItemBrush = this.cj.vs;
}
if (this.dv.ab8 != null) {
d.outline = this.dv.ab9;
}
else {
d.outline = this.cj.vw;
}
d.thickness = this.dv.aba;
}
}
}
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.aba + 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.abr != null && this.dv.abr.passStarting != null) {
this.dv.abr.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.abr != null && this.dv.abr.passCompleted != null) {
this.dv.abr.passCompleted(c);
}
}
d8() {
this.dv.abr = null;
}
d5() {
this.dv.abr = null;
this.dv.abr = this.dv.abt;
}
d6() {
this.dv.ab8 = null;
}
d3() {
this.dv.ab8 = null;
if (!isNaN_(this.f.ij) && this.f.ij != 1) {
let a = BrushUtil.s(this.dv.aca, this.f.ij);
this.dv.ab8 = a;
}
else {
this.dv.ab8 = this.dv.aca;
}
}
d7() {
this.dv.ab9 = null;
}
d4() {
this.dv.ab9 = null;
this.dv.ab9 = this.dv.acb;
}
d2(a) {
switch (a) {
case "CircleMarkerTemplate":
this.dv.abr = this.dv.dc.uh;
break;
case "TriangleMarkerTemplate":
this.dv.abr = this.dv.dc.uq;
break;
case "PyramidMarkerTemplate":
this.dv.abr = this.dv.dc.un;
break;
case "SquareMarkerTemplate":
this.dv.abr = this.dv.dc.uo;
break;
case "DiamondMarkerTemplate":
this.dv.abr = this.dv.dc.ui;
break;
case "PentagonMarkerTemplate":
this.dv.abr = this.dv.dc.ul;
break;
case "HexagonMarkerTemplate":
this.dv.abr = this.dv.dc.uj;
break;
case "TetragramMarkerTemplate":
this.dv.abr = this.dv.dc.ul;
break;
case "PentagramMarkerTemplate":
this.dv.abr = this.dv.dc.um;
break;
case "HexagramMarkerTemplate":
this.dv.abr = this.dv.dc.uk;
break;
}
}
ea() {
for (let a of fromEnum(this.d1)) {
a.ah = this.dv.abr;
}
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.abr);
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 = markType(ScatterPolygonSeriesView, 'ScatterPolygonSeriesView', ShapeSeriesViewBase.$);
return ScatterPolygonSeriesView;
})();