UNPKG

igniteui-angular-charts

Version:

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

558 lines (557 loc) 20.7 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 { 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 { AnnotationLayerView } from "./AnnotationLayerView"; 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_ } from "igniteui-angular-core"; import { Defaults } from "./Defaults"; import { TranslateTransform } from "igniteui-angular-core"; import { LineGeometry } 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.acx = null; _this.aak = null; _this.aaj = null; var a = new CrosshairLayerFrame(); var b = new CrosshairLayerFrame(); var c = new CrosshairLayerFrame(); var d = _this.ke / 1000; _this.xh = a; _this.xg = b; _this.xi = c; _this.ab = CrosshairLayer.$; return _this; } CrosshairLayer.prototype.bk = function () { return new CrosshairLayer(); }; CrosshairLayer.prototype.get_et = function () { return true; }; CrosshairLayer.prototype.get_er = function () { return true; }; CrosshairLayer.prototype.ct = function () { return new CrosshairLayerView(this); }; CrosshairLayer.prototype.q3 = function (a) { _super.prototype.q3.call(this, a); this.aac = a; }; CrosshairLayer.prototype.gv = function (a) { if (this.aad == null) { return true; } if (this.aad == a) { return true; } return false; }; CrosshairLayer.prototype.aae = function () { return this.xAxisAnnotationFormatLabel != null; }; CrosshairLayer.prototype.aaf = function () { return this.yAxisAnnotationFormatLabel != null; }; Object.defineProperty(CrosshairLayer.prototype, "acz", { get: function () { return new Thickness(1, this.aan, this.aap, this.aao, this.aam); }, enumerable: false, configurable: true }); Object.defineProperty(CrosshairLayer.prototype, "ac0", { get: function () { return new Thickness(1, this.aat, this.aav, this.aau, this.aas); }, enumerable: false, configurable: true }); CrosshairLayer.prototype.yw = function (a, b) { if (this.aad == null || this.aad == a) { if (!this.a1.c) { this.ru(b); } } }; CrosshairLayer.prototype.yy = function (a, b) { var e_1, _a; var _this = this; _super.prototype.yy.call(this, a, b); var c = a; var d = this.aai; var e = this.aah; c.af.clear(); c.ag.clear(); c.ae.clear(); c.ah.clear(); AxisAnnotationFrameManager.b(c); if (this.xn(this.aad)) { this.abu(this.aad, c, d, e); } else { try { for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) { var f = _c.value; if (this.xn(f)) { this.abu(f, c, d, e); } if (f.isStacked) { f.p5(function (g) { if (_this.xn(g)) { _this.abu(g, c, d, e); } if (g.ei) { g.p3(function (h) { if (_this.xn(h)) { _this.abu(h, c, d, e); } return true; }); } return true; }); } if (f.ei) { f.p3(function (g) { if (_this.xn(g)) { _this.abu(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.xn = function (a) { if (!_super.prototype.xn.call(this, a)) { return false; } if (this.aa3 != null) { if (a.isFragment) { var b = a.ne(); if (!Base.equalsStatic(this.aa3, b)) { return false; } } else { if (!Base.equalsStatic(this.aa3, a.name)) { return false; } } } var c = this.yr(a); if (!c.c) { return false; } return true; }; CrosshairLayer.prototype.qr = function () { _super.prototype.qr.call(this); if (!this.a1.c && !this.d4()) { return; } if (this.d4()) { this.abv(this.xi, false); } else { this.abv(this.xg, false); } }; CrosshairLayer.prototype.w7 = function () { return 1; }; CrosshairLayer.prototype.xu = function () { return 0.1; }; CrosshairLayer.prototype.xx = function () { return -0.4; }; CrosshairLayer.prototype.xw = function () { return 0.5; }; CrosshairLayer.prototype.zz = function () { return this.w4 == 3 ? this.acy() : null; }; CrosshairLayer.prototype.z0 = function () { return this.w5 == 3 ? this.acy() : null; }; CrosshairLayer.prototype.acy = function () { if (this.acx == null) { this.acx = new DoubleCollection(); this.acx.add(DeviceUtils.g(5)); this.acx.add(DeviceUtils.g(5)); } return this.acx; }; CrosshairLayer.prototype.abu = function (a, b, c, d) { var e = this.yr(a); if (!e.c) { return; } var f = e.d; f = a.wh(f, c, d); var g = false; var h = this.ve; if (h == null) { h = this.vk; } if (h == null) { h = a.ve; g = true; } var i = false; var j = this.acr; if (j == null) { if (this.vk != null) { j = this.vk; } else { j = a.ve; i = true; } } var k = false; var l = this.acu; if (l == null) { if (this.vk != null) { l = this.vk; } else { l = a.ve; k = true; } } var m = h; var n = h; var o = j; var p = l; if (this.acp != null) { m = this.acp; } else if (g) { switch (this.w4) { case 0: case 1: m = this.aac.ck(m, this.xr); break; case 2: m = this.aac.cm(m, this.xr); break; case 4: m = this.aac.cl(m, this.xr); break; } } if (this.acq != null) { n = this.acq; } else if (g) { switch (this.w5) { case 0: case 1: n = this.aac.ck(n, this.xt); break; case 2: n = this.aac.cm(n, this.xt); break; case 4: n = this.aac.cl(n, this.xt); break; } } if (i) { switch (this.w5) { case 1: o = this.aac.ck(o, this.xt); break; case 2: o = this.aac.cm(o, this.xt); break; } } if (k) { switch (this.w4) { case 1: p = this.aac.ck(p, this.xr); break; case 2: p = this.aac.cm(p, this.xr); break; } } b.ae.add(m); b.ah.add(n); b.af.add(f.y); b.ag.add(f.x); if (this.aag && !isNaN_(f.y)) { AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), h, o, this.aal, this.act, this.acs, this.acz, this.aaq, p, this.aar, this.acw, this.acv, this.ac0, this.aaw, this.ac2 == 0, this.ac1 == 0); } }; CrosshairLayer.prototype.abv = function (a, b) { var c = false; if (this.aaj == null) { c = true; this.aak = new List$1(Axis.$, 0); this.aaj = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0); } AxisAnnotationFrameManager.d(this, a, c, this.aaj, this.aak, b, this.aax, this.aay, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel); }; CrosshairLayer.prototype.abt = 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.ig; f.ai = e ? this.zx : this.zw; f.am = this.wa; f.al = this.v9; f.ak = this.v9; f.aj = this.v8; f.ac = this.ji; return new Tuple$2(Path.$, Number_$type, f, b); }; CrosshairLayer.prototype.y1 = function (a, b) { _super.prototype.y1.call(this, a, b); var c = this.aac.co; var d = a; var e = d.af.count; var f = 0; var g = b.b9.left; var h = b.b9.right; var i = b.b9.top; var j = b.b9.bottom; var k = this.ac2 == 0; var l = this.ac1 == 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.abt(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.abt(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.d4()) { this.abv(this.xi, true); } else { this.abv(this.xg, false); } }; CrosshairLayer.prototype.gb = function () { return true; }; CrosshairLayer.prototype.rc = function (a, b, c, d) { _super.prototype.rc.call(this, a, b, c, d); switch (b) { case "SeriesViewer": if (d == null) { if (this.aaj != null && this.aaj.count > 0) { var e = void 0; if (this.d4()) { e = this.xi; } else { e = this.xg; } AxisAnnotationFrameManager.b(e); AxisAnnotationFrameManager.d(this, e, true, this.aaj, this.aak, true, this.aax, this.aay, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel); } } break; case CrosshairLayer.$$p[1]: this.ru(true); break; case CrosshairLayer.$$p[8]: this.ru(true); break; case CrosshairLayer.$$p[4]: case CrosshairLayer.$$p[5]: this.ru(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.ru(true); break; } }; CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$); CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acp:abw', [Brush.$, null], 'HorizontalLineVisibility:ac1:abx', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aag:aby', [0, false], 'SkipUnknownValues:aah:abz', [0, true], 'TargetSeriesName:aa3:ab0', [2, null], 'TargetSeries:aad:ab1', [Series.$, null], 'UseInterpolation:aai:ab2', [0, true], 'VerticalLineStroke:acq:ab3', [Brush.$, null], 'VerticalLineVisibility:ac2:ab4', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aal:ab5', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:acr:ab6', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aax:ab7', [1, -1], 'XAxisAnnotationOutline:acs:ab8', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aam:ab9', [1, NaN], 'XAxisAnnotationPaddingLeft:aan:aca', [1, NaN], 'XAxisAnnotationPaddingRight:aao:acb', [1, NaN], 'XAxisAnnotationPaddingTop:aap:acc', [1, NaN], 'XAxisAnnotationStrokeThickness:aaq:acd', [1, NaN], 'XAxisAnnotationTextColor:act:ace', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aar:acf', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:acu:acg', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aay:ach', [1, -1], 'YAxisAnnotationOutline:acv:aci', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aas:acj', [1, NaN], 'YAxisAnnotationPaddingLeft:aat:ack', [1, NaN], 'YAxisAnnotationPaddingRight:aau:acl', [1, NaN], 'YAxisAnnotationPaddingTop:aav:acm', [1, NaN], 'YAxisAnnotationStrokeThickness:aaw:acn', [1, NaN], 'YAxisAnnotationTextColor:acw:aco', [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.cn = null; _this.co = null; _this.cp = null; _this.cn = a; _this.cp = new List$1(Path.$, 0); return _this; } CrosshairLayerView.prototype.a4 = function () { var _this = this; _super.prototype.a4.call(this); this.co = ((function () { var $ret = new Pool$1(Path.$); $ret.create = runOn(_this, _this.cu); $ret.activate = runOn(_this, _this.cq); $ret.disactivate = runOn(_this, _this.cs); $ret.destroy = runOn(_this, _this.cr); return $ret; })()); this.cn.jq = Defaults.crosshairLineThickness; }; CrosshairLayerView.prototype.cu = function () { var a = new Path(); a.j = new TranslateTransform(); this.cp.add(a); return a; }; CrosshairLayerView.prototype.cq = function (a) { a._visibility = 0; }; CrosshairLayerView.prototype.cs = function (a) { a._visibility = 1; }; CrosshairLayerView.prototype.cr = function (a) { this.cp.remove(a); }; CrosshairLayerView.prototype.ct = 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.bj = function (a, b) { _super.prototype.bj.call(this, a, b); if (a.d && !b) { for (var c = 0; c < this.cp.count; c++) { var d = this.cp._inner[c]; if (d._visibility == 0) { a.t(d); } } } }; CrosshairLayerView.prototype.ax = function (a) { _super.prototype.ax.call(this, a); for (var b = 0; b < this.cp.count; b++) { this.f.bc.exportPathData(a, this.cp._inner[b], "crosshairLine", ["Main", "Crosshair"]); } }; CrosshairLayerView.$t = markType(CrosshairLayerView, 'CrosshairLayerView', AnnotationLayerView.$); return CrosshairLayerView; }(AnnotationLayerView)); export { CrosshairLayerView };