igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
718 lines (717 loc) • 26.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 { AnnotationLayer } from "./AnnotationLayer";
import { ValueLayerValueMode_$type } from "./ValueLayerValueMode";
import { DependencyProperty } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { Series } from "./Series";
import { Axis } from "./Axis";
import { Base, enumGetBox, Delegate_$type, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { ValueLayerFrame } from "./ValueLayerFrame";
import { List$1 } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { DoubleCollection } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { Tuple$2 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, truncate } from "igniteui-angular-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { Defaults } from "./Defaults";
import { TranslateTransform } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { Color } from "igniteui-angular-core";
/**
* @hidden
*/
export let ValueLayer = /*@__PURE__*/ (() => {
class ValueLayer extends AnnotationLayer {
constructor() {
super();
this.zx = [NaN, NaN];
this.z1 = null;
this.z2 = null;
this.ac2 = null;
this.aac = null;
this.aab = null;
let a = new ValueLayerFrame();
let b = new ValueLayerFrame();
let c = new ValueLayerFrame();
let d = this.kd / 1000;
this.xc = a;
this.xb = b;
this.xd = c;
this.ab = ValueLayer.$;
}
bj() {
return new ValueLayer();
}
get_et() {
return true;
}
cs() {
return new ValueLayerView(this);
}
q1(a) {
super.q1(a);
this.z6 = a;
}
gu(a) {
if (this.z3 == null) {
return true;
}
if (this.z3 == a) {
return true;
}
return false;
}
get ac4() {
return new Thickness(1, this.aaf, this.aah, this.aag, this.aae);
}
get ac5() {
return new Thickness(1, this.aal, this.aan, this.aam, this.aak);
}
mc() {
return "Value Layer";
}
get_isSummarizationSupported() {
return false;
}
i5(a, b, c) {
if (isNaN_(this.zx[0]) && isNaN_(this.zx[1])) {
return super.i5(a, b, c);
}
if (!isNaN_(this.zx[0])) {
return this.zx[0];
}
return this.zx[1];
}
getDataLegendSeriesContextAt(a, b) {
if (isNaN_(this.zx[0]) || isNaN_(this.zx[1])) {
return super.getDataLegendSeriesContextAt(a, b);
}
if (this.z3 == null) {
let c = new DataLegendSeriesValueInfo();
c.l = this.zx[0];
c.a = 0;
c.q = "Value";
c.r = "Value";
c.s = "";
let d = new DataLegendSeriesValueInfo();
d.l = this.zx[1];
d.a = 0;
d.q = "Value";
d.r = "Value";
d.s = "";
let e = new DataLegendSeriesContext();
e.e = ((() => {
let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
$ret.add(c);
$ret.add(d);
return $ret;
})());
e.h = this.mc();
return e;
}
let f = this.z3.getDataLegendSeriesContextAt(a, b);
let g = typeCast(DataLegendSeriesContext.$, f);
if (g == null || g.e == null) {
return super.getDataLegendSeriesContextAt(a, b);
}
if (g.e.count == 0) {
g.e._inner[0].l = isNaN_(this.zx[0]) ? this.zx[1] : this.zx[0];
}
else {
g.e._inner[0].l = this.zx[0];
g.e._inner[1].l = this.zx[1];
}
return g;
}
yp(a, b) {
if (this.z3 == null || this.z3 == a) {
if (!this.a1.c) {
this.rr(b);
}
}
}
yr(a, b) {
super.yr(a, b);
let c = a;
let d = this.aaa;
let e = this.z9;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
this.zx = [NaN, NaN];
this.z1 = null;
this.z2 = null;
let f = this.z4();
if (this.xi(this.z3)) {
let g = this.z3.aq(f);
this.zx = g;
this.abs(c, d, e, this.z3);
}
else {
if (f == 5 || f == 4 || f == 6) {
let h = null;
let i = null;
let j = [NaN, NaN];
let k = 0;
for (let l of fromEnum(this.db.series)) {
if (!this.xi(l)) {
continue;
}
let m = l.ai();
for (let o = 0; o < m.length; o++) {
let n = m[o];
if (!this.z8(n)) {
continue;
}
let p = n.cp ? 1 : 0;
let q = j[p];
let r = null;
if (f == 5) {
let s = l.i8(2, n);
if (!isNaN_(s) && (s > q || isNaN_(q))) {
r = l;
}
q = !isNaN_(q) ? Math.max(s, q) : s;
}
else if (f == 4) {
let t = l.i8(1, n);
if (!isNaN_(t) && (t < q || isNaN_(q))) {
r = l;
}
q = !isNaN_(q) ? Math.min(t, q) : t;
}
else if (f == 6) {
let u = l.i8(3, n);
r = l;
q = !isNaN_(q) ? q + u : u;
}
if (n.cp) {
i = r != null ? r : i;
}
else {
h = r != null ? r : h;
}
j[p] = q;
}
k++;
}
if (f == 6) {
j[0] = !isNaN_(j[0]) ? j[0] / k : NaN;
j[1] = !isNaN_(j[1]) ? j[1] / k : NaN;
}
if (h != null && !isNaN_(j[0])) {
let v = h.wg(j);
this.abu(h, { $type: Point_$type, x: v.x, y: NaN }, c, d, e);
}
if (i != null && !isNaN_(j[1])) {
let w = i.wg(j);
this.abu(i, { $type: Point_$type, x: NaN, y: w.y }, c, d, e);
}
this.zx = j;
this.z1 = h;
this.z2 = i;
}
else {
for (let x of fromEnum(this.db.series)) {
this.abs(c, d, e, x);
}
}
}
}
abs(a, b, c, d) {
if (this.xi(d)) {
this.abt(d, a, b, c);
}
if (d.isStacked) {
d.p3((e) => {
if (this.xi(e)) {
this.abt(e, a, b, c);
}
if (e.eg) {
e.p1((f) => {
if (this.xi(f)) {
this.abt(f, a, b, c);
}
return true;
});
}
return true;
});
}
if (d.eg) {
d.p1((e) => {
if (this.xi(e)) {
this.abt(e, a, b, c);
}
return true;
});
}
}
xi(a) {
if (!super.xi(a)) {
return false;
}
if (this.aay != null) {
if (a.fb) {
let b = a.nc();
if (!Base.equalsStatic(this.aay, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aay, a.name)) {
return false;
}
}
}
return true;
}
z8(a) {
if (!a.cj) {
return false;
}
if (this.zy != null && this.zy != a) {
return false;
}
if (this.aav != null && !Base.equalsStatic(this.aav, a.name)) {
return false;
}
return true;
}
qp() {
super.qp();
if (!this.a1.c && !this.d3()) {
return;
}
if (this.d3()) {
this.abv(this.xd, false);
}
else {
this.abv(this.xb, false);
}
}
z4() {
if (this.z5 == 0) {
return 2;
}
return this.z5;
}
w2() {
return 3;
}
xp() {
return 0.3;
}
xs() {
return -0.4;
}
xr() {
return 0.5;
}
zo() {
return this.wz == 3 ? this.ac3() : null;
}
zp() {
return this.w0 == 3 ? this.ac3() : null;
}
ac3() {
if (this.ac2 == null) {
this.ac2 = new DoubleCollection();
this.ac2.add(DeviceUtils.g(5));
this.ac2.add(DeviceUtils.g(5));
}
return this.ac2;
}
abu(a, b, c, d, e) {
let f = false;
let g = this.u9;
if (g == null) {
g = this.vf;
}
if (g == null) {
g = a.u9;
f = true;
}
let h = false;
let i = this.acw;
if (i == null) {
if (this.vf != null) {
i = this.vf;
}
else {
i = a.u9;
h = true;
}
}
let j = false;
let k = this.acz;
if (k == null) {
if (this.vf != null) {
k = this.vf;
}
else {
k = a.u9;
j = true;
}
}
let l = g;
let m = g;
let n = i;
let o = k;
if (this.acu != null) {
l = this.acu;
}
else if (f) {
switch (this.wz) {
case 1:
l = this.z6.ce(l, this.xm);
break;
case 2:
l = this.z6.cg(l, this.xm);
break;
case 4:
l = this.z6.cf(l, this.xm);
break;
}
}
if (this.acv != null) {
m = this.acv;
}
else if (f) {
switch (this.w0) {
case 1:
m = this.z6.ce(m, this.xo);
break;
case 2:
m = this.z6.cg(m, this.xo);
break;
case 4:
m = this.z6.cf(m, this.xo);
break;
}
}
if (h) {
switch (this.w0) {
case 1:
n = this.z6.ce(n, this.xo);
break;
case 2:
n = this.z6.cg(n, this.xo);
break;
}
}
if (j) {
switch (this.wz) {
case 1:
o = this.z6.ce(o, this.xm);
break;
case 2:
o = this.z6.cg(o, this.xm);
break;
}
}
c.ae.add(l);
c.ah.add(m);
c.af.add(b.y);
c.ag.add(b.x);
if (this.z7) {
AxisAnnotationFrameManager.c(c, b, a, this.db, this.getEffectiveViewport(), g, n, this.aad, this.acy, this.acx, this.ac4, this.aai, o, this.aaj, this.ac1, this.ac0, this.ac5, this.aao, this.ac7 == 0, this.ac6 == 0);
}
}
abt(a, b, c, d) {
let e = { $type: Point_$type, x: NaN, y: NaN };
let f = this.z4();
switch (f) {
case 5:
e = a.wf(2);
break;
case 4:
e = a.wf(1);
break;
case 6:
e = a.wf(3);
break;
default:
e = a.wf(f);
break;
}
let i = a.ai();
for (let h = 0; h < i.length; h++) {
let g = i[h];
if (!this.z8(g)) {
continue;
}
if (g.cp) {
this.abu(a, { $type: Point_$type, x: NaN, y: e.y }, b, c, d);
}
else {
this.abu(a, { $type: Point_$type, x: e.x, y: NaN }, b, c, d);
}
}
}
abv(a, b) {
let c = false;
if (this.aab == null) {
c = true;
this.aac = new List$1(Axis.$, 0);
this.aab = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aab, this.aac, b, this.aap, this.aaq, this.zz, this.z0);
}
abr(a, b, c, d, e) {
let f = a.item(b);
b++;
if (e) {
f._stroke = d.ah._inner[c];
f._fill = d.ah._inner[c];
}
else {
f._stroke = d.ae._inner[c];
f._fill = d.ae._inner[c];
}
f.ad = this.ie;
f.ai = e ? this.zn : this.zm;
f.am = this.v5;
f.al = this.v4;
f.ak = this.v4;
f.aj = this.v3;
f.ac = this.jh;
return new Tuple$2(Path.$, Number_$type, f, b);
}
yu(a, b) {
super.yu(a, b);
let c = this.z6.b8;
let d = a;
let e = d.af.count;
let f = 0;
let g = b.bx.left;
let h = b.bx.right;
let i = b.bx.top;
let j = b.bx.bottom;
let k = this.ac7 == 0;
let l = this.ac6 == 0;
for (let m = 0; m < e; m++) {
let n = Math.floor(d.af._inner[m]);
let o = Math.floor(d.ag._inner[m]);
let p = null;
if (k) {
if (!isNaN_(o)) {
let q = this.abr(c, f, m, d, true);
p = q.c;
f = q.d;
let r = new PathGeometry();
let s = new PathFigure();
s._startPoint = { $type: Point_$type, x: o, y: i };
let t = new LineSegment(1);
t.c = { $type: Point_$type, x: o, y: j };
s._segments.add(t);
r.c.add(s);
p.an = r;
}
}
if (l) {
if (!isNaN_(n)) {
let u = this.abr(c, f, m, d, false);
p = u.c;
f = u.d;
let v = new PathGeometry();
let w = new PathFigure();
w._startPoint = { $type: Point_$type, x: g, y: n };
let x = new LineSegment(1);
x.c = { $type: Point_$type, x: h, y: n };
w._segments.add(x);
v.c.add(w);
p.an = v;
}
}
}
c.count = f;
if (this.d3()) {
this.abv(this.xd, true);
}
else {
this.abv(this.xb, false);
}
}
ga() {
return true;
}
q9(a, b, c, d) {
super.q9(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aab != null && this.aab.count > 0) {
let e;
if (this.d3()) {
e = this.xd;
}
else {
e = this.xb;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aab, this.aac, true, this.aap, this.aaq, this.zz, this.z0);
}
}
break;
case ValueLayer.$$p[1]:
this.rr(true);
break;
case ValueLayer.$$p[11]:
this.rr(true);
break;
case ValueLayer.$$p[6]:
case ValueLayer.$$p[7]:
case "Visibility":
this.rr(true);
break;
case ValueLayer.$$p[2]:
case ValueLayer.$$p[13]:
case ValueLayer.$$p[12]:
case ValueLayer.$$p[16]:
case ValueLayer.$$p[18]:
case ValueLayer.$$p[20]:
case ValueLayer.$$p[19]:
case ValueLayer.$$p[17]:
case ValueLayer.$$p[21]:
case ValueLayer.$$p[22]:
case ValueLayer.$$p[24]:
case ValueLayer.$$p[27]:
case ValueLayer.$$p[29]:
case ValueLayer.$$p[31]:
case ValueLayer.$$p[30]:
case ValueLayer.$$p[28]:
case ValueLayer.$$p[32]:
case ValueLayer.$$p[33]:
case ValueLayer.$$p[0]:
case ValueLayer.$$p[10]:
case ValueLayer.$$p[8]:
this.rr(true);
break;
}
}
o5(a, b) {
super.o5(a, b);
if (a) {
AxisAnnotationFrameManager.b(this.xb);
this.abv(this.xb, false);
}
}
}
ValueLayer.$t = markType(ValueLayer, 'ValueLayer', AnnotationLayer.$);
ValueLayer.$$p = markDep(DependencyProperty, PropertyMetadata, ValueLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acu:abw', [Brush.$, null], 'HorizontalLineVisibility:ac6:abx', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:z7:aby', [0, false], 'SkipUnknownValues:z9:abz', [0, true], 'TargetAxisName:aav:ab0', [2, null], 'TargetAxis:zy:ab1', [Axis.$, null], 'TargetSeriesName:aay:ab2', [2, null], 'TargetSeries:z3:ab3', [Series.$, null], 'UseInterpolation:aaa:ab4', [0, true], 'ValueMode:z5:ab5', [ValueLayerValueMode_$type, enumGetBox(ValueLayerValueMode_$type, 2)], 'VerticalLineStroke:acv:ab6', [Brush.$, null], 'VerticalLineVisibility:ac7:ab7', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aad:ab8', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:acw:ab9', [Brush.$, null], 'XAxisAnnotationFormatLabel:zz:aca', [Delegate_$type], 'XAxisAnnotationInterpolatedValuePrecision:aap:acb', [1, -1], 'XAxisAnnotationOutline:acx:acc', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aae:acd', [1, NaN], 'XAxisAnnotationPaddingLeft:aaf:ace', [1, NaN], 'XAxisAnnotationPaddingRight:aag:acf', [1, NaN], 'XAxisAnnotationPaddingTop:aah:acg', [1, NaN], 'XAxisAnnotationStrokeThickness:aai:ach', [1, NaN], 'XAxisAnnotationTextColor:acy:aci', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aaj:acj', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:acz:ack', [Brush.$, null], 'YAxisAnnotationFormatLabel:z0:acl', [Delegate_$type], 'YAxisAnnotationInterpolatedValuePrecision:aaq:acm', [1, -1], 'YAxisAnnotationOutline:ac0:acn', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aak:aco', [1, NaN], 'YAxisAnnotationPaddingLeft:aal:acp', [1, NaN], 'YAxisAnnotationPaddingRight:aam:acq', [1, NaN], 'YAxisAnnotationPaddingTop:aan:acr', [1, NaN], 'YAxisAnnotationStrokeThickness:aao:acs', [1, NaN], 'YAxisAnnotationTextColor:ac1:act', [Brush.$, null]]);
return ValueLayer;
})();
/**
* @hidden
*/
export let ValueLayerView = /*@__PURE__*/ (() => {
class ValueLayerView extends AnnotationLayerView {
constructor(a) {
super(a);
this.b7 = null;
this.b8 = null;
this.b9 = null;
this.b7 = a;
this.b9 = new List$1(Path.$, 0);
}
au() {
super.au();
this.b8 = ((() => {
let $ret = new Pool$1(Path.$);
$ret.create = runOn(this, this.ch);
$ret.activate = runOn(this, this.ca);
$ret.disactivate = runOn(this, this.cc);
$ret.destroy = runOn(this, this.cb);
return $ret;
})());
this.b7.jp = Defaults.j;
}
ch() {
let a = new Path();
a.j = new TranslateTransform();
this.b9.add(a);
return a;
}
ca(a) {
a._visibility = 0;
}
cc(a) {
a._visibility = 1;
}
cb(a) {
this.b9.remove(a);
}
cd(a, b, c, d) {
if (a.an == null || a.an.c.x != d || a.an.d.x != c) {
let e = ((() => {
let $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: c, y: b };
$ret.c = { $type: Point_$type, x: d, y: b };
return $ret;
})());
a.an = e;
}
}
ce(a, b) {
if (a == null) {
return a;
}
return BrushUtil.m(a, b);
}
cg(a, b) {
if (a == null) {
return a;
}
return BrushUtil.o(a, b);
}
cf(a, b) {
if (a == null) {
return a;
}
let c = new Brush();
c.color = Color.u(truncate((a.color.l * b)), a.color.o, a.color.n, a.color.m);
return c;
}
a8(a, b) {
super.a8(a, b);
if (a.d && !b) {
for (let c = 0; c < this.b9.count; c++) {
let d = this.b9._inner[c];
if (d._visibility == 0) {
a.t(d);
}
}
}
}
an(a) {
super.an(a);
for (let b = 0; b < this.b9.count; b++) {
this.e.bc.exportPathData(a, this.b9._inner[b], "crosshairLine", ["Main", "Crosshair"]);
}
}
}
ValueLayerView.$t = markType(ValueLayerView, 'ValueLayerView', AnnotationLayerView.$);
return ValueLayerView;
})();