UNPKG

igniteui-angular-charts

Version:

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

219 lines (218 loc) 8.3 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 { Base, typeCast, runOn, delegateRemove, delegateCombine, fromEnum, markType } from "igniteui-angular-core"; import { IAxisAnnotationManager_$type } from "./IAxisAnnotationManager"; import { DeviceUtils } from "igniteui-angular-core"; import { CategoryAxisBase } from "./CategoryAxisBase"; import { AxisAnnotation } from "./AxisAnnotation"; import { LabelPosition } from "./LabelPosition"; import { MathUtil } from "igniteui-angular-core"; import { Thickness } from "igniteui-angular-core"; import { BrushUtilCore } from "igniteui-angular-core"; import { isNaN_ } from "igniteui-angular-core"; /** * @hidden */ export let AxisAnnotationManager = /*@__PURE__*/ (() => { class AxisAnnotationManager extends Base { constructor() { super(...arguments); this._owner = null; } get owner() { return this._owner; } set owner(a) { this._owner = a; } onAddAnnotations(a) { let b = 0; for (let c = 0; c < a.at.count; c++) { b = this.b(a, a.at._inner[c], b); } for (let d = 0; d < a.as.count; d++) { b = this.b(a, a.as._inner[d], b); } a.ca.count = b; a.b9.count = b; a.cc.count = b; a.cb.count = b; } static a(a) { if (isNaN_(a) || a < 0) { return DeviceUtils.g(3); } return a; } b(a, b, c) { let d = NaN; d = b.value; if (typeCast(AxisAnnotation.$, b) !== null) { let e = b.m; if (e && a.df && !a.dj) { let f = typeCast(CategoryAxisBase.$, a); if (f.categoryMode != 0) { d = d + 0.5; } } } let g = new LabelPosition(0, a.gs(d)); if (a.dg) { let h = a; if (h.categoryMode == 2) { let i = a.b2.yr; let j = a.o3; let k = a.oy(); g.h += (a.dn ? -h.getCategorySize(i, j, k) * 0.5 : h.getCategorySize(i, j, k) * 0.5); } } let l = g.h; if (a.dy) { if ((g.h > a.o3.bottom && !MathUtil.a(g.h, a.o3.bottom)) || (g.h < a.o3.top && !MathUtil.a(g.h, a.o3.top))) { return c; } } else { if ((g.h > a.o3.right && !MathUtil.a(g.h, a.o3.right)) || (g.h < a.o3.left && !MathUtil.a(g.h, a.o3.left))) { return c; } } let m = a.ca.item(c); let n = a.cc.item(c); let o = a.cb.item(c); let p = 100 + c * 2; c++; AxisAnnotationManager.f(b, n); AxisAnnotationManager.d(b, m); AxisAnnotationManager.e(b, o, n.al != null && n.al.length > 0); o.ah = a; AxisAnnotationManager.g(m, n, o, p); b.checkForExtentReset(() => g.d = true); g.b = true; g.a = b.isBadgeEnabled; g.e = b.isBadgeEnabled ? o.a7().width : 0; g.i = b.backgroundPadding; g.g = b.backgroundCornerRadius; g.c = b.isPillShaped; a.eq.add(g); a.ep.add1(n.al); return c; } static g(a, b, c, d) { a.s = d; c.s = d + 1; b.s = d + 1; } static f(a, b) { b.al = a.resolveLabelValue(); if (a.textColor != null) { b.ao = a.textColor; } } static d(a, b) { b._fill = a.background; b.ap = AxisAnnotationManager.a(a.backgroundCornerRadius); b.aq = AxisAnnotationManager.a(a.backgroundCornerRadius); b._stroke = a.outline; b.ad = a.strokeThickness; } static e(a, b, c) { b.am = DeviceUtils.g(a.badgeSize); b.bb = new Thickness(1, 0, 0, c ? a.badgeMargin : 0, 0); b.a5 = a.badgeBackground; b.al = a.badgeCornerRadius; b.a6 = a.badgeOutline; b.ba = a.badgeOutline == null || BrushUtilCore.a(a.badgeOutline) ? new Thickness(0, 0) : new Thickness(0, a.badgeOutlineThickness); b._visibility = a.isBadgeEnabled ? 0 : 1; b.as = a.badgeImagePath; } arrangeAnnotations(a, b, c, d, e, f, g, h, i, j) { for (let k = 0; k < a.cc.count; k++) { let l = a.ca.item(k); let m = a.b9.item(k); let n = a.cb.item(k); let o = -1; for (let p = c.count - 1; p >= 0; p--) { if (c._inner[p] == a.cc.item(k)) { o = p; break; } } if (o == -1) { continue; } let q = a.eq._inner[o]; if (e) { let r = b.av(l, a.cc.item(k), n, q, d._inner[o], g, h, i, j); b.aq(l, a.cc.item(k), n, q, d._inner[o], g, h, i, j, f); m.d = r.x; m.e = r.y; m.f = r.width; m.c = r.height; } else { let s = b.av(l, a.cc.item(k), n, q, d._inner[o], g, h, i, j); b.ac(l, n); m.d = s.x; m.e = s.y; m.f = s.width; m.c = s.height; } if (q.c) { l.ap = m.c * 0.5; l.aq = l.ap; } } } c(a, b) { this.owner.d0 = true; this.owner.lu(); } h(a) { if (a.oldItems != null) { for (let b = 0; b < a.oldItems.count; b++) { let c = a.oldItems.item(b); if (c == null) { continue; } let d = c; d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.c)); } } if (a.newItems != null) { for (let e = 0; e < a.newItems.count; e++) { let f = a.newItems.item(e); if (f == null) { continue; } let g = f; g.propertyChanged = delegateCombine(g.propertyChanged, runOn(this, this.c)); } } this.owner.d0 = true; this.owner.lu(); } onAnnotionsChanged(a, b, c) { this.h(c); } onAnnotionsReset(a, b, c) { for (let d of fromEnum(b)) { d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.c)); } } onAutoAnnotionsChanged(a, b, c) { this.h(c); } onAutoAnnotionsReset(a, b, c) { for (let d of fromEnum(b)) { d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.c)); } } } AxisAnnotationManager.$t = markType(AxisAnnotationManager, 'AxisAnnotationManager', Base.$, [IAxisAnnotationManager_$type]); return AxisAnnotationManager; })();