UNPKG

igniteui-angular-charts

Version:

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

636 lines (635 loc) 25.1 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 { Series } from "./Series"; import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference"; import { Axis } from "./Axis"; import { DependencyProperty } from "igniteui-angular-core"; import { CategoryAxisBase } from "./CategoryAxisBase"; import { Point_$type, typeCast, Delegate_$type, enumGetBox, markType, markDep, runOn } from "igniteui-angular-core"; import { Brush } from "igniteui-angular-core"; import { Thickness } from "igniteui-angular-core"; import { OverlayTextLocation_$type } from "./OverlayTextLocation"; import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode"; import { OverlayTextUtil } from "./OverlayTextUtil"; 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 { SeriesView } from "./SeriesView"; import { Rect } from "igniteui-angular-core"; import { NotImplementedException } from "igniteui-angular-core"; import { AxisRange } from "./AxisRange"; import { NumericAxisBase } from "./NumericAxisBase"; import { AxisAnnotationFrame } from "./AxisAnnotationFrame"; import { ScalerParams } from "./ScalerParams"; import { CategoryXAxis } from "./CategoryXAxis"; import { OverlayTextUpdatingEventArgs } from "./OverlayTextUpdatingEventArgs"; import { OverlayTextInfo } from "./OverlayTextInfo"; import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager"; import { TextBlock } from "igniteui-angular-core"; import { Rectangle } from "igniteui-angular-core"; import { PropertyMetadata } from "igniteui-angular-core"; import { DeviceUtils } from "igniteui-angular-core"; import { isNaN_, isInfinity } from "igniteui-angular-core"; import { stringIsNullOrEmpty } from "igniteui-angular-core"; import { stringFormat } from "igniteui-angular-core"; import { Path } from "igniteui-angular-core"; /** * @hidden */ export let ValueOverlay = /*@__PURE__*/ (() => { class ValueOverlay extends Series { constructor() { super(); this.x5 = 0; this.x6 = 0; this.xs = 0; this.w7 = null; this.xl = null; this.xk = null; this.stylingOverlayText = null; this.xc = null; this.ab = ValueOverlay.$; this.xc = OverlayTextUtil.c(); } bk() { return new ValueOverlay(); } i6(a, b, c) { return this.x7; } xt(a, b) { let c = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2)); let d = Math.acos((a.x - b.x) / c); if ((a.y - b.y) < 0) { d = (2 * Math.PI) - d; } return d; } wh(a, b, c) { if (this.w6 == null) { return { $type: Point_$type, x: NaN, y: NaN }; } let d = this.x4(); let e = NaN; let f = NaN; let g = NaN; let h = { $type: Point_$type, x: 0.5, y: 0.5 }; let i = NaN; switch (this.w6.a2) { case 2: i = Math.sqrt(Math.pow(a.x - h.x, 2) + Math.pow(a.y - h.y, 2)); g = d; e = h.x + Math.cos(g) * i; f = h.y + Math.sin(g) * i; f = this.cw.b9.top + this.cw.b9.height * (f - this.cw.ca.top) / this.cw.ca.height; e = this.cw.b9.left + this.cw.b9.width * (e - this.cw.ca.left) / this.cw.ca.width; break; case 0: e = d; f = a.y; f = this.cw.b9.top + this.cw.b9.height * (f - this.cw.ca.top) / this.cw.ca.height; break; case 1: f = d; e = a.x; e = this.cw.b9.left + this.cw.b9.width * (e - this.cw.ca.left) / this.cw.ca.width; break; case 3: g = this.xt(a, h); i = d; e = h.x + Math.cos(g) * i; f = h.y + Math.sin(g) * i; f = this.cw.b9.top + this.cw.b9.height * (f - this.cw.ca.top) / this.cw.ca.height; e = this.cw.b9.left + this.cw.b9.width * (e - this.cw.ca.left) / this.cw.ca.width; break; } return { $type: Point_$type, x: e, y: f }; } j4(a) { throw new NotImplementedException(0); } ko(a) { return this; } ge(a) { return false; } ay(a) { let b = typeCast(NumericAxisBase.$, a); let c = this.x7; if (isNaN_(c) || isInfinity(c)) { return null; } return new AxisRange(c, c); } rv(a) { this.o7(true, this.cw); if (!this.xj()) { if (this.w7 != null) { this.zf(NaN, this.d4()); } return; } if (this.gg(a)) { if (this.d4()) { if (this.dd.g) { this.dd.t(); } let b = this.x5; this.x5 = this.x6; this.x6 = b; } else { this.x5 = this.xs; } this.xs = this.x4(); this.sb(); } else { this.xs = this.x4(); this.ze(this.xs, this.xb); } } x4() { let a, b; let c = this.getViewInfo(b, a); b = c.p0; a = c.p1; let d = this.getEffectiveViewport1(this.cw); let e = new ScalerParams(0, a, b, this.w6.ch, d); return this.w6.el(this.x7, e); } ze(a, b) { if (this.w6 == null) { return; } let c = typeCast(CategoryAxisBase.$, this.w6); if (c != null && !c.ce) { if (this.x7 > c.lk - 1) { return; } if (c.categoryMode != 0) { let d = this.getEffectiveViewport1(b); let e = 0.5 * c.getCategorySize(b.ca, b.b9, d); let f = false; if (c.cp && !c.ch) { f = true; } if (typeCast(CategoryXAxis.$, c) !== null && c.ch) { f = true; } if (f) { e = -e; } a += e; } } let g = typeCast(NumericAxisBase.$, this.w6); if (g != null) { if (this.x7 < g.l4 || this.x7 > g.l3) { return; } if (g.lp && this.x7 < 0) { return; } } let h; switch (this.w6.a2) { case 2: case 3: h = this.w6.j8(a, b.ca, b.b9, this.getEffectiveViewport1(b), this.wo(b)); break; default: h = this.w6.j8(a, b.ca, b.b9, this.getEffectiveViewport1(b), this.wo(b)); break; } if (h != null) { b.cp(h); } if (!b.t) { this.zf(a, this.d4()); } } hf(a, b, c) { let d = true; d = super.hf(a, b, c); if (!c.r() || b.isEmpty || a.isEmpty || this.w6 == null || this.w6.bi == null) { d = false; } return d; } sv(a, b) { this.ru(false); } su(a, b) { this.ru(false); } pd(a, b, c, d) { throw new NotImplementedException(0); } rc(a, b, c, d) { super.rc(a, b, c, d); switch (b) { case ValueOverlay.$$p[11]: if (c != null) { c.b0(this); } if (d != null) { d.ct(this); } this.ru(false); this.qn(); break; case "TransitionProgress": this.x6 = this.x5 + this.jr * (this.xs - this.x5); if (this.d7(this.cw)) { return; } if (this.jr == 1) { this.ze(this.xs, this.xb); this.qq(); } else { this.ze(this.x6, this.xb); } if (this.dc != null) { this.dc.q7(this); } break; case ValueOverlay.$$p[35]: let e = typeCast(NumericAxisBase.$, this.w6); if (e != null) { e.c1(); } this.ru(true); this.qo(); break; case ValueOverlay.$$p[12]: case ValueOverlay.$$p[10]: case ValueOverlay.$$p[1]: case ValueOverlay.$$p[0]: case ValueOverlay.$$p[3]: case ValueOverlay.$$p[4]: case ValueOverlay.$$p[9]: case ValueOverlay.$$p[5]: case ValueOverlay.$$p[6]: case ValueOverlay.$$p[7]: case ValueOverlay.$$p[8]: this.ru(true); break; case ValueOverlay.$$p[31]: case ValueOverlay.$$p[34]: case ValueOverlay.$$p[30]: case ValueOverlay.$$p[13]: case ValueOverlay.$$p[24]: case ValueOverlay.$$p[25]: case ValueOverlay.$$p[27]: case ValueOverlay.$$p[26]: case ValueOverlay.$$p[14]: case ValueOverlay.$$p[15]: case ValueOverlay.$$p[17]: case ValueOverlay.$$p[16]: case ValueOverlay.$$p[19]: case ValueOverlay.$$p[20]: case ValueOverlay.$$p[22]: case ValueOverlay.$$p[18]: case ValueOverlay.$$p[21]: case ValueOverlay.$$p[23]: case ValueOverlay.$$p[28]: case ValueOverlay.$$p[29]: case ValueOverlay.$$p[33]: case ValueOverlay.$$p[32]: this.ru(true); break; case "SeriesViewer": if (d == null) { if (this.xk != null && this.xk.count > 0 && this.w7 != null) { this.zf(NaN, this.d4()); } } break; } } qd() { super.qd(); if (this.w6 != null) { this.w6.ib(false); } } o7(a, b) { super.o7(a, b); let c = b; c.ci(); } xj() { if (this.w6 == null || this.w6.bi == null || isNaN_(this.x7) || this._visibility != 0) { return false; } let a = typeCast(CategoryAxisBase.$, this.w6); if (a != null && a.lk == 0) { return false; } return true; } preferredCategoryMode(a) { return 0; } get categoryAxis() { return typeCast(CategoryAxisBase.$, this.w6); } ct() { return new ValueOverlayView(this); } q3(a) { super.q3(a); this.xb = typeCast(ValueOverlayView.$, a); } rw(a, b) { super.rw(a, b); if (!this.g1) { this.cw.be(b); return; } this.cw.be(b); if (this.d7(this.cv) || !this.xj()) { return; } let c = this.getEffectiveViewport1(this.cw); let d = this.w6.el(this.x7, new ScalerParams(0, this.cv.ca, a, this.w6.ch, c)); this.ze(d, typeCast(ValueOverlayView.$, this.cv)); this.g1 = false; } getOffsetValue() { return 0; } getCategoryWidth() { return 0; } get aam() { return new Thickness(1, this.xo, this.xq, this.xp, this.xn); } ai() { return [this.w6]; } zd() { if (OverlayTextUtil.q(this.xc)) { this.xc = OverlayTextUtil.c(); } else if (OverlayTextUtil.k(this.xc)) { this.xc = this.cw.l(this.xc.fontString); } } zf(a, b) { if (isNaN_(a)) { if (this.w7 != null) { AxisAnnotationFrameManager.b(this.w7); AxisAnnotationFrameManager.d(this, this.w7, true, this.xk, this.xl, b, this.x8, this.x8, this.w8, this.w8); } return; } let c = false; if (this.xk == null) { c = true; this.xl = new List$1(Axis.$, 0); this.xk = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0); } this.w7 = new AxisAnnotationFrame(); let d = this.ve; if (d == null) { d = this.vk; } this.xb.ch(); if (this.w6.a2 == 0 || this.w6.a2 == 1) { this.zd(); let e = this.xd; let f = OverlayTextUtil.o(e, this.xi); let g = this.w9; if (g == 18) { f = false; } if (f && !stringIsNullOrEmpty(this.yo)) { let h = this.w6.cp; let i = new OverlayTextUpdatingEventArgs(); i.textLocation = this.w9; i.textAngle = this.xu; i.textVisible = this.xi; i.textContent = this.yo; i.textColorMode = this.w5; i.textColorShift = this.xz; i.textColor = this.xh ? this.ve : this.aal; i.backgroundMode = this.w3; i.backgroundShift = this.xv; i.background = this.xf ? this.ve : this.aaj; i.borderMode = this.w4; i.borderShift = this.xx; i.borderStroke = this.xg ? this.ve : this.aak; i.borderRadius = this.xw; i.borderThickness = this.xy; i.shapeBrush = this.ve; i.shapeOutline = this.vi; i.f = h; i.horizontalMargin = this.x0; i.verticalPadding = this.x3; i.verticalMargin = this.x2; i.horizontalPadding = this.x1; if (this.stylingOverlayText != null) { this.stylingOverlayText(this, i); } OverlayTextUtil.ad(i); let j = OverlayTextInfo.d(i); if (j.textVisible && !j.h) { this.xb.ce.count = 1; this.xb.cd.count = 1; j.f = e; j.ad = this.cw.cc(j.textContent, j.f); j.u = this.xb.ce.item(0); j.ac = this.xb.cd.item(0); if (j.g) { let k = this.dc.wl({ $type: Point_$type, x: 0, y: NaN }); let l = this.dc.wl({ $type: Point_$type, x: 1, y: NaN }); let m = l.x - k.x; j.ab = new Rect(0, k.x, a, m, 1); } else { let n = this.dc.wl({ $type: Point_$type, x: NaN, y: 0 }); let o = this.dc.wl({ $type: Point_$type, x: NaN, y: 1 }); let p = o.y - n.y; j.ab = new Rect(0, a, n.y, 1, p); } OverlayTextUtil.ac(j); this.cw.av(j.u, j.f); this.cw.aw(j.u, j.f); } } } let q = this.w6.cp; AxisAnnotationFrameManager.c(this.w7, { $type: Point_$type, x: a, y: a }, this, this.dc, this.getEffectiveViewport(), d, this.aag, this.xm, this.aai, this.aah, this.aam, this.xr, this.aag, this.xm, this.aai, this.aah, this.aam, this.xr, !q && this.xe, q && this.xe); AxisAnnotationFrameManager.d(this, this.w7, c, this.xk, this.xl, b, this.x8, this.x8, this.w8, this.w8); } get_isValueOverlay() { return true; } yl(a) { if (this.w6 != null) { return this.w6.gf(a); } return null; } get yn() { let a = this.yl(this.x7); return a != null ? a : stringFormat("{0:0.##}", this.x7); } get xd() { return this.xc; } set xd(a) { let b = this.xc; if (OverlayTextUtil.q(a)) { a = OverlayTextUtil.c(); } this.xc = a; if (b != this.xc) { this.raisePropertyChanged("OverlayTextStyle", b, this.xc); } } } ValueOverlay.$t = markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]); ValueOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:xm:zg', [1, DeviceUtils.g(3)], 'AxisAnnotationBackground:aag:zh', [Brush.$, null], 'AxisAnnotationFormatLabel:w8:zi', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:x8:zj', [1, -1], 'AxisAnnotationOutline:aah:zk', [Brush.$, null], 'AxisAnnotationPaddingBottom:xn:zl', [1, NaN], 'AxisAnnotationPaddingLeft:xo:zm', [1, NaN], 'AxisAnnotationPaddingRight:xp:zn', [1, NaN], 'AxisAnnotationPaddingTop:xq:zo', [1, NaN], 'AxisAnnotationStrokeThickness:xr:zp', [1, NaN], 'AxisAnnotationTextColor:aai:zq', [Brush.$, null], 'Axis:w6:zr', [Axis.$, null], 'IsAxisAnnotationEnabled:xe:zs', [0, false], 'OverlayTextAngle:xu:zt', [1, NaN], 'OverlayTextBackgroundMatchLayer:xf:zu', [0, false], 'OverlayTextBackgroundMode:w3:zv', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'OverlayTextBackground:aaj:zw', [Brush.$, null], 'OverlayTextBackgroundShift:xv:zx', [1, NaN], 'OverlayTextBorderColor:aak:zy', [Brush.$, null], 'OverlayTextBorderMatchLayer:xg:zz', [0, false], 'OverlayTextBorderMode:w4:z0', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'OverlayTextBorderRadius:xw:z1', [1, NaN], 'OverlayTextBorderShift:xx:z2', [1, NaN], 'OverlayTextBorderThickness:xy:z3', [1, 1], 'OverlayTextColorMatchLayer:xh:z4', [0, true], 'OverlayTextColorMode:w5:z5', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'OverlayTextColor:aal:z6', [Brush.$, null], 'OverlayTextColorShift:xz:z7', [1, NaN], 'OverlayTextHorizontalMargin:x0:z8', [1, NaN], 'OverlayTextHorizontalPadding:x1:z9', [1, NaN], 'OverlayTextLocation:w9:aaa', [OverlayTextLocation_$type, enumGetBox(OverlayTextLocation_$type, 0)], 'OverlayText:yo:aab', [2, null], 'OverlayTextVerticalMargin:x2:aac', [1, NaN], 'OverlayTextVerticalPadding:x3:aad', [1, NaN], 'OverlayTextVisible:xi:aae', [0, true], 'Value:x7:aaf', [1, 0]]); return ValueOverlay; })(); /** * @hidden */ export let ValueOverlayView = /*@__PURE__*/ (() => { class ValueOverlayView extends SeriesView { constructor(a) { super(a); this.cr = null; this.cg = null; this.ce = null; this.cf = null; this.cd = null; this.cr = new Path(); } bp() { super.bp(); this.cr._stroke = this.f.ve; this.cr.ad = this.f.ig; this.cr.ai = this.f.v7; this.cr.aj = this.f.v8; } bq() { super.bq(); let a = this.b3(); this.cr._stroke = a; this.cr.ad = this.f.ig + 3; this.cr._stroke = a; this.cr.ad = this.f.ig + 3; } cp(a) { this.cr.an = a; this.a2(); } ci() { this.cr.an = null; this.a2(); } bj(a, b) { super.bj(a, b); if (a.d) { a.t(this.cr); for (let c = 0; c < this.cd.count; c++) { let d = this.cd.item(c); if (d.j != null) { a.aa(); a.k(d.j); } if (d._visibility == 0) { a.w(d); } if (d.j != null) { a.z(); } } for (let e = 0; e < this.ce.count; e++) { let f = this.ce.item(e); if (f.j != null) { a.k(f.j); } a.ad(f.dataContext); a.x(f); if (f.j != null) { } } } } ax(a) { super.ax(a); this.f.bc.exportPathData(a, this.cr, "ValueOverlayPath", []); } ch() { } a4() { super.a4(); this.cg = new List$1(TextBlock.$, 0); this.ce = ((() => { let $ret = new Pool$1(TextBlock.$); $ret.create = runOn(this, this.cq); $ret.activate = runOn(this, this.cm); $ret.disactivate = runOn(this, this.co); $ret.destroy = runOn(this, this.cn); return $ret; })()); this.cf = new List$1(Rectangle.$, 0); this.cd = ((() => { let $ret = new Pool$1(Rectangle.$); $ret.create = runOn(this, this.cs); $ret.activate = runOn(this, this.cj); $ret.disactivate = runOn(this, this.cl); $ret.destroy = runOn(this, this.ck); return $ret; })()); } cq() { let a = new TextBlock(); this.cg.add(a); return a; } cn(a) { if (this.cg.contains(a)) { this.cg.remove(a); } } cm(a) { a._visibility = 0; a.s = 0; } co(a) { a._visibility = 1; } cs() { let a = new Rectangle(); this.cf.add(a); return a; } ck(a) { a.dataContext = null; if (this.cf.contains(a)) { this.cf.remove(a); } } cj(a) { a._visibility = 0; } cl(a) { a._visibility = 1; } } ValueOverlayView.$t = markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$); return ValueOverlayView; })();