igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
550 lines (549 loc) • 20.4 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 { Brush } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { Series } from "./Series";
import { Thickness } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { CrosshairLayerFrame } from "./CrosshairLayerFrame";
import { List$1 } from "igniteui-angular-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { Base, Number_$type, enumGetBox, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-angular-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { Tuple$2 } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { DeviceUtils } 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 CrosshairLayer = /*@__PURE__*/ (() => {
class CrosshairLayer extends AnnotationLayer {
constructor() {
super();
this.xAxisAnnotationFormatLabel = null;
this.yAxisAnnotationFormatLabel = null;
this.acj = null;
this.z6 = null;
this.z5 = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.kc / 1000;
this.xb = a;
this.xa = b;
this.xc = c;
this.ab = CrosshairLayer.$;
}
bj() {
return new CrosshairLayer();
}
get_er() {
return true;
}
get_ep() {
return true;
}
cs() {
return new CrosshairLayerView(this);
}
q0(a) {
super.q0(a);
this.zy = a;
}
gt(a) {
if (this.zz == null) {
return true;
}
if (this.zz == a) {
return true;
}
return false;
}
z0() {
return this.xAxisAnnotationFormatLabel != null;
}
z1() {
return this.yAxisAnnotationFormatLabel != null;
}
get acl() {
return new Thickness(1, this.z9, this.aab, this.aaa, this.z8);
}
get acm() {
return new Thickness(1, this.aaf, this.aah, this.aag, this.aae);
}
yo(a, b) {
if (this.zz == null || this.zz == a) {
if (!this.a1.c) {
this.rq(b);
}
}
}
yq(a, b) {
super.yq(a, b);
let c = a;
let d = this.z4;
let e = this.z3;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
if (this.xh(this.zz)) {
this.abg(this.zz, c, d, e);
}
else {
for (let f of fromEnum(this.db.series)) {
if (this.xh(f)) {
this.abg(f, c, d, e);
}
if (f.isStacked) {
f.p2((g) => {
if (this.xh(g)) {
this.abg(g, c, d, e);
}
if (g.eg) {
g.p0((h) => {
if (this.xh(h)) {
this.abg(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.eg) {
f.p0((g) => {
if (this.xh(g)) {
this.abg(g, c, d, e);
}
return true;
});
}
}
}
}
xh(a) {
if (!super.xh(a)) {
return false;
}
if (this.aap != null) {
if (a.isFragment) {
let b = a.nb();
if (!Base.equalsStatic(this.aap, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aap, a.name)) {
return false;
}
}
}
let c = this.yj(a);
if (!c.c) {
return false;
}
return true;
}
qo() {
super.qo();
if (!this.a1.c && !this.d3()) {
return;
}
if (this.d3()) {
this.abh(this.xc, false);
}
else {
this.abh(this.xa, false);
}
}
w1() {
return 1;
}
xo() {
return 0.1;
}
xr() {
return -0.4;
}
xq() {
return 0.5;
}
zn() {
return this.wy == 3 ? this.ack() : null;
}
zo() {
return this.wz == 3 ? this.ack() : null;
}
ack() {
if (this.acj == null) {
this.acj = new DoubleCollection();
this.acj.add(DeviceUtils.g(5));
this.acj.add(DeviceUtils.g(5));
}
return this.acj;
}
abg(a, b, c, d) {
let e = this.yj(a);
if (!e.c) {
return;
}
let f = e.d;
f = a.wb(f, c, d);
let g = false;
let h = this.u8;
if (h == null) {
h = this.ve;
}
if (h == null) {
h = a.u8;
g = true;
}
let i = false;
let j = this.acd;
if (j == null) {
if (this.ve != null) {
j = this.ve;
}
else {
j = a.u8;
i = true;
}
}
let k = false;
let l = this.acg;
if (l == null) {
if (this.ve != null) {
l = this.ve;
}
else {
l = a.u8;
k = true;
}
}
let m = h;
let n = h;
let o = j;
let p = l;
if (this.acb != null) {
m = this.acb;
}
else if (g) {
switch (this.wy) {
case 0:
case 1:
m = this.zy.ce(m, this.xl);
break;
case 2:
m = this.zy.cg(m, this.xl);
break;
case 4:
m = this.zy.cf(m, this.xl);
break;
}
}
if (this.acc != null) {
n = this.acc;
}
else if (g) {
switch (this.wz) {
case 0:
case 1:
n = this.zy.ce(n, this.xn);
break;
case 2:
n = this.zy.cg(n, this.xn);
break;
case 4:
n = this.zy.cf(n, this.xn);
break;
}
}
if (i) {
switch (this.wz) {
case 1:
o = this.zy.ce(o, this.xn);
break;
case 2:
o = this.zy.cg(o, this.xn);
break;
}
}
if (k) {
switch (this.wy) {
case 1:
p = this.zy.ce(p, this.xl);
break;
case 2:
p = this.zy.cg(p, this.xl);
break;
}
}
b.ae.add(m);
b.ah.add(n);
b.af.add(f.y);
b.ag.add(f.x);
if (this.z2 && !isNaN_(f.y)) {
AxisAnnotationFrameManager.c(b, f, a, this.db, this.getEffectiveViewport(), h, o, this.z7, this.acf, this.ace, this.acl, this.aac, p, this.aad, this.aci, this.ach, this.acm, this.aai, this.aco == 0, this.acn == 0);
}
}
abh(a, b) {
let c = false;
if (this.z5 == null) {
c = true;
this.z6 = new List$1(Axis.$, 0);
this.z5 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.z5, this.z6, b, this.aaj, this.aak, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
abf(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.zy.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.aco == 0;
let l = this.acn == 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_(n)) {
continue;
}
let q = this.abf(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)) {
continue;
}
let u = this.abf(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.abh(this.xc, true);
}
else {
this.abh(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.z5 != null && this.z5.count > 0) {
let e;
if (this.d3()) {
e = this.xc;
}
else {
e = this.xa;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.z5, this.z6, true, this.aaj, this.aak, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.rq(true);
break;
case CrosshairLayer.$$p[8]:
this.rq(true);
break;
case CrosshairLayer.$$p[4]:
case CrosshairLayer.$$p[5]:
this.rq(true);
break;
case CrosshairLayer.$$p[2]:
case CrosshairLayer.$$p[10]:
case CrosshairLayer.$$p[9]:
case CrosshairLayer.$$p[12]:
case CrosshairLayer.$$p[14]:
case CrosshairLayer.$$p[16]:
case CrosshairLayer.$$p[15]:
case CrosshairLayer.$$p[13]:
case CrosshairLayer.$$p[17]:
case CrosshairLayer.$$p[18]:
case CrosshairLayer.$$p[20]:
case CrosshairLayer.$$p[22]:
case CrosshairLayer.$$p[24]:
case CrosshairLayer.$$p[26]:
case CrosshairLayer.$$p[25]:
case CrosshairLayer.$$p[23]:
case CrosshairLayer.$$p[27]:
case CrosshairLayer.$$p[28]:
case CrosshairLayer.$$p[0]:
case CrosshairLayer.$$p[7]:
case CrosshairLayer.$$p[6]:
this.rq(true);
break;
}
}
}
CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acb:abi', [Brush.$, null], 'HorizontalLineVisibility:acn:abj', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:z2:abk', [0, false], 'SkipUnknownValues:z3:abl', [0, true], 'TargetSeriesName:aap:abm', [2, null], 'TargetSeries:zz:abn', [Series.$, null], 'UseInterpolation:z4:abo', [0, true], 'VerticalLineStroke:acc:abp', [Brush.$, null], 'VerticalLineVisibility:aco:abq', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:z7:abr', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:acd:abs', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aaj:abt', [1, -1], 'XAxisAnnotationOutline:ace:abu', [Brush.$, null], 'XAxisAnnotationPaddingBottom:z8:abv', [1, NaN], 'XAxisAnnotationPaddingLeft:z9:abw', [1, NaN], 'XAxisAnnotationPaddingRight:aaa:abx', [1, NaN], 'XAxisAnnotationPaddingTop:aab:aby', [1, NaN], 'XAxisAnnotationStrokeThickness:aac:abz', [1, NaN], 'XAxisAnnotationTextColor:acf:ab0', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aad:ab1', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:acg:ab2', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aak:ab3', [1, -1], 'YAxisAnnotationOutline:ach:ab4', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aae:ab5', [1, NaN], 'YAxisAnnotationPaddingLeft:aaf:ab6', [1, NaN], 'YAxisAnnotationPaddingRight:aag:ab7', [1, NaN], 'YAxisAnnotationPaddingTop:aah:ab8', [1, NaN], 'YAxisAnnotationStrokeThickness:aai:ab9', [1, NaN], 'YAxisAnnotationTextColor:aci:aca', [Brush.$, null]]);
return CrosshairLayer;
})();
/**
* @hidden
*/
export let CrosshairLayerView = /*@__PURE__*/ (() => {
class CrosshairLayerView 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"]);
}
}
}
CrosshairLayerView.$t = markType(CrosshairLayerView, 'CrosshairLayerView', AnnotationLayerView.$);
return CrosshairLayerView;
})();