igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
215 lines (214 loc) • 8.2 kB
JavaScript
/*
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, Number_$type, markType } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { Axis } from "./Axis";
import { List$1 } from "igniteui-react-core";
import { NumberFormatSpecifier } from "igniteui-react-core";
import { BindingFormatter } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { HashSet$1 } from "igniteui-react-core";
import { truncate, log10, isNaN_ } from "igniteui-react-core";
import { round10N } from "igniteui-react-core";
/**
* @hidden
*/
export let DataAnnotationShapeFrameManager = /*@__PURE__*/ (() => {
class DataAnnotationShapeFrameManager extends Base {
static b(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) {
a.p.add(b);
a.ab.add(c);
if (n != null) {
a.g.add(j);
a.n.add(i);
a.h.add(g);
a.o.add(f);
a.i.add(h);
a.m.add(k.top);
a.k.add(k.left);
a.l.add(k.right);
a.j.add(k.bottom);
if (l) {
a.f.add(n);
a.a1.add(d);
a.q.add(b);
}
else {
a.f.add(null);
a.a1.add(null);
a.q.add(NaN);
}
}
if (o != null) {
a.s.add(j);
a.z.add(i);
a.t.add(g);
a.aa.add(f);
a.u.add(h);
a.y.add(k.top);
a.w.add(k.left);
a.x.add(k.right);
a.v.add(k.bottom);
if (m) {
a.r.add(o);
a.a2.add(e);
a.ac.add(c);
}
else {
a.r.add(null);
a.a2.add(null);
a.ac.add(NaN);
}
}
}
static a(a, b, c, d) {
if (!b.dh) {
return a.toString();
}
if (c >= 0) {
let e = new NumberFormatSpecifier();
e.minimumFractionDigits = c;
e.maximumFractionDigits = d > 0 ? d : c;
let f = new BindingFormatter();
f.j = "{0}";
f.d = [e];
return f.i(a);
}
let g = 0;
if (d >= 0) {
g = d;
}
else {
let h = b.f5();
g = h == 0 ? 0 : truncate(Math.max(-Math.floor(log10(h)), 0));
g += 1;
}
return round10N(a, g).toString();
}
static c(a, b, c, d, e, f, g, h) {
let i = new List$1(Axis.$, 0);
let j = new HashSet$1(Axis.$, 0);
let k = new Dictionary$2(Axis.$, Number_$type, 0);
for (let l = 0; l < b.q.count; l++) {
if (isNaN_(b.q._inner[l]) || isNaN_(b.p._inner[l])) {
continue;
}
let m = b.f._inner[l];
if (m != null) {
if (!j.contains(m)) {
i.add(m);
k.item(m, 0);
j.add_1(m);
}
let n;
if (!d.containsKey(m)) {
n = new Pool$1(AxisAnnotation.$);
n.create = () => new AxisAnnotation();
n.destroy = (o) => {
};
n.activate = (o) => m.as.add(o);
n.disactivate = (o) => m.as.remove(o);
d.item(m, n);
e.add(m);
}
else {
n = d.item(m);
}
let o = n.item(k.item(m));
k.item(m, k.item(m) + 1);
o.k = false;
o.value = b.p._inner[l];
o.text = b.a1._inner[l];
o.textColor = b.o._inner[l];
o.outline = b.i._inner[l];
o.strokeThickness = b.n._inner[l];
o.background = b.h._inner[l];
o.backgroundCornerRadius = b.g._inner[l];
o.backgroundPadding = new Thickness(1, b.k._inner[l], b.m._inner[l], b.l._inner[l], b.j._inner[l]);
if (o.k) {
o.k = false;
c = true;
}
}
}
for (let p = 0; p < b.ac.count; p++) {
if (isNaN_(b.ac._inner[p]) || isNaN_(b.ab._inner[p])) {
continue;
}
let q = b.r._inner[p];
if (q != null) {
if (!j.contains(q)) {
i.add(q);
k.item(q, 0);
j.add_1(q);
}
let r;
if (!d.containsKey(q)) {
r = new Pool$1(AxisAnnotation.$);
r.create = () => new AxisAnnotation();
r.destroy = (s) => {
};
r.activate = (s) => q.as.add(s);
r.disactivate = (s) => q.as.remove(s);
d.item(q, r);
e.add(q);
}
else {
r = d.item(q);
}
let s = r.item(k.item(q));
k.item(q, k.item(q) + 1);
s.k = false;
s.value = b.ab._inner[p];
s.text = b.a2._inner[p];
s.textColor = b.aa._inner[p];
s.background = b.t._inner[p];
s.outline = b.u._inner[p];
s.strokeThickness = b.z._inner[p];
s.backgroundCornerRadius = b.s._inner[p];
s.backgroundPadding = new Thickness(1, b.w._inner[p], b.y._inner[p], b.x._inner[p], b.v._inner[p]);
if (s.k) {
s.k = false;
c = true;
}
}
}
for (let t = 0; t < i.count; t++) {
if (d.containsKey(i._inner[t])) {
let u = d.item(i._inner[t]);
u.count = k.item(i._inner[t]);
}
}
for (let v = e.count - 1; v >= 0; v--) {
if (!j.contains(e._inner[v])) {
c = true;
let w = d.item(e._inner[v]);
w.count = 0;
w.activate = null;
w.create = null;
w.destroy = null;
w.disactivate = null;
d.removeItem(e._inner[v]);
e.removeAt(v);
}
}
if (c && f) {
for (let x = 0; x < i.count; x++) {
let y = i._inner[x];
if (y.bo.c) {
y.j3(true);
y.bo.c = false;
}
}
}
}
}
DataAnnotationShapeFrameManager.$t = /*@__PURE__*/ markType(DataAnnotationShapeFrameManager, 'DataAnnotationShapeFrameManager');
return DataAnnotationShapeFrameManager;
})();