UNPKG

igniteui-angular-charts

Version:

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

424 lines (423 loc) 15.6 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, markType, markDep } from "igniteui-angular-core"; import { Brush } from "igniteui-angular-core"; import { Thickness } from "igniteui-angular-core"; 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 { 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 { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager"; import { PropertyMetadata } from "igniteui-angular-core"; import { DeviceUtils } from "igniteui-angular-core"; import { isNaN_, isInfinity } 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.xe = 0; this.xf = 0; this.xb = 0; this.wy = null; this.w4 = null; this.w3 = null; this.ab = ValueOverlay.$; } bj() { return new ValueOverlay(); } i4(a, b, c) { return this.xg; } xc(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; } wb(a, b, c) { if (this.wx == null) { return { $type: Point_$type, x: NaN, y: NaN }; } let d = this.xd(); 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.wx.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.cv.bx.top + this.cv.bx.height * (f - this.cv.by.top) / this.cv.by.height; e = this.cv.bx.left + this.cv.bx.width * (e - this.cv.by.left) / this.cv.by.width; break; case 0: e = d; f = a.y; f = this.cv.bx.top + this.cv.bx.height * (f - this.cv.by.top) / this.cv.by.height; break; case 1: f = d; e = a.x; e = this.cv.bx.left + this.cv.bx.width * (e - this.cv.by.left) / this.cv.by.width; break; case 3: g = this.xc(a, h); i = d; e = h.x + Math.cos(g) * i; f = h.y + Math.sin(g) * i; f = this.cv.bx.top + this.cv.bx.height * (f - this.cv.by.top) / this.cv.by.height; e = this.cv.bx.left + this.cv.bx.width * (e - this.cv.by.left) / this.cv.by.width; break; } return { $type: Point_$type, x: e, y: f }; } j2(a) { throw new NotImplementedException(0); } km(a) { return this; } gc(a) { return false; } ay(a) { let b = typeCast(NumericAxisBase.$, a); let c = this.xg; if (isNaN_(c) || isInfinity(c)) { return null; } return new AxisRange(c, c); } rr(a) { this.o4(true, this.cv); if (!this.w2()) { if (this.wy != null) { this.xz(NaN, this.d3()); } return; } if (this.ge(a)) { if (this.d3()) { if (this.dc.g) { this.dc.t(); } let b = this.xe; this.xe = this.xf; this.xf = b; } else { this.xe = this.xb; } this.xb = this.xd(); this.r6(); } else { this.xb = this.xd(); this.xy(this.xb, this.w0); } } xd() { let a, b; let c = this.getViewInfo(b, a); b = c.p0; a = c.p1; let d = this.getEffectiveViewport1(this.cv); let e = new ScalerParams(0, a, b, this.wx.ch, d); return this.wx.el(this.xg, e); } xy(a, b) { if (this.wx == null) { return; } let c = typeCast(CategoryAxisBase.$, this.wx); if (c != null && !c.ce) { if (this.xg > c.lk - 1) { return; } if (c.categoryMode != 0) { let d = this.getEffectiveViewport1(b); let e = 0.5 * c.getCategorySize(b.by, b.bx, 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.wx); if (g != null) { if (this.xg < g.l4 || this.xg > g.l3) { return; } if (g.lp && this.xg < 0) { return; } } let h; switch (this.wx.a2) { case 2: case 3: h = this.wx.j8(a, b.by, b.bx, this.getEffectiveViewport1(b), this.wi(b)); break; default: h = this.wx.j8(a, b.by, b.bx, this.getEffectiveViewport1(b), this.wi(b)); break; } if (h != null) { b.b1(h); } if (!b.q) { this.xz(a, this.d3()); } } hd(a, b, c) { let d = true; d = super.hd(a, b, c); if (!c.o() || b.isEmpty || a.isEmpty || this.wx == null || this.wx.bi == null) { d = false; } return d; } sq(a, b) { this.rq(false); } sp(a, b) { this.rq(false); } pa(a, b, c, d) { throw new NotImplementedException(0); } q8(a, b, c, d) { super.q8(a, b, c, d); switch (b) { case ValueOverlay.$$p[11]: if (c != null) { c.b0(this); } if (d != null) { d.ct(this); } this.rq(false); this.qk(); break; case "TransitionProgress": this.xf = this.xe + this.jp * (this.xb - this.xe); if (this.d5(this.cv)) { return; } if (this.jp == 1) { this.xy(this.xb, this.w0); this.qn(); } else { this.xy(this.xf, this.w0); } if (this.db != null) { this.db.qo(this); } break; case ValueOverlay.$$p[13]: let e = typeCast(NumericAxisBase.$, this.wx); if (e != null) { e.c1(); } this.rq(true); this.ql(); 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.rq(true); break; } } qa() { super.qa(); if (this.wx != null) { this.wx.ib(false); } } o4(a, b) { super.o4(a, b); let c = b; c.b0(); } w2() { if (this.wx == null || this.wx.bi == null || isNaN_(this.xg) || this._visibility != 0) { return false; } let a = typeCast(CategoryAxisBase.$, this.wx); if (a != null && a.lk == 0) { return false; } return true; } preferredCategoryMode(a) { return 0; } get categoryAxis() { return typeCast(CategoryAxisBase.$, this.wx); } cs() { return new ValueOverlayView(this); } q0(a) { super.q0(a); this.w0 = typeCast(ValueOverlayView.$, a); } rs(a, b) { super.rs(a, b); if (!this.gz) { this.cv.a4(b); return; } this.cv.a4(b); if (this.d5(this.cu) || !this.w2()) { return; } let c = this.getEffectiveViewport1(this.cv); let d = this.wx.el(this.xg, new ScalerParams(0, this.cu.by, a, this.wx.ch, c)); this.xy(d, typeCast(ValueOverlayView.$, this.cu)); this.gz = false; } getOffsetValue() { return 0; } getCategoryWidth() { return 0; } get yh() { return new Thickness(1, this.w7, this.w9, this.w8, this.w6); } ai() { return [this.wx]; } xz(a, b) { if (isNaN_(a)) { if (this.wy != null) { AxisAnnotationFrameManager.b(this.wy); AxisAnnotationFrameManager.d(this, this.wy, true, this.w3, this.w4, b, this.xh, this.xh, this.wz, this.wz); } return; } let c = false; if (this.w3 == null) { c = true; this.w4 = new List$1(Axis.$, 0); this.w3 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0); } this.wy = new AxisAnnotationFrame(); let d = this.u8; if (d == null) { d = this.ve; } let e = this.wx.cp; AxisAnnotationFrameManager.c(this.wy, { $type: Point_$type, x: a, y: a }, this, this.db, this.getEffectiveViewport(), d, this.ye, this.w5, this.yg, this.yf, this.yh, this.xa, this.ye, this.w5, this.yg, this.yf, this.yh, this.xa, !e && this.w1, e && this.w1); AxisAnnotationFrameManager.d(this, this.wy, c, this.w3, this.w4, b, this.xh, this.xh, this.wz, this.wz); } get_isValueOverlay() { return true; } xu(a) { if (this.wx != null) { return this.wx.gf(a); } return null; } get xw() { let a = this.xu(this.xg); return a != null ? a : stringFormat("{0:0.##}", this.xg); } } ValueOverlay.$t = markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]); ValueOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:w5:x0', [1, DeviceUtils.g(3)], 'AxisAnnotationBackground:ye:x1', [Brush.$, null], 'AxisAnnotationFormatLabel:wz:x2', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:xh:x3', [1, -1], 'AxisAnnotationOutline:yf:x4', [Brush.$, null], 'AxisAnnotationPaddingBottom:w6:x5', [1, NaN], 'AxisAnnotationPaddingLeft:w7:x6', [1, NaN], 'AxisAnnotationPaddingRight:w8:x7', [1, NaN], 'AxisAnnotationPaddingTop:w9:x8', [1, NaN], 'AxisAnnotationStrokeThickness:xa:x9', [1, NaN], 'AxisAnnotationTextColor:yg:ya', [Brush.$, null], 'Axis:wx:yb', [Axis.$, null], 'IsAxisAnnotationEnabled:w1:yc', [0, false], 'Value:xg:yd', [1, 0]]); return ValueOverlay; })(); /** * @hidden */ export let ValueOverlayView = /*@__PURE__*/ (() => { class ValueOverlayView extends SeriesView { constructor(a) { super(a); this.b2 = null; this.b2 = new Path(); } bd() { super.bd(); this.b2._stroke = this.e.u8; this.b2.ad = this.e.id; this.b2.ai = this.e.v1; this.b2.aj = this.e.v2; } be() { super.be(); let a = this.br(); this.b2._stroke = a; this.b2.ad = this.e.id + 3; this.b2._stroke = a; this.b2.ad = this.e.id + 3; } b1(a) { this.b2.an = a; this.as(); } b0() { this.b2.an = null; this.as(); } a8(a, b) { super.a8(a, b); if (a.d) { a.t(this.b2); } } an(a) { super.an(a); this.e.bc.exportPathData(a, this.b2, "ValueOverlayPath", []); } } ValueOverlayView.$t = markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$); return ValueOverlayView; })();