UNPKG

igniteui-angular-charts

Version:

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

390 lines (389 loc) 14.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, Number_$type, markType } from "igniteui-angular-core"; import { Brush } from "igniteui-angular-core"; import { Color } from "igniteui-angular-core"; import { LinearGradientBrush } from "igniteui-angular-core"; import { ColorUtil } from "igniteui-angular-core"; import { Axis } from "./Axis"; import { ScalerParams } from "./ScalerParams"; import { List$1 } from "igniteui-angular-core"; import { Thickness } from "igniteui-angular-core"; import { Dictionary$2 } from "igniteui-angular-core"; import { Pool$1 } from "igniteui-angular-core"; import { AxisAnnotation } from "./AxisAnnotation"; import { HashSet$1 } from "igniteui-angular-core"; import { truncate, isNaN_, log10 } from "igniteui-angular-core"; import { round10N } from "igniteui-angular-core"; /** * @hidden */ export let AxisAnnotationFrameManager = /*@__PURE__*/ (() => { class AxisAnnotationFrameManager extends Base { static e(a, b, c) { let d = new Color(); if (typeCast(LinearGradientBrush.$, a) !== null) { if (a.gradientStops == null || a.gradientStops.length < 1) { let e = new Brush(); e.color = b; return e; } d = a.gradientStops[0].color; } else { d = a.color; } let f = ColorUtil.a(d); let g = ColorUtil.a(c); let h = ColorUtil.a(b); let i = (f[3] + 0.05) / (h[3] + 0.05); let j = (g[3] + 0.05) / (f[3] + 0.05); if (i > j) { let k = new Brush(); k.color = b; } let l = new Brush(); l.color = c; return l; } static c(a, b, c, d, e, f, g) { let h = c.ai(); let i = null; let j = null; for (let k = 0; k < h.length; k++) { if (h[k].dy) { j = h[k]; } else { i = h[k]; } } let l = Color.u(255, 102, 102, 102); let m = Color.u(255, 255, 255, 255); if (i != null) { let n = new ScalerParams(1, d.yr, i.o3, i.dn); n.c = e; let o = i.f8(b.x, n); a.ac.add(o); a.ab.add(o); if (g.u != null) { a.k.add(g.u); } else { a.k.add(f); } a.j.add(g.g); if (g.y != null) { a.z.add(g.y); } else { a.z.add(AxisAnnotationFrameManager.e(a.k._inner[a.k.count - 1], l, m)); } a.v.add(g.ae.left); a.x.add(g.ae.top); a.w.add(g.ae.right); a.u.add(g.ae.bottom); if (!isNaN_(g.l)) { a.y.add(g.l); } else { a.y.add(NaN); } if (g.x != null) { a.t.add(g.x); } else { a.t.add(null); } if (g.c) { a.i.add(i); } else { a.i.add(null); } a.l.add(g.v); a.q.add(g.w); a.r.add(g.j); a.m.add(g.h); a.s.add(g.k); a.p.add(g.i); a.o.add(g.s); a.n.add(g.e); a.aa.add(g.a); } if (j != null) { let p = new ScalerParams(1, d.yr, j.o3, j.dn); p.c = e; let q = j.f8(b.y, p); a.ax.add(q); a.aw.add(q); if (g.z != null) { a.af.add(g.z); } else { a.af.add(f); } a.ae.add(g.m); if (g.ad != null) { a.au.add(g.ad); } else { a.au.add(AxisAnnotationFrameManager.e(a.af._inner[a.af.count - 1], l, m)); } a.aq.add(g.af.left); a.as.add(g.af.top); a.ar.add(g.af.right); a.ap.add(g.af.bottom); if (!isNaN_(g.r)) { a.at.add(g.r); } else { a.at.add(NaN); } if (g.ac != null) { a.ao.add(g.ac); } else { a.ao.add(null); } if (g.d) { a.ad.add(j); } else { a.ad.add(null); } a.ag.add(g.aa); a.al.add(g.ab); a.am.add(g.p); a.ah.add(g.n); a.an.add(g.q); a.ak.add(g.o); a.aj.add(g.t); a.ai.add(g.f); a.av.add(g.b); } } static b(a) { a.i.clear(); a.ad.clear(); a.ac.clear(); a.ax.clear(); a.ab.clear(); a.aw.clear(); a.k.clear(); a.j.clear(); a.t.clear(); a.v.clear(); a.x.clear(); a.w.clear(); a.u.clear(); a.y.clear(); a.z.clear(); a.l.clear(); a.q.clear(); a.r.clear(); a.m.clear(); a.s.clear(); a.p.clear(); a.o.clear(); a.n.clear(); a.aa.clear(); a.af.clear(); a.ae.clear(); a.ao.clear(); a.aq.clear(); a.as.clear(); a.ar.clear(); a.ap.clear(); a.at.clear(); a.au.clear(); a.ag.clear(); a.al.clear(); a.am.clear(); a.ah.clear(); a.an.clear(); a.ak.clear(); a.aj.clear(); a.ai.clear(); a.av.clear(); } static a(a, b, c) { if (!b.dq) { return a; } let d = 0; if (c >= 0) { d = c; } else { let e = b.gh(); d = e == 0 ? 0 : truncate(Math.max(-Math.floor(log10(e)), 0)); d += 1; } return round10N(a, d); } static d(a, b, c, d, e, f, g, h, i, j) { let k = new List$1(Axis.$, 0); let l = new HashSet$1(Axis.$, 0); let m = new Dictionary$2(Axis.$, Number_$type, 0); for (let n = 0; n < b.ac.count; n++) { if (isNaN_(b.ac._inner[n])) { continue; } let o = b.i._inner[n]; if (o != null) { if (!l.contains(o)) { k.add(o); m.item(o, 0); l.add_1(o); } let p; if (!d.containsKey(o)) { p = new Pool$1(AxisAnnotation.$); p.create = () => new AxisAnnotation(); p.destroy = (q) => { }; p.activate = (q) => o.at.add(q); p.disactivate = (q) => o.at.remove(q); d.item(o, p); e.add(o); } else { p = d.item(o); } let q = p.item(m.item(o)); m.item(o, m.item(o) + 1); q.l = false; q.value = b.ab._inner[n]; let r = b.ac._inner[n]; if (i != null) { let s = i(r); q.text = s; } else { r = AxisAnnotationFrameManager.a(r, o, g); if (o.b2 != null) { q.text = o.i6(r); } } q.textColor = b.z._inner[n]; q.background = b.k._inner[n]; q.backgroundCornerRadius = b.j._inner[n]; q.backgroundPadding = new Thickness(1, b.v._inner[n], b.x._inner[n], b.w._inner[n], b.u._inner[n]); q.outline = b.t._inner[n]; q.strokeThickness = b.y._inner[n]; q.isBadgeEnabled = b.n._inner[n]; q.badgeSize = b.s._inner[n]; q.badgeMargin = b.p._inner[n]; q.badgeBackground = b.l._inner[n]; q.badgeOutline = b.q._inner[n]; q.badgeOutlineThickness = b.r._inner[n]; q.badgeCornerRadius = b.m._inner[n]; q.badgeImagePath = b.o._inner[n]; q.k = b.aa._inner[n]; q.o = false; if (q.l) { q.l = false; c = true; } } } for (let t = 0; t < b.ax.count; t++) { if (isNaN_(b.ax._inner[t])) { continue; } let u = b.ad._inner[t]; if (u != null) { if (!l.contains(u)) { k.add(u); m.item(u, 0); l.add_1(u); } let v; if (!d.containsKey(u)) { v = new Pool$1(AxisAnnotation.$); v.create = () => new AxisAnnotation(); v.destroy = (w) => { }; v.activate = (w) => u.at.add(w); v.disactivate = (w) => u.at.remove(w); d.item(u, v); e.add(u); } else { v = d.item(u); } let w = v.item(m.item(u)); m.item(u, m.item(u) + 1); w.l = false; let x = b.ax._inner[t]; w.value = b.aw._inner[t]; if (j != null) { let y = j(x); w.text = y; } else { x = AxisAnnotationFrameManager.a(x, u, h); if (u.b2 != null) { w.text = u.i6(x); } } w.textColor = b.au._inner[t]; w.background = b.af._inner[t]; w.backgroundCornerRadius = b.ae._inner[t]; w.backgroundPadding = new Thickness(1, b.aq._inner[t], b.as._inner[t], b.ar._inner[t], b.ap._inner[t]); w.outline = b.ao._inner[t]; w.strokeThickness = b.at._inner[t]; w.isBadgeEnabled = b.ai._inner[t]; w.badgeSize = b.an._inner[t]; w.badgeMargin = b.ak._inner[t]; w.badgeBackground = b.ag._inner[t]; w.badgeOutline = b.al._inner[t]; w.badgeOutlineThickness = b.am._inner[t]; w.badgeCornerRadius = b.ah._inner[t]; w.badgeImagePath = b.aj._inner[t]; w.k = b.av._inner[t]; w.o = false; if (w.l) { w.l = false; c = true; } } } for (let z = 0; z < k.count; z++) { if (d.containsKey(k._inner[z])) { let aa = d.item(k._inner[z]); aa.count = m.item(k._inner[z]); } } for (let ab = e.count - 1; ab >= 0; ab--) { if (!l.contains(e._inner[ab])) { c = true; let ac = d.item(e._inner[ab]); ac.count = 0; ac.activate = null; ac.create = null; ac.destroy = null; ac.disactivate = null; d.removeItem(e._inner[ab]); e.removeAt(ab); } } if (c && f) { for (let ad = 0; ad < k.count; ad++) { let ae = k._inner[ad]; if (ae.bq.c) { ae.kv(true); ae.bq.c = false; } } } } } AxisAnnotationFrameManager.$t = markType(AxisAnnotationFrameManager, 'AxisAnnotationFrameManager'); return AxisAnnotationFrameManager; })();