UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

239 lines (238 loc) 8.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 { Base, typeCast, runOn, delegateRemove, delegateCombine, fromEnum, markType } from "igniteui-react-core"; import { IAxisAnnotationManager_$type } from "./IAxisAnnotationManager"; import { DeviceUtils } from "igniteui-react-core"; import { CategoryAxisBase } from "./CategoryAxisBase"; import { Rect } from "igniteui-react-core"; import { LabelPosition } from "./LabelPosition"; import { AxisAnnotation } from "./AxisAnnotation"; import { MathUtil } from "igniteui-react-core"; import { Thickness } from "igniteui-react-core"; import { BrushUtilCore } from "igniteui-react-core"; import { isNaN_ } from "igniteui-react-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.cf.count = b; a.ce.count = b; a.ch.count = b; a.cg.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 = a.gv(d); let h = new LabelPosition(0, g); if (a.dq) { let i = a; let j = a.b7 != null ? a.b7.ys : Rect.empty; let k = !j.isEmpty ? a.o8 : Rect.empty; let l = a.o3(); let m = a.o2(); let n = i.py.d(k, j, l, m); if (n != null) { let o = i.py.h(n, g); h = new LabelPosition(1, o.h, o.f); } } if (a.dg) { let p = a; if (p.categoryMode == 2) { let q = a.b7.ys; let r = a.o8; let s = a.o3(); h.h += (a.dn ? -p.getCategorySize(q, r, s) * 0.5 : p.getCategorySize(q, r, s) * 0.5); } } let t = h.h; if (a.dz) { if ((h.h > a.o8.bottom && !MathUtil.a(h.h, a.o8.bottom)) || (h.h < a.o8.top && !MathUtil.a(h.h, a.o8.top))) { return c; } } else { if ((h.h > a.o8.right && !MathUtil.a(h.h, a.o8.right)) || (h.h < a.o8.left && !MathUtil.a(h.h, a.o8.left))) { return c; } } let u = a.cf.item(c); let v = a.ch.item(c); let w = a.cg.item(c); let x = 100 + c * 2; c++; AxisAnnotationManager.f(b, v); AxisAnnotationManager.d(b, u); AxisAnnotationManager.e(b, w, v.al != null && v.al.length > 0); w.ah = a; AxisAnnotationManager.g(u, v, w, x); b.checkForExtentReset(() => h.d = true); h.b = true; h.a = b.isBadgeEnabled; h.e = b.isBadgeEnabled ? w.a7().width : 0; h.i = b.backgroundPadding; h.g = b.backgroundCornerRadius; h.c = b.isPillShaped; a.es.add(h); a.er.add1(v.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) { a.a1.ba.clear(); a.a1.a9.clear(); for (let k = 0; k < a.ch.count; k++) { let l = a.cf.item(k); let m = a.ce.item(k); let n = a.cg.item(k); let o = -1; for (let p = c.count - 1; p >= 0; p--) { if (c._inner[p] == a.ch.item(k)) { o = p; break; } } if (o == -1) { continue; } let q = a.es._inner[o]; if (e) { let r = b.av(l, a.ch.item(k), n, q, d._inner[o], g, h, i, j); m.d = r.x; m.e = r.y; m.f = r.width; m.c = r.height; a.a1.ba.add(l); a.a1.a9.add(r); b.aq(l, m, a.ch.item(k), n, q, d._inner[o], g, h, i, j, f); } else { let s = b.av(l, a.ch.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; a.a1.ba.add(l); a.a1.a9.add(s); } if (q.c) { l.ap = m.c * 0.5; l.aq = l.ap; } } } c(a, b) { this.owner.d1 = true; this.owner.lz(); } 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.d1 = true; this.owner.lz(); } 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 = /*@__PURE__*/ markType(AxisAnnotationManager, 'AxisAnnotationManager', Base.$, [IAxisAnnotationManager_$type]); return AxisAnnotationManager; })();