igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
580 lines (579 loc) • 21.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 { __extends, __values } from "tslib";
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
*/
var CrosshairLayer = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CrosshairLayer, _super);
function CrosshairLayer() {
var _this = _super.call(this) || this;
_this.xAxisAnnotationFormatLabel = null;
_this.yAxisAnnotationFormatLabel = null;
_this.ack = null;
_this.z7 = null;
_this.z6 = null;
var a = new CrosshairLayerFrame();
var b = new CrosshairLayerFrame();
var c = new CrosshairLayerFrame();
var d = _this.kd / 1000;
_this.xc = a;
_this.xb = b;
_this.xd = c;
_this.ab = CrosshairLayer.$;
return _this;
}
CrosshairLayer.prototype.bj = function () {
return new CrosshairLayer();
};
CrosshairLayer.prototype.get_er = function () {
return true;
};
CrosshairLayer.prototype.get_ep = function () {
return true;
};
CrosshairLayer.prototype.cs = function () {
return new CrosshairLayerView(this);
};
CrosshairLayer.prototype.q1 = function (a) {
_super.prototype.q1.call(this, a);
this.zz = a;
};
CrosshairLayer.prototype.gu = function (a) {
if (this.z0 == null) {
return true;
}
if (this.z0 == a) {
return true;
}
return false;
};
CrosshairLayer.prototype.z1 = function () {
return this.xAxisAnnotationFormatLabel != null;
};
CrosshairLayer.prototype.z2 = function () {
return this.yAxisAnnotationFormatLabel != null;
};
Object.defineProperty(CrosshairLayer.prototype, "acm", {
get: function () {
return new Thickness(1, this.aaa, this.aac, this.aab, this.z9);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CrosshairLayer.prototype, "acn", {
get: function () {
return new Thickness(1, this.aag, this.aai, this.aah, this.aaf);
},
enumerable: false,
configurable: true
});
CrosshairLayer.prototype.yp = function (a, b) {
if (this.z0 == null || this.z0 == a) {
if (!this.a1.c) {
this.rr(b);
}
}
};
CrosshairLayer.prototype.yr = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.yr.call(this, a, b);
var c = a;
var d = this.z5;
var e = this.z4;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
if (this.xi(this.z0)) {
this.abh(this.z0, c, d, e);
}
else {
try {
for (var _b = __values(fromEnum(this.db.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var f = _c.value;
if (this.xi(f)) {
this.abh(f, c, d, e);
}
if (f.isStacked) {
f.p3(function (g) {
if (_this.xi(g)) {
_this.abh(g, c, d, e);
}
if (g.eg) {
g.p1(function (h) {
if (_this.xi(h)) {
_this.abh(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.eg) {
f.p1(function (g) {
if (_this.xi(g)) {
_this.abh(g, c, d, e);
}
return true;
});
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
}
};
CrosshairLayer.prototype.xi = function (a) {
if (!_super.prototype.xi.call(this, a)) {
return false;
}
if (this.aaq != null) {
if (a.fb) {
var b = a.nc();
if (!Base.equalsStatic(this.aaq, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aaq, a.name)) {
return false;
}
}
}
var c = this.yk(a);
if (!c.c) {
return false;
}
return true;
};
CrosshairLayer.prototype.qp = function () {
_super.prototype.qp.call(this);
if (!this.a1.c && !this.d3()) {
return;
}
if (this.d3()) {
this.abi(this.xd, false);
}
else {
this.abi(this.xb, false);
}
};
CrosshairLayer.prototype.w2 = function () {
return 1;
};
CrosshairLayer.prototype.xp = function () {
return 0.1;
};
CrosshairLayer.prototype.xs = function () {
return -0.4;
};
CrosshairLayer.prototype.xr = function () {
return 0.5;
};
CrosshairLayer.prototype.zo = function () {
return this.wz == 3 ? this.acl() : null;
};
CrosshairLayer.prototype.zp = function () {
return this.w0 == 3 ? this.acl() : null;
};
CrosshairLayer.prototype.acl = function () {
if (this.ack == null) {
this.ack = new DoubleCollection();
this.ack.add(DeviceUtils.g(5));
this.ack.add(DeviceUtils.g(5));
}
return this.ack;
};
CrosshairLayer.prototype.abh = function (a, b, c, d) {
var e = this.yk(a);
if (!e.c) {
return;
}
var f = e.d;
f = a.wc(f, c, d);
var g = false;
var h = this.u9;
if (h == null) {
h = this.vf;
}
if (h == null) {
h = a.u9;
g = true;
}
var i = false;
var j = this.ace;
if (j == null) {
if (this.vf != null) {
j = this.vf;
}
else {
j = a.u9;
i = true;
}
}
var k = false;
var l = this.ach;
if (l == null) {
if (this.vf != null) {
l = this.vf;
}
else {
l = a.u9;
k = true;
}
}
var m = h;
var n = h;
var o = j;
var p = l;
if (this.acc != null) {
m = this.acc;
}
else if (g) {
switch (this.wz) {
case 0:
case 1:
m = this.zz.ce(m, this.xm);
break;
case 2:
m = this.zz.cg(m, this.xm);
break;
case 4:
m = this.zz.cf(m, this.xm);
break;
}
}
if (this.acd != null) {
n = this.acd;
}
else if (g) {
switch (this.w0) {
case 0:
case 1:
n = this.zz.ce(n, this.xo);
break;
case 2:
n = this.zz.cg(n, this.xo);
break;
case 4:
n = this.zz.cf(n, this.xo);
break;
}
}
if (i) {
switch (this.w0) {
case 1:
o = this.zz.ce(o, this.xo);
break;
case 2:
o = this.zz.cg(o, this.xo);
break;
}
}
if (k) {
switch (this.wz) {
case 1:
p = this.zz.ce(p, this.xm);
break;
case 2:
p = this.zz.cg(p, this.xm);
break;
}
}
b.ae.add(m);
b.ah.add(n);
b.af.add(f.y);
b.ag.add(f.x);
if (this.z3 && !isNaN_(f.y)) {
AxisAnnotationFrameManager.c(b, f, a, this.db, this.getEffectiveViewport(), h, o, this.z8, this.acg, this.acf, this.acm, this.aad, p, this.aae, this.acj, this.aci, this.acn, this.aaj, this.acp == 0, this.aco == 0);
}
};
CrosshairLayer.prototype.abi = function (a, b) {
var c = false;
if (this.z6 == null) {
c = true;
this.z7 = new List$1(Axis.$, 0);
this.z6 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.z6, this.z7, b, this.aak, this.aal, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
};
CrosshairLayer.prototype.abg = function (a, b, c, d, e) {
var 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);
};
CrosshairLayer.prototype.yu = function (a, b) {
_super.prototype.yu.call(this, a, b);
var c = this.zz.b8;
var d = a;
var e = d.af.count;
var f = 0;
var g = b.bx.left;
var h = b.bx.right;
var i = b.bx.top;
var j = b.bx.bottom;
var k = this.acp == 0;
var l = this.aco == 0;
for (var m = 0; m < e; m++) {
var n = Math.floor(d.af._inner[m]);
var o = Math.floor(d.ag._inner[m]);
var p = null;
if (k) {
if (isNaN_(n)) {
continue;
}
var q = this.abg(c, f, m, d, true);
p = q.c;
f = q.d;
var r = new PathGeometry();
var s = new PathFigure();
s._startPoint = { $type: Point_$type, x: o, y: i };
var 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;
}
var u = this.abg(c, f, m, d, false);
p = u.c;
f = u.d;
var v = new PathGeometry();
var w = new PathFigure();
w._startPoint = { $type: Point_$type, x: g, y: n };
var 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.abi(this.xd, true);
}
else {
this.abi(this.xb, false);
}
};
CrosshairLayer.prototype.ga = function () {
return true;
};
CrosshairLayer.prototype.q9 = function (a, b, c, d) {
_super.prototype.q9.call(this, a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.z6 != null && this.z6.count > 0) {
var e = void 0;
if (this.d3()) {
e = this.xd;
}
else {
e = this.xb;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.z6, this.z7, true, this.aak, this.aal, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.rr(true);
break;
case CrosshairLayer.$$p[8]:
this.rr(true);
break;
case CrosshairLayer.$$p[4]:
case CrosshairLayer.$$p[5]:
this.rr(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.rr(true);
break;
}
};
CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acc:abj', [Brush.$, null], 'HorizontalLineVisibility:aco:abk', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:z3:abl', [0, false], 'SkipUnknownValues:z4:abm', [0, true], 'TargetSeriesName:aaq:abn', [2, null], 'TargetSeries:z0:abo', [Series.$, null], 'UseInterpolation:z5:abp', [0, true], 'VerticalLineStroke:acd:abq', [Brush.$, null], 'VerticalLineVisibility:acp:abr', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:z8:abs', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:ace:abt', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aak:abu', [1, -1], 'XAxisAnnotationOutline:acf:abv', [Brush.$, null], 'XAxisAnnotationPaddingBottom:z9:abw', [1, NaN], 'XAxisAnnotationPaddingLeft:aaa:abx', [1, NaN], 'XAxisAnnotationPaddingRight:aab:aby', [1, NaN], 'XAxisAnnotationPaddingTop:aac:abz', [1, NaN], 'XAxisAnnotationStrokeThickness:aad:ab0', [1, NaN], 'XAxisAnnotationTextColor:acg:ab1', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aae:ab2', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:ach:ab3', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aal:ab4', [1, -1], 'YAxisAnnotationOutline:aci:ab5', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aaf:ab6', [1, NaN], 'YAxisAnnotationPaddingLeft:aag:ab7', [1, NaN], 'YAxisAnnotationPaddingRight:aah:ab8', [1, NaN], 'YAxisAnnotationPaddingTop:aai:ab9', [1, NaN], 'YAxisAnnotationStrokeThickness:aaj:aca', [1, NaN], 'YAxisAnnotationTextColor:acj:acb', [Brush.$, null]]);
return CrosshairLayer;
}(AnnotationLayer));
export { CrosshairLayer };
/**
* @hidden
*/
var CrosshairLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CrosshairLayerView, _super);
function CrosshairLayerView(a) {
var _this = _super.call(this, a) || this;
_this.b7 = null;
_this.b8 = null;
_this.b9 = null;
_this.b7 = a;
_this.b9 = new List$1(Path.$, 0);
return _this;
}
CrosshairLayerView.prototype.au = function () {
var _this = this;
_super.prototype.au.call(this);
this.b8 = ((function () {
var $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;
};
CrosshairLayerView.prototype.ch = function () {
var a = new Path();
a.j = new TranslateTransform();
this.b9.add(a);
return a;
};
CrosshairLayerView.prototype.ca = function (a) {
a._visibility = 0;
};
CrosshairLayerView.prototype.cc = function (a) {
a._visibility = 1;
};
CrosshairLayerView.prototype.cb = function (a) {
this.b9.remove(a);
};
CrosshairLayerView.prototype.cd = function (a, b, c, d) {
if (a.an == null || a.an.c.x != d || a.an.d.x != c) {
var e = ((function () {
var $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;
}
};
CrosshairLayerView.prototype.ce = function (a, b) {
if (a == null) {
return a;
}
return BrushUtil.m(a, b);
};
CrosshairLayerView.prototype.cg = function (a, b) {
if (a == null) {
return a;
}
return BrushUtil.o(a, b);
};
CrosshairLayerView.prototype.cf = function (a, b) {
if (a == null) {
return a;
}
var c = new Brush();
c.color = Color.u(truncate((a.color.l * b)), a.color.o, a.color.n, a.color.m);
return c;
};
CrosshairLayerView.prototype.a8 = function (a, b) {
_super.prototype.a8.call(this, a, b);
if (a.d && !b) {
for (var c = 0; c < this.b9.count; c++) {
var d = this.b9._inner[c];
if (d._visibility == 0) {
a.t(d);
}
}
}
};
CrosshairLayerView.prototype.an = function (a) {
_super.prototype.an.call(this, a);
for (var 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;
}(AnnotationLayerView));
export { CrosshairLayerView };