igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
737 lines (736 loc) • 27.6 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 { BrushUtil } 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 { Color } from "igniteui-angular-core";
/**
* @hidden
*/
export let ValueLayer = /*@__PURE__*/ (() => {
class ValueLayer extends AnnotationLayer {
constructor() {
super();
this.zw = [NaN, NaN];
this.z0 = null;
this.z1 = null;
this.ac4 = null;
this.aab = null;
this.aaa = null;
let a = new ValueLayerFrame();
let b = new ValueLayerFrame();
let c = new ValueLayerFrame();
let d = this.kc / 1000;
this.xb = a;
this.xa = b;
this.xc = c;
this.ab = ValueLayer.$;
}
bj() {
return new ValueLayer();
}
get_et() {
return true;
}
cs() {
return new ValueLayerView(this);
}
q0(a) {
super.q0(a);
this.z5 = a;
}
gt(a) {
if (this.z2 == null) {
return true;
}
if (this.z2 == a) {
return true;
}
return false;
}
get ac6() {
return new Thickness(1, this.aae, this.aag, this.aaf, this.aad);
}
get ac7() {
return new Thickness(1, this.aak, this.aam, this.aal, this.aaj);
}
mb() {
return "Value Layer";
}
get_isSummarizationSupported() {
return false;
}
i4(a, b, c) {
if (isNaN_(this.zw[0]) && isNaN_(this.zw[1])) {
return super.i4(a, b, c);
}
if (!isNaN_(this.zw[0])) {
return this.zw[0];
}
return this.zw[1];
}
getDataLegendSeriesContextAt(a, b) {
if (isNaN_(this.zw[0]) || isNaN_(this.zw[1])) {
return super.getDataLegendSeriesContextAt(a, b);
}
if (this.z2 == null) {
let c = new DataLegendSeriesValueInfo();
c.l = this.zw[0];
c.a = 0;
c.q = "Value";
c.r = "Value";
c.s = "";
let d = new DataLegendSeriesValueInfo();
d.l = this.zw[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.mb();
return e;
}
let f = this.z2.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.zw[0]) ? this.zw[1] : this.zw[0];
}
else {
g.e._inner[0].l = this.zw[0];
g.e._inner[1].l = this.zw[1];
}
return g;
}
yo(a, b) {
if (this.z2 == null || this.z2 == a) {
if (!this.a1.c) {
this.rq(b);
}
}
}
yq(a, b) {
super.yq(a, b);
let c = a;
let d = this.z9;
let e = this.z8;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
this.zw = [NaN, NaN];
this.z0 = null;
this.z1 = null;
let f = this.z3();
if (this.xh(this.z2)) {
let g = this.z2.aq(f);
this.zw = g;
this.abs(c, d, e, this.z2);
}
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.xh(l)) {
continue;
}
let m = l.ai();
for (let o = 0; o < m.length; o++) {
let n = m[o];
if (!this.z7(n)) {
continue;
}
let p = n.cp ? 1 : 0;
let q = j[p];
let r = null;
if (f == 5) {
let s = l.i7(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.i7(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.i7(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.wf(j);
this.abu(h, { $type: Point_$type, x: v.x, y: NaN }, c, d, e);
}
if (i != null && !isNaN_(j[1])) {
let w = i.wf(j);
this.abu(i, { $type: Point_$type, x: NaN, y: w.y }, c, d, e);
}
this.zw = j;
this.z0 = h;
this.z1 = i;
}
else {
for (let x of fromEnum(this.db.series)) {
this.abs(c, d, e, x);
}
}
}
}
abs(a, b, c, d) {
if (this.xh(d)) {
this.abt(d, a, b, c);
}
if (d.isStacked) {
d.p2((e) => {
if (this.xh(e)) {
this.abt(e, a, b, c);
}
if (e.eg) {
e.p0((f) => {
if (this.xh(f)) {
this.abt(f, a, b, c);
}
return true;
});
}
return true;
});
}
if (d.eg) {
d.p0((e) => {
if (this.xh(e)) {
this.abt(e, a, b, c);
}
return true;
});
}
}
xh(a) {
if (!super.xh(a)) {
return false;
}
if (this.aay != null) {
if (a.isFragment) {
let b = a.nb();
if (!Base.equalsStatic(this.aay, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aay, a.name)) {
return false;
}
}
}
return true;
}
z7(a) {
if (!a.cj) {
return false;
}
if (this.zx != null && this.zx != a) {
return false;
}
if (this.aav != null && !Base.equalsStatic(this.aav, a.name)) {
return false;
}
return true;
}
qo() {
super.qo();
if (!this.a1.c && !this.d3()) {
return;
}
if (this.d3()) {
this.abv(this.xc, false);
}
else {
this.abv(this.xa, false);
}
}
z3() {
if (this.z4 == 0) {
return 2;
}
return this.z4;
}
w1() {
return 3;
}
xo() {
return 0.3;
}
xr() {
return -0.4;
}
xq() {
return 0.5;
}
zn() {
return this.wy == 3 ? this.ac5() : null;
}
zo() {
return this.wz == 3 ? this.ac5() : null;
}
ac5() {
if (this.ac4 == null) {
this.ac4 = new DoubleCollection();
this.ac4.add(DeviceUtils.g(5));
this.ac4.add(DeviceUtils.g(5));
}
return this.ac4;
}
abu(a, b, c, d, e) {
let f = false;
let g = this.acv;
if (g == null) {
g = a.u8;
f = true;
}
let h = false;
let i = this.acy;
if (i == null) {
if (this.acv != null) {
i = this.acv;
}
else {
i = a.u8;
h = true;
}
}
let j = false;
let k = this.ac1;
if (k == null) {
if (this.acv != null) {
k = this.acv;
}
else {
k = a.u8;
j = true;
}
}
let l = g;
let m = g;
let n = i;
let o = k;
if (this.acw != null) {
l = this.acw;
}
else if (f) {
switch (this.wy) {
case 1:
l = this.z5.ce(l, this.xl);
break;
case 2:
l = this.z5.cg(l, this.xl);
break;
case 4:
l = this.z5.cf(l, this.xl);
break;
}
}
if (this.acx != null) {
m = this.acx;
}
else if (f) {
switch (this.wz) {
case 1:
m = this.z5.ce(m, this.xn);
break;
case 2:
m = this.z5.cg(m, this.xn);
break;
case 4:
m = this.z5.cf(m, this.xn);
break;
}
}
if (h) {
switch (this.wz) {
case 1:
n = this.z5.ce(n, this.xn);
break;
case 2:
n = this.z5.cg(n, this.xn);
break;
}
}
if (j) {
switch (this.wy) {
case 1:
o = this.z5.ce(o, this.xl);
break;
case 2:
o = this.z5.cg(o, this.xl);
break;
}
}
c.ae.add(l);
c.ah.add(m);
c.af.add(b.y);
c.ag.add(b.x);
if (this.z6) {
AxisAnnotationFrameManager.c(c, b, a, this.db, this.getEffectiveViewport(), g, n, this.aac, this.ac0, this.acz, this.ac6, this.aah, o, this.aai, this.ac3, this.ac2, this.ac7, this.aan, this.ac9 == 0, this.ac8 == 0);
}
}
abt(a, b, c, d) {
let e = { $type: Point_$type, x: NaN, y: NaN };
let f = this.z3();
switch (f) {
case 5:
e = a.we(2);
break;
case 4:
e = a.we(1);
break;
case 6:
e = a.we(3);
break;
default:
e = a.we(f);
break;
}
let i = a.ai();
for (let h = 0; h < i.length; h++) {
let g = i[h];
if (!this.z7(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.aaa == null) {
c = true;
this.aab = new List$1(Axis.$, 0);
this.aaa = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aaa, this.aab, b, this.aao, this.aap, this.zy, this.zz);
}
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.id;
f.ai = e ? this.zm : this.zl;
f.am = this.v4;
f.al = this.v3;
f.ak = this.v3;
f.aj = this.v2;
f.ac = this.jg;
return new Tuple$2(Path.$, Number_$type, f, b);
}
yt(a, b) {
super.yt(a, b);
let c = this.z5.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.ac9 == 0;
let l = this.ac8 == 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.xc, true);
}
else {
this.abv(this.xa, false);
}
}
f9() {
return true;
}
q8(a, b, c, d) {
super.q8(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aaa != null && this.aaa.count > 0) {
let e;
if (this.d3()) {
e = this.xc;
}
else {
e = this.xa;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aaa, this.aab, true, this.aao, this.aap, this.zy, this.zz);
}
}
break;
case ValueLayer.$$p[2]:
this.rq(true);
break;
case ValueLayer.$$p[12]:
this.rq(true);
break;
case ValueLayer.$$p[7]:
case ValueLayer.$$p[8]:
case "Visibility":
this.rq(true);
break;
case ValueLayer.$$p[3]:
case ValueLayer.$$p[14]:
case ValueLayer.$$p[13]:
case ValueLayer.$$p[17]:
case ValueLayer.$$p[19]:
case ValueLayer.$$p[21]:
case ValueLayer.$$p[20]:
case ValueLayer.$$p[18]:
case ValueLayer.$$p[22]:
case ValueLayer.$$p[23]:
case ValueLayer.$$p[25]:
case ValueLayer.$$p[28]:
case ValueLayer.$$p[30]:
case ValueLayer.$$p[32]:
case ValueLayer.$$p[31]:
case ValueLayer.$$p[29]:
case ValueLayer.$$p[33]:
case ValueLayer.$$p[34]:
case ValueLayer.$$p[1]:
case ValueLayer.$$p[11]:
case ValueLayer.$$p[9]:
this.rq(true);
break;
case "Brush":
case ValueLayer.$$p[10]:
if (this.ve != null) {
this.acv = this.ve;
}
else {
switch (this.z4) {
case 6:
this.acv = BrushUtil.h(255, 248, 173, 118);
break;
case 4:
this.acv = BrushUtil.h(255, 246, 93, 80);
break;
case 5:
this.acv = BrushUtil.h(255, 99, 208, 0);
break;
default:
this.acv = this.z2 != null ? this.z2.u8 : null;
break;
}
}
break;
}
}
o4(a, b) {
super.o4(a, b);
if (a) {
AxisAnnotationFrameManager.b(this.xa);
this.abv(this.xa, false);
}
}
}
ValueLayer.$t = markType(ValueLayer, 'ValueLayer', AnnotationLayer.$);
ValueLayer.$$p = markDep(DependencyProperty, PropertyMetadata, ValueLayer, 'raisePropertyChanged', ['ActualValueLayerBrush:acv:abw', [Brush.$, null], 'HorizontalLineStroke:acw:abx', [Brush.$, null], 'HorizontalLineVisibility:ac8:aby', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:z6:abz', [0, false], 'SkipUnknownValues:z8:ab0', [0, true], 'TargetAxisName:aav:ab1', [2, null], 'TargetAxis:zx:ab2', [Axis.$, null], 'TargetSeriesName:aay:ab3', [2, null], 'TargetSeries:z2:ab4', [Series.$, null], 'UseInterpolation:z9:ab5', [0, true], 'ValueMode:z4:ab6', [ValueLayerValueMode_$type, enumGetBox(ValueLayerValueMode_$type, 2)], 'VerticalLineStroke:acx:ab7', [Brush.$, null], 'VerticalLineVisibility:ac9:ab8', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aac:ab9', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:acy:aca', [Brush.$, null], 'XAxisAnnotationFormatLabel:zy:acb', [Delegate_$type], 'XAxisAnnotationInterpolatedValuePrecision:aao:acc', [1, -1], 'XAxisAnnotationOutline:acz:acd', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aad:ace', [1, NaN], 'XAxisAnnotationPaddingLeft:aae:acf', [1, NaN], 'XAxisAnnotationPaddingRight:aaf:acg', [1, NaN], 'XAxisAnnotationPaddingTop:aag:ach', [1, NaN], 'XAxisAnnotationStrokeThickness:aah:aci', [1, NaN], 'XAxisAnnotationTextColor:ac0:acj', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aai:ack', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:ac1:acl', [Brush.$, null], 'YAxisAnnotationFormatLabel:zz:acm', [Delegate_$type], 'YAxisAnnotationInterpolatedValuePrecision:aap:acn', [1, -1], 'YAxisAnnotationOutline:ac2:aco', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aaj:acp', [1, NaN], 'YAxisAnnotationPaddingLeft:aak:acq', [1, NaN], 'YAxisAnnotationPaddingRight:aal:acr', [1, NaN], 'YAxisAnnotationPaddingTop:aam:acs', [1, NaN], 'YAxisAnnotationStrokeThickness:aan:act', [1, NaN], 'YAxisAnnotationTextColor:ac3:acu', [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.jo = 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;
})();