UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

764 lines (763 loc) 27.8 kB
/* 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 { 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 */ var ValueLayer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(ValueLayer, _super); function ValueLayer() { var _this = _super.call(this) || this; _this.zx = [NaN, NaN]; _this.z1 = null; _this.z2 = null; _this.ac2 = null; _this.aac = null; _this.aab = null; var a = new ValueLayerFrame(); var b = new ValueLayerFrame(); var c = new ValueLayerFrame(); var d = _this.kd / 1000; _this.xc = a; _this.xb = b; _this.xd = c; _this.ab = ValueLayer.$; return _this; } ValueLayer.prototype.bj = function () { return new ValueLayer(); }; ValueLayer.prototype.get_et = function () { return true; }; ValueLayer.prototype.cs = function () { return new ValueLayerView(this); }; ValueLayer.prototype.q1 = function (a) { _super.prototype.q1.call(this, a); this.z6 = a; }; ValueLayer.prototype.gu = function (a) { if (this.z3 == null) { return true; } if (this.z3 == a) { return true; } return false; }; Object.defineProperty(ValueLayer.prototype, "ac4", { get: function () { return new Thickness(1, this.aaf, this.aah, this.aag, this.aae); }, enumerable: false, configurable: true }); Object.defineProperty(ValueLayer.prototype, "ac5", { get: function () { return new Thickness(1, this.aal, this.aan, this.aam, this.aak); }, enumerable: false, configurable: true }); ValueLayer.prototype.mc = function () { return "Value Layer"; }; ValueLayer.prototype.get_isSummarizationSupported = function () { return false; }; ValueLayer.prototype.i5 = function (a, b, c) { if (isNaN_(this.zx[0]) && isNaN_(this.zx[1])) { return _super.prototype.i5.call(this, a, b, c); } if (!isNaN_(this.zx[0])) { return this.zx[0]; } return this.zx[1]; }; ValueLayer.prototype.getDataLegendSeriesContextAt = function (a, b) { if (isNaN_(this.zx[0]) || isNaN_(this.zx[1])) { return _super.prototype.getDataLegendSeriesContextAt.call(this, a, b); } if (this.z3 == null) { var c_1 = new DataLegendSeriesValueInfo(); c_1.l = this.zx[0]; c_1.a = 0; c_1.q = "Value"; c_1.r = "Value"; c_1.s = ""; var d_1 = new DataLegendSeriesValueInfo(); d_1.l = this.zx[1]; d_1.a = 0; d_1.q = "Value"; d_1.r = "Value"; d_1.s = ""; var e = new DataLegendSeriesContext(); e.e = ((function () { var $ret = new List$1(DataLegendSeriesValueInfo.$, 0); $ret.add(c_1); $ret.add(d_1); return $ret; })()); e.h = this.mc(); return e; } var f = this.z3.getDataLegendSeriesContextAt(a, b); var g = typeCast(DataLegendSeriesContext.$, f); if (g == null || g.e == null) { return _super.prototype.getDataLegendSeriesContextAt.call(this, 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; }; ValueLayer.prototype.yp = function (a, b) { if (this.z3 == null || this.z3 == a) { if (!this.a1.c) { this.rr(b); } } }; ValueLayer.prototype.yr = function (a, b) { var e_1, _a, e_2, _b; _super.prototype.yr.call(this, a, b); var c = a; var d = this.aaa; var 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; var f = this.z4(); if (this.xi(this.z3)) { var g = this.z3.aq(f); this.zx = g; this.abs(c, d, e, this.z3); } else { if (f == 5 || f == 4 || f == 6) { var h = null; var i = null; var j = [NaN, NaN]; var k = 0; try { for (var _c = __values(fromEnum(this.db.series)), _d = _c.next(); !_d.done; _d = _c.next()) { var l = _d.value; if (!this.xi(l)) { continue; } var m = l.ai(); for (var o = 0; o < m.length; o++) { var n = m[o]; if (!this.z8(n)) { continue; } var p = n.cp ? 1 : 0; var q = j[p]; var r = null; if (f == 5) { var 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) { var 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) { var 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++; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } 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])) { var v = h.wg(j); this.abu(h, { $type: Point_$type, x: v.x, y: NaN }, c, d, e); } if (i != null && !isNaN_(j[1])) { var 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 { try { for (var _e = __values(fromEnum(this.db.series)), _f = _e.next(); !_f.done; _f = _e.next()) { var x = _f.value; this.abs(c, d, e, x); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_2) throw e_2.error; } } } } }; ValueLayer.prototype.abs = function (a, b, c, d) { var _this = this; if (this.xi(d)) { this.abt(d, a, b, c); } if (d.isStacked) { d.p3(function (e) { if (_this.xi(e)) { _this.abt(e, a, b, c); } if (e.eg) { e.p1(function (f) { if (_this.xi(f)) { _this.abt(f, a, b, c); } return true; }); } return true; }); } if (d.eg) { d.p1(function (e) { if (_this.xi(e)) { _this.abt(e, a, b, c); } return true; }); } }; ValueLayer.prototype.xi = function (a) { if (!_super.prototype.xi.call(this, a)) { return false; } if (this.aay != null) { if (a.fb) { var b = a.nc(); if (!Base.equalsStatic(this.aay, b)) { return false; } } else { if (!Base.equalsStatic(this.aay, a.name)) { return false; } } } return true; }; ValueLayer.prototype.z8 = function (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; }; ValueLayer.prototype.qp = function () { _super.prototype.qp.call(this); if (!this.a1.c && !this.d3()) { return; } if (this.d3()) { this.abv(this.xd, false); } else { this.abv(this.xb, false); } }; ValueLayer.prototype.z4 = function () { if (this.z5 == 0) { return 2; } return this.z5; }; ValueLayer.prototype.w2 = function () { return 3; }; ValueLayer.prototype.xp = function () { return 0.3; }; ValueLayer.prototype.xs = function () { return -0.4; }; ValueLayer.prototype.xr = function () { return 0.5; }; ValueLayer.prototype.zo = function () { return this.wz == 3 ? this.ac3() : null; }; ValueLayer.prototype.zp = function () { return this.w0 == 3 ? this.ac3() : null; }; ValueLayer.prototype.ac3 = function () { if (this.ac2 == null) { this.ac2 = new DoubleCollection(); this.ac2.add(DeviceUtils.g(5)); this.ac2.add(DeviceUtils.g(5)); } return this.ac2; }; ValueLayer.prototype.abu = function (a, b, c, d, e) { var f = false; var g = this.u9; if (g == null) { g = this.vf; } if (g == null) { g = a.u9; f = true; } var h = false; var i = this.acw; if (i == null) { if (this.vf != null) { i = this.vf; } else { i = a.u9; h = true; } } var j = false; var k = this.acz; if (k == null) { if (this.vf != null) { k = this.vf; } else { k = a.u9; j = true; } } var l = g; var m = g; var n = i; var 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); } }; ValueLayer.prototype.abt = function (a, b, c, d) { var e = { $type: Point_$type, x: NaN, y: NaN }; var 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; } var i = a.ai(); for (var h = 0; h < i.length; h++) { var 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); } } }; ValueLayer.prototype.abv = function (a, b) { var 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); }; ValueLayer.prototype.abr = 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); }; ValueLayer.prototype.yu = function (a, b) { _super.prototype.yu.call(this, a, b); var c = this.z6.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.ac7 == 0; var l = this.ac6 == 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_(o)) { var q = this.abr(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)) { var u = this.abr(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.abv(this.xd, true); } else { this.abv(this.xb, false); } }; ValueLayer.prototype.ga = function () { return true; }; ValueLayer.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.aab != null && this.aab.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.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; } }; ValueLayer.prototype.o5 = function (a, b) { _super.prototype.o5.call(this, 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; }(AnnotationLayer)); export { ValueLayer }; /** * @hidden */ var ValueLayerView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(ValueLayerView, _super); function ValueLayerView(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; } ValueLayerView.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; }; ValueLayerView.prototype.ch = function () { var a = new Path(); a.j = new TranslateTransform(); this.b9.add(a); return a; }; ValueLayerView.prototype.ca = function (a) { a._visibility = 0; }; ValueLayerView.prototype.cc = function (a) { a._visibility = 1; }; ValueLayerView.prototype.cb = function (a) { this.b9.remove(a); }; ValueLayerView.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; } }; ValueLayerView.prototype.ce = function (a, b) { if (a == null) { return a; } return BrushUtil.m(a, b); }; ValueLayerView.prototype.cg = function (a, b) { if (a == null) { return a; } return BrushUtil.o(a, b); }; ValueLayerView.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; }; ValueLayerView.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); } } } }; ValueLayerView.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"]); } }; ValueLayerView.$t = markType(ValueLayerView, 'ValueLayerView', AnnotationLayerView.$); return ValueLayerView; }(AnnotationLayerView)); export { ValueLayerView };