igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,414 lines • 71.7 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 { AnnotationLayer } from "./AnnotationLayer";
import { DependencyProperty } from "igniteui-react-core";
import { Base, runOn, delegateCombine, String_$type, Array_$type, enumGetBox, EnumUtil, typeCast, fromEnum, delegateRemove, Point_$type, Date_$type, markType, markDep } from "igniteui-react-core";
import { Series } from "./Series";
import { CalloutPlacementPositionsCollection } from "./CalloutPlacementPositionsCollection";
import { HighlightedValueLabelMode_$type } from "igniteui-react-core";
import { AutoCalloutVisibilityMode_$type } from "./AutoCalloutVisibilityMode";
import { Brush } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { CalloutCollisionMode_$type } from "igniteui-react-core";
import { FontUtil } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { BindingFormatter } from "igniteui-react-core";
import { CalloutLayerFrame } from "./CalloutLayerFrame";
import { Size } from "igniteui-react-core";
import { HashSet$1 } from "igniteui-react-core";
import { CalloutAnnotationWrapper } from "./CalloutAnnotationWrapper";
import { List$1 } from "igniteui-react-core";
import { LinkedList$1 } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { LinkedListNode$1 } from "igniteui-react-core";
import { LabelCollisionManager } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { CalloutAnnotation } from "./CalloutAnnotation";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { CalloutLabelUpdatingEventArgs } from "./CalloutLabelUpdatingEventArgs";
import { CalloutSeriesSelectingEventArgs } from "./CalloutSeriesSelectingEventArgs";
import { CalloutStyleUpdatingEventArgs } from "./CalloutStyleUpdatingEventArgs";
import { BrushUtilCore } from "igniteui-react-core";
import { LabelCollisionInfo } from "igniteui-react-core";
import { BrushUtil } from "igniteui-react-core";
import { CalloutRenderStyleUpdatingEventArgs } from "./CalloutRenderStyleUpdatingEventArgs";
import { IHasCategoryAxis_$type } from "./IHasCategoryAxis";
import { QuadTreeBoundingBox } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { ViewportUtils } from "./ViewportUtils";
import { CalloutContentUpdatingEventArgs } from "./CalloutContentUpdatingEventArgs";
import { CalloutKey } from "./CalloutKey";
import { DataContext } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
import { FastItemObjectColumn } from "igniteui-react-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { TextBlock } from "igniteui-react-core";
import { Color } from "igniteui-react-core";
import { Line } from "igniteui-react-core";
import { CalloutViewHelper } from "./CalloutViewHelper";
import { Rectangle } from "igniteui-react-core";
import { TranslateTransform } from "igniteui-react-core";
/**
* @hidden
*/
export let CalloutLayer = /*@__PURE__*/ (() => {
class CalloutLayer extends AnnotationLayer {
bk() {
return new CalloutLayer();
}
get_ep() {
return true;
}
constructor() {
super();
this.aa6 = true;
this.af7 = new Size(1, 0, 0);
this.calloutStyleUpdating = null;
this.calloutRenderStyleUpdating = null;
this.aau = null;
this.aav = null;
this.aaw = null;
this.aat = null;
this.aas = null;
this.abt = new HashSet$1(CalloutAnnotationWrapper.$, 0);
this.abw = new List$1(CalloutAnnotationWrapper.$, 0);
this.abx = new List$1(CalloutAnnotationWrapper.$, 0);
this.aaj = null;
this.z7 = null;
this.aaq = null;
this.abu = new LinkedList$1(CalloutAnnotationWrapper.$);
this.abr = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
this.aa2 = null;
this.af5 = new Rect(0, 0, 0, 1, 1);
this.aa9 = false;
this.abb = false;
this.acc = 0;
this.af4 = Rect.empty;
this.aa8 = false;
this.aba = false;
this.calloutContentUpdating = null;
this.calloutLabelUpdating = null;
this.calloutSeriesSelecting = null;
this.abv = new List$1(SeriesPointOfInterest.$, 0);
this.abd = false;
this.abe = false;
this.abz = 0;
this.abc = false;
this.aaa = null;
this.aa7 = true;
this.aab = 1;
FastItemObjectColumn.m();
this.z7 = null;
this.aaj = new CalloutPlacementPositionsCollection();
let a = this.aaj;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.ad7));
this.xm = true;
let b = new CalloutLayerFrame();
let c = new CalloutLayerFrame();
let d = new CalloutLayerFrame();
let e = this.kd / 1000;
this.xe = b;
this.xd = c;
this.xf = d;
this.ab = CalloutLayer.$;
}
ad7(a, b) {
this.aeg();
}
aeg() {
this.z7 = this.z9(this.aak);
this.aed();
}
ad8(a, b) {
this.abx.clear();
this.rs(false);
}
pb(a, b, c, d) {
super.pb(a, b, c, d);
let e = this.abs();
switch (a) {
case 3:
this.aen(b, e);
break;
case 1:
for (let f = b; f < b + c; f++) {
let g = new CalloutAnnotation();
let h = new CalloutAnnotationWrapper();
h.b = g;
h.b.series = this.aap;
this.abx.insert(f, h);
this.aen(f, e);
}
break;
case 0:
this.abx.v(b, c);
break;
case 2:
for (let i = b; i < b + c; i++) {
this.aen(i, e);
}
break;
case 4:
this.abx.clear();
for (let j = 0; j < this.dp.count; j++) {
let k = new CalloutAnnotation();
let l = new CalloutAnnotationWrapper();
l.b = k;
l.b.series = this.aap;
this.abx.add(l);
this.aen(j, e);
}
break;
}
this.rs(true);
}
gf(a) {
return false;
}
af9() {
let a = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.af8.left) || isNaN_(this.af8.top) || isNaN_(this.af8.right) || isNaN_(this.af8.bottom)) {
a = new Thickness(0, DeviceUtils.g(3));
}
else {
a = this.af8;
}
return a;
}
wv() {
let a = 0;
let b = 0;
if (!this.abf) {
return new Size(1, b, a);
}
if (!this.aa6) {
return this.af7;
}
let c = "Ig";
let d = this.af9();
let e = this.aai.cy(c, d);
if (!isNaN_(e.height)) {
a = Math.max(e.height, a);
}
if (!isNaN_(this.ab9)) {
a += this.ab9;
}
if (!isNaN_(this.ab9)) {
b += this.ab9;
}
if (!isNaN_(this.ab3)) {
a = Math.max(a, this.ab3);
}
if (!isNaN_(this.ab1)) {
a = Math.min(a, this.ab1);
}
if (!isNaN_(this.ab4)) {
b = Math.max(b, this.ab4);
}
if (!isNaN_(this.ab2)) {
b = Math.min(b, this.ab2);
}
this.aa6 = false;
this.af7 = new Size(1, b, a);
return this.af7;
}
abs() {
let a = new Dictionary$2(String_$type, Series.$, 0);
if (this.dc != null) {
for (let b = 0; b < this.dc.series.count; b++) {
let c = this.dc.series._inner[b];
if (c.name != null && !a.containsKey(c.name)) {
a.addItem(c.name, c);
}
}
}
return a;
}
aen(a, b) {
if (this.aa1 == null || this.aaz == null) {
return;
}
let c = a;
if (this.aa0 != null) {
c = this.aa0.item(a);
}
let d = this.aa1.item(a);
let e = this.aaz.item(a);
let f = this.abx._inner[a];
if (this.aay != null) {
if (f.b.ab != this.aay.item(a)) {
f.b.key = this.aay.item(a);
}
}
if (this.abr.containsKey(f)) {
f.b = this.abr.item(f).c.b;
}
f.b.xValue = c;
f.b.yValue = d;
if (this.calloutLabelUpdating != null) {
let g = ((() => {
let $ret = new CalloutLabelUpdatingEventArgs();
$ret.d = c;
$ret.e = d;
$ret.item = this.dp.item(a);
return $ret;
})());
this.calloutLabelUpdating(this, g);
if (g.c != null && !Base.equalsStatic(g.c, f.b.ao)) {
let h = g.c;
if (this.aaa != null) {
f.b.text = this.aaa.i(h);
}
else {
f.b.text = h != null ? h.toString() : "";
}
}
}
else {
if (this.aaa != null) {
f.b.text = this.aaa.i(e);
}
else {
f.b.text = e != null ? e.toString() : "";
}
}
if (this.aax != null) {
f.b.content = this.aax.item(a);
}
else {
f.b.content = this.dp.item(a);
}
if (this.calloutSeriesSelecting != null) {
let i = ((() => {
let $ret = new CalloutSeriesSelectingEventArgs();
$ret.c = c;
$ret.d = d;
$ret.item = this.dp.item(a);
return $ret;
})());
this.calloutSeriesSelecting(this, i);
if (i.a != null) {
f.b.series = i.a;
}
else if (i.e != null) {
if (b.containsKey(i.e)) {
f.b.series = b.item(i.e);
}
}
}
this.aeo(f);
}
aeo(a) {
let b = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.af8.left) || isNaN_(this.af8.top) || isNaN_(this.af8.right) || isNaN_(this.af8.bottom)) {
b = new Thickness(0, DeviceUtils.g(3));
}
else {
b = this.af8;
}
let c = DeviceUtils.g(3);
if (isNaN_(this.ab0)) {
c = DeviceUtils.g(3);
}
else {
c = this.ab0;
}
let d = this.afy != null && !this.abn ? this.afy : this.aai.cs(a.b.l, a.b.itemColor);
let e = this.af3 != null ? this.af3 : null;
let f = this.af1 != null ? this.af1 : this.aai.cv();
let g = this.afz != null ? this.afz : this.aai.ct();
let h = this.af2 != null && !this.abo ? this.af2 : this.aai.cw(a.b.l, a.b.itemColor);
let i = this.af0 != null ? this.af0 : this.aai.cu(a.b.l, a.b.itemColor);
let j = isNaN_(this.aca) ? 0 : this.aca;
if (e == null && (this.abl || this.af1 != null || this.afz != null)) {
let k = d;
if (k == null || BrushUtilCore.a(d)) {
k = this.dc != null ? this.dc.vl : null;
if (a.c != null && (a.c.b == 8 || a.c.b == 9)) {
k = a.b.itemColor;
}
if (k == null || BrushUtilCore.a(d)) {
k = BrushUtil.h(255, 255, 255, 255);
}
}
e = BrushUtil.j(k, g, f);
}
if (e == null) {
e = this.aai.cv();
}
if (this.abj && this.calloutStyleUpdating != null) {
let l = new CalloutStyleUpdatingEventArgs();
l.item = a.b.aa;
l.xValue = a.b.ac;
l.yValue = a.b.ad;
l.series = a.b.l;
l.background = d;
l.textColor = e;
l.outline = h;
l.leaderBrush = i;
l.strokeThickness = j;
this.calloutStyleUpdating(this, l);
d = l.background;
e = l.textColor;
h = l.outline;
i = l.leaderBrush;
j = l.strokeThickness;
}
a.b.backgroundPadding = b;
a.b.backgroundCornerRadius = c;
a.b.background = d;
a.b.textColor = e;
a.b.outline = h;
a.b.leaderBrush = i;
a.b.strokeThickness = j;
}
kq(a, b) {
let c = this.nd(b);
if (c == CalloutLayer.$$p[31]) {
return this.kr(a, b, this.adm);
}
if (c == CalloutLayer.$$p[42]) {
return this.kr(a, b, this.ad2);
}
if (c == CalloutLayer.$$p[43]) {
return this.kr(a, b, this.ad5);
}
if (c == CalloutLayer.$$p[28]) {
return this.kr(a, b, this.adg);
}
if (c == CalloutLayer.$$p[22]) {
return this.kr(a, b, this.ac8);
}
return super.kq(a, b);
}
md(a) {
let b = this.nd(a);
if (b == CalloutLayer.$$p[31]) {
return this.adm;
}
if (b == CalloutLayer.$$p[42]) {
return this.ad2;
}
if (b == CalloutLayer.$$p[43]) {
return this.ad5;
}
if (b == CalloutLayer.$$p[28]) {
return this.adg;
}
if (b == CalloutLayer.$$p[22]) {
return this.ac8;
}
return super.md(a);
}
get aaz() {
return this.aau;
}
set aaz(a) {
if (this.aau != a) {
let b = this.aau;
this.aau = a;
this.raisePropertyChanged("LabelColumn", b, this.aau);
}
}
get aa0() {
return this.aav;
}
set aa0(a) {
if (this.aav != a) {
let b = this.aav;
this.aav = a;
this.raisePropertyChanged("XColumn", b, this.aav);
}
}
get aa1() {
return this.aaw;
}
set aa1(a) {
if (this.aaw != a) {
let b = this.aaw;
this.aaw = a;
this.raisePropertyChanged("YColumn", b, this.aaw);
}
}
get aay() {
return this.aat;
}
set aay(a) {
if (this.aat != a) {
let b = this.aat;
this.aat = a;
this.raisePropertyChanged("KeyColumn", b, this.aat);
}
}
get aax() {
return this.aas;
}
set aax(a) {
if (this.aas != a) {
let b = this.aas;
this.aas = a;
this.raisePropertyChanged("ContentColumn", b, this.aas);
}
}
aea(a, b) {
if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
let c = a.k;
if (!this.abt.contains(c)) {
this.abt.add_1(c);
this.abw.add(c);
this.rs(false);
}
}
}
ct() {
return new CalloutLayerView(this);
}
q1(a) {
super.q1(a);
this.aai = a;
}
get aak() {
return this.aaj;
}
set aak(a) {
let b = this.aak;
if (a != b) {
this.aaj = a;
this.raisePropertyChanged("AllowedPositions", b, this.aak);
}
}
gu(a) {
if (this.aap == null) {
return true;
}
if (this.aap == a) {
return true;
}
return false;
}
get aad() {
return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.afa));
}
set aad(a) {
this.h(CalloutLayer.afa, enumGetBox(AutoCalloutVisibilityMode_$type, a));
}
get aac() {
return this.aab;
}
set aac(a) {
this.aab = a;
}
get af8() {
return new Thickness(1, this.ab6, this.ab8, this.ab7, this.ab5);
}
get aar() {
if (this.aaq == null) {
this.aaq = FontUtil.toFontInfo(this.jz, this.ads);
}
return this.aaq;
}
yt(a, b) {
if (this.aap == null || this.aap == a) {
if (!this.a1.c) {
this.rs(b);
}
}
}
yv(a, b) {
super.yv(a, b);
let c = a;
c.q.clear();
c.r.clear();
c.n.clear();
c.f.clear();
c.i.clear();
c.h.clear();
c.k.clear();
c.m.clear();
c.l.clear();
c.j.clear();
c.g.clear();
c.o.clear();
c.p.clear();
c.u.clear();
c.v.clear();
c.s.clear();
c.t.clear();
let d = this.aby();
let e = new List$1(CalloutAnnotationWrapper.$, 0);
let f = Number.POSITIVE_INFINITY;
let g = true;
if (this.abg) {
if (this.xk(this.aap)) {
if (typeCast(IHasCategoryAxis_$type, this.aap) !== null) {
let h = this.aap.iw() > 0 ? this.aap.iw() : this.aap.getCategoryWidth();
if (!isNaN_(h) && !isInfinity(h) && h > 0) {
f = Math.min(f, h);
}
}
this.aei(this.aap, c, e);
}
else {
for (let i of fromEnum(this.dc.series)) {
if (this.xk(i)) {
if (typeCast(IHasCategoryAxis_$type, i) !== null) {
let j = i.iw() > 0 ? i.iw() : i.getCategoryWidth();
if (!isNaN_(j) && !isInfinity(j) && j > 0) {
f = Math.min(f, j);
}
}
if (!i.et) {
if (!i.isVertical) {
g = false;
}
}
let k = false;
if (i.eh && this.aao == 0 || this.aao == 3 || this.aao == 2) {
if (this.aao == 0 || this.aao == 2) {
k = true;
}
i.p1((l) => {
this.aei(l, c, e);
return true;
});
}
if (!k) {
this.aei(i, c, e);
}
}
}
}
}
if (this.abg && this.aac == 2) {
let l = 0;
let m = 0;
let n = 1.7976931348623157E+308;
let o = 1.7976931348623157E+308;
let p = -1.7976931348623157E+308;
let q = -1.7976931348623157E+308;
if (e.count > 0) {
if (e._inner[0].c != null) {
l = e._inner[0].e;
m = e._inner[0].f;
}
for (let r = 0; r < e.count; r++) {
let s = e._inner[r];
if (s.c != null) {
let t = s.e;
let u = s.f;
if (t != l) {
n = Math.min(n, Math.abs(t - l));
}
if (u != m) {
o = Math.min(o, Math.abs(u - m));
}
p = Math.max(s.c.p + s.c.p, p);
q = Math.max(s.c.o + s.c.o, q);
}
}
if (g) {
if (!isNaN_(f) && !isInfinity(f)) {
if (q > f) {
e.clear();
}
}
else {
if (q > o) {
e.clear();
}
}
}
else {
if (!isNaN_(f) && !isInfinity(f)) {
if (p > f) {
e.clear();
}
}
else {
if (p > n) {
e.clear();
}
}
}
}
}
this.aeh(c, d, e);
}
st(a, b) {
super.st(a, b);
let c = b.width - this.af5.width;
let d = b.height - this.af5.height;
let e = 0;
if (Math.abs(c) > Math.abs(d)) {
e = c;
this.abz = c * this.wu.width;
}
else {
e = d;
this.abz = d * this.wu.height;
}
if (e > 0 && this.abz > 5) {
this.abe = true;
}
if (e < 0 && this.abz > 5) {
this.abd = true;
}
}
ss(a, b) {
super.ss(a, b);
if (!a.equals1(b)) {
this.abc = true;
}
}
get af6() {
return this.af4;
}
set af6(a) {
this.af4 = a;
}
aeh(a, b, c) {
if (this.dc != null) {
this.af5 = this.dc.v5;
}
if (this.wu.isEmpty) {
return;
}
this.af6 = new Rect(0, this.wu.left, this.wu.top, this.wu.width, this.wu.height);
if (this.aa2 != null && this.ac5 != null && this.ac5 != this.aa2.bd) {
this.aec();
}
if (this.aa2 != null && this.aa2.j != this.aa4()) {
this.aec();
}
if (this.aa2 == null) {
let d = this.aa3();
if (d != null) {
this.aa2 = d;
let e = this.aa2;
e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.ad9));
}
else {
let f = this.wl(this.cw);
let g = new Array(2);
g[0] = 0;
g[1] = 3;
if (this.aap != null) {
if (this.aap.isVertical) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
else {
let h = false;
if (this.dc != null && this.dc.series.count > 0) {
h = true;
for (let i of fromEnum(this.dc.series)) {
if (!i.et) {
if (!i.isVertical) {
h = false;
}
}
}
}
if (h) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
if (this.aaf == 4 || this.aaf == 6) {
g = new Array(4);
g[0] = 10;
g[1] = 11;
g[2] = 8;
g[3] = 9;
}
if (this.aaf == 5) {
g = new Array(4);
g[0] = 9;
g[1] = 10;
g[2] = 11;
g[3] = 8;
}
if (this.aaf == 7) {
g = new Array(4);
g = new Array(4);
g[0] = 8;
g[1] = 10;
g[2] = 11;
g[3] = 9;
}
this.aa2 = new LabelCollisionManager(this.wu.right, this.wu.bottom, this.wu, this.aai.k(), this.ab9, this.aa4(), g, this.acg(), this.acf(), this.abh, this.z7);
this.aa2.v = this.abk;
if (this.ac5 != null) {
this.aa2.bd = this.ac5;
this.aa2.bb = this;
}
let j = this.aa2;
j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.ad9));
}
}
if (this.abd) {
this.abd = false;
if (this.aa2.a9 > 2) {
this.abb = true;
}
}
if (this.abe) {
this.abe = false;
if (this.abz > 5) {
this.abb = true;
}
}
if (this.abc) {
this.abc = false;
this.aa2.bs(this.wu.right, this.wu.bottom, this.wu);
this.abb = true;
}
let k = new HashSet$1(CalloutAnnotationWrapper.$, 0);
let l = new HashSet$1(CalloutAnnotationWrapper.$, 0);
let m = new List$1(CalloutAnnotationWrapper.$, 0);
let n = new List$1(CalloutAnnotationWrapper.$, 0);
let o = new HashSet$1(CalloutAnnotationWrapper.$, 0);
for (let p = 0; p < b.count; p++) {
o.add_1(b._inner[p]);
}
for (let q = 0; q < c.count; q++) {
o.add_1(c._inner[q]);
}
let r = this.abu.c;
while (r != null) {
let s = r.a;
if (!o.contains(r.c)) {
n.add(r.c);
l.add_1(r.c);
let t = r.c.b;
t.propertyChanged = delegateRemove(t.propertyChanged, runOn(this, this.aea));
this.abu.h(r);
this.abr.removeItem(r.c);
this.aa2.br(r.c.c);
}
r = s;
}
for (let u = 0; u < b.count; u++) {
if (!this.abr.containsKey(b._inner[u])) {
this.abu.f(b._inner[u]);
let v = b._inner[u].b;
v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.aea));
this.abr.addItem(b._inner[u], this.abu.d);
m.add(b._inner[u]);
k.add_1(b._inner[u]);
this.abb = true;
}
}
for (let w = 0; w < c.count; w++) {
if (!this.abr.containsKey(c._inner[w])) {
this.abu.f(c._inner[w]);
this.abr.addItem(c._inner[w], this.abu.d);
let x = c._inner[w].b;
x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.aea));
m.add(c._inner[w]);
k.add_1(c._inner[w]);
this.abb = true;
}
}
if (this.aa8 == true) {
this.aa8 = false;
this.abb = true;
}
let y = false;
if (this.abw.count > 0) {
y = true;
this.abw.clear();
this.abt.clear();
}
r = this.abu.c;
while (r != null) {
let z = this.aa5(r.c);
if (z == null) {
return;
}
if (!Base.equalsStatic(z, r.c.c.e)) {
let aa = false;
if (r.c.c.e == null) {
aa = true;
}
let ab = r.c.c;
ab.s = z.d;
ab.t = z.e;
if (!isNaN_(ab.s) && !isNaN_(ab.t)) {
ab.r = z.g;
ab.q = z.f;
if (ab.c == null) {
this.aa2.ad(ab, false);
}
if (aa) {
this.aa2.be(ab);
}
else {
this.aa2.bo(ab);
}
}
}
r = r.a;
}
let ac = this.aa2.ba();
let ad = this.aa2.af();
if (!this.abb && y && (ac != 0 || ad)) {
{
this.abb = true;
}
}
if (ad) {
if (this.aa2.x()) {
this.abb = true;
}
}
if (this.abb && (ac != 0 || ad || this.aa9)) {
this.aa9 = false;
this.abb = false;
this.acc = 0x7FFFFFFF;
if (this.ac5 != null) {
let ae = true;
for (let af = 0; af < this.dc.series.count; af++) {
let ag = this.dc.series._inner[af];
if (ag.et && typeCast(CalloutLayer.$, ag) !== null) {
let ah = ag;
if (ah.ac5 == this.ac5) {
if (!ah.af6.equals1(this.aa2.b0)) {
ae = false;
break;
}
}
}
}
if (ae) {
this.aa2.bv();
}
else {
this.aa2.bf();
this.aa2.bg();
}
}
else {
this.aa2.bv();
}
}
else {
this.aa2.bg();
}
let ai = this.abu.c;
let aj;
let ak;
let al;
let am;
let an;
let ao;
let ap;
let aq;
let ar;
let as;
let at;
let au;
let av;
let aw;
let ax;
let ay;
let az = this.abi;
let a0 = this.abk;
let a1 = this.cw.bx();
while (ai != null) {
let a2 = ai.c;
let a3 = a2.b;
aj = a3.bm;
ak = a3.bp;
al = a3.bo;
am = a3.backgroundPadding.left;
an = a3.backgroundPadding.top;
ao = a3.backgroundPadding.right;
ap = a3.backgroundPadding.bottom;
ar = a3.backgroundCornerRadius;
aq = a3.y;
as = a3.bq;
at = a3.ao;
au = a3.aa;
let a4 = a2.c;
av = a4.s - (a4.k - a4.p);
aw = a4.t - (a4.l - a4.o);
ax = a4.k - a4.p;
ay = a4.l - a4.o;
let a5 = false;
if (a0) {
if (a4.c != null && this.aa2.ab(a4.c)) {
a5 = true;
}
}
if (a2.c.h && !a5) {
av = NaN;
aw = NaN;
}
if (!a2.c.h && (a2.c.b == 8 || a2.c.b == 9)) {
al = a1;
av = a4.k;
aw = a4.l;
}
if (a5) {
at = this.adu(a2, at);
let a6 = this.aa2.as(a2.c.c);
if (a6 > 0) {
ax += a6;
av -= a6;
}
}
if (az) {
let a7 = new CalloutRenderStyleUpdatingEventArgs();
a7.background = aj;
a7.outline = ak;
a7.leaderBrush = al;
a7.strokeThickness = aq;
a7.textColor = as;
a7.item = au;
a7.series = a3.l;
a7.actualPosition = a4.b;
a7.xValue = a3.ac;
a7.yValue = a3.ad;
if (this.calloutRenderStyleUpdating != null) {
this.calloutRenderStyleUpdating(this, a7);
aj = a7.background;
ak = a7.outline;
al = a7.leaderBrush;
aq = a7.strokeThickness;
as = a7.textColor;
}
}
a.n.add1(a2);
a.f.add(aj);
a.i.add(ak);
a.h.add(al);
a.k.add(am);
a.m.add(an);
a.l.add(ao);
a.j.add(ap);
a.g.add(ar);
a.o.add(aq);
a.p.add(as);
a.q.add1(at);
a.r.add1(au);
a.u.add(av);
a.v.add(aw);
a.s.add(ax);
a.t.add(ay);
ai = ai.a;
}
}
adu(a, b) {
let c = Math.max(this.aa2.as(a.c.c), this.aa2.at(a.c.c));
if (c <= 0) {
return b;
}
let d = b.length;
let e = this.aai.cy(b, a.b.backgroundPadding);
let f = e.width;
let g = f - c;
while (f - g > 0.0001 && d > 0) {
d--;
b = b.substr(0, d) + "…";
e = this.aai.cy(b, a.b.backgroundPadding);
f = e.width;
}
return b;
}
aec() {
if (this.aa2 != null) {
let a = this.abu.c;
while (a != null) {
let b = a.c.c;
if (b != null) {
this.aa2.br(b);
}
a = a.a;
}
let c = this.aa2;
c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.ad9));
this.aa2 = null;
}
this.aeb();
}
aa3() {
if (this.dc == null) {
return null;
}
for (let a = 0; a < this.dc.series.count; a++) {
let b = this.dc.series._inner[a];
if (b.et && typeCast(CalloutLayer.$, b) !== null) {
let c = b;
if (c != this) {
if (c.ac5 != null && c.ac5 == this.ac5) {
if (c.aa2 != null) {
return c.aa2;
}
}
}
}
}
return null;
}
acf() {
return 20000;
}
acg() {
return 300;
}
aa4() {
switch (this.aaf) {
case 0: return 2;
case 2: return 1;
case 3: return 2;
case 1: return 0;
case 4: return 3;
case 7: return 7;
case 5: return 5;
case 6: return 6;
}
return 2;
}
ad9(a) {
let b = this.aa2.ba();
let c = this.acc;
if (b < this.acc) {
this.acc = b;
if (c != 0x7FFFFFFF) {
this.rs(false);
}
}
}
aa5(a) {
let b = this.aap;
if (a.b.l != null) {
b = a.b.l;
}
if (b == null) {
for (let c = 0; c < this.dc.series.count; c++) {
let d = this.dc.series._inner[c];
if (!d.et) {
b = d;
break;
}
}
}
if (b == null) {
return null;
}
let e = b.ai();
let f = b.iy();
let g = null;
let h = null;
let i = false;
for (let j = 0; j < e.length; j++) {
if (e[j] == null) {
continue;
}
if (e[j].b9) {
i = true;
g = e[j];
}
else if (e[j].cm) {
i = true;
h = e[j];
}
else if (e[j].cp) {
h = e[j];
}
else {
g = e[j];
}
}
if (g == null || h == null) {
return null;
}
if (!g.co() || !h.co()) {
return null;
}
let k = 0;
let l = 0;
if (g.cb && g.categoryMode != 0) {
if (b.e7) {
k = b.getOffsetValue();
}
else if (b.ez) {
k = b.getOffsetValue();
}
}
if (h.cb && h.categoryMode != 0) {
if (b.ez) {
l = b.getOffsetValue();
}
}
let m = new ScalerParams(0, this.dc.v5, g.kh, g.ch, g.kc());
m.b = f;
let n = new ScalerParams(0, this.dc.v5, h.kh, h.ch, h.kc());
n.b = f;
let o = 0;
let p = 0;
if (i) {
o = g.el(this.acb(a.b.ac), m) + k;
p = h.el(this.acb(a.b.ad), n) + l;
let q = o;
let r = p;
let s = { $type: Point_$type, x: 0.5, y: 0.5 };
let t = s.x + (r * Math.cos(q));
o = ViewportUtils.e(t, m.e, m.d, m.c);
let u = s.y + (r * Math.sin(q));
p = ViewportUtils.i(u, n.e, n.d, n.c);
}
else {
o = g.el(this.acb(a.b.ac), m) + k;
p = h.el(this.acb(a.b.ad), n) + l;
}
let v = new QuadTreeBoundingBox();
v.d = o;
v.e = p;
v.g = 3;
v.f = 3;
v.i = a.b;
return v;
}
acb(a) {
if (typeCast(Date_$type, a) !== null) {
return a.getTime();
}
if (a == null) {
return 0;
}
return a;
}
aby() {
let a = new List$1(CalloutAnnotationWrapper.$, 0);
for (let b = 0; b < this.abx.count; b++) {
if (stringIsNullOrEmpty(this.abx._inner[b].b.ao)) {
continue;
}
if (this.abx._inner[b].c == null) {
let c = new LabelCollisionInfo();
this.abx._inner[b].c = c;
let d = this.aai.cy(this.ach(this.abx._inner[b]), this.abx._inner[b].b.backgroundPadding);
c.o = d.height / 2;
c.p = d.width / 2;
}
let e = this.aa5(this.abx._inner[b]);
if (e == null || e.d < this.wu.left || e.d > this.wu.right || e.e < this.wu.top || e.e > this.wu.bottom) {
continue;
}
a.add(this.abx._inner[b]);
}
return a;
}
ach(a) {
return a.b.ao;
}
xk(a) {
if (!super.xk(a)) {
return false;
}
if (this.adp != null) {
if (a.isFragment) {
let b = a.nc();
if (!Base.equalsStatic(this.adp, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.adp, a.name)) {
return false;
}
}
}
return true;
}
qp() {
super.qp();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.aa7) {
this.aa7 = false;
this.aej();
this.aee();
}
if (this.d4()) {
this.aem(this.xf, false);
}
else {
this.aem(this.xd, false);
}
}
aef() {
if (!this.aba) {
this.aba = true;
this.rs(true);
}
}
aei(a, b, c) {
let d = false;
if (this.aba) {
this.aba = false;
d = true;
}
a.ki = this.aaa;
if (!a.gi && a.ec(this.abv, this.abq, this.abm, this.acd, false)) {
let e = this.abv;
for (let f = 0; f < this.abv.count; f++) {
let g = e._inner[f];
let h = g.b != null ? g.b.item : null;
let i = g.b.item != null ? g.b.item : g.b;
let j = g.g;
let k = a;
let l = new CalloutKey(i, k);
let m = new CalloutAnnotationWrapper();
let n = new CalloutAnnotation();
m.b = n;
n.key = l;
let o = false;
if (this.abr.containsKey(m)) {
m = this.abr.item(m).c;
n = m.b;
o = d;
}
else {
o = true;
}
let p = n.ac;
let q = n.ad;
if (this.acb(p) != this.acb(g.d) && (!isNaN_(this.acb(p)) || !isNaN_(this.acb(g.d)))) {
n.xValue = g.d;
}
if (this.acb(q) != this.acb(g.e) && (!isNaN_(this.acb(q)) || !isNaN_(this.acb(g.e)))) {
n.yValue = g.e;
}
n.itemColor = j;
n.series = a;
let r = false;
if (g.f != n.az) {
n.az = g.f;
r = true;
}
if (o || r) {
if (this.calloutLabelUpdating != null) {
let s = ((() => {
let $ret = new CalloutLabelUpdatingEventArgs();
$ret.d = n.ac;
$ret.e = n.ad;
$ret.item = h;
$ret.a = a;
$ret.f = a.name;
return $ret;
})());
this.calloutLabelUpdating(this, s);
if (s.c != null && !Base.equalsStatic(s.c, m.b.ao)) {
let t = s.c;
if (this.aaa != null) {
m.b.text = this.aaa.i(t);
}
else {
m.b.text = t != null ? t.toString() : "";
}
}
}
else {
if (g.f != null) {
n.text = g.f;
}
}
}
if (n.ao == null) {
continue;
}
if (o || r) {
if (this.calloutContentUpdating != null) {
let u = ((() => {
let $ret = new CalloutContentUpdatingEventArgs();
$ret.c = n.ac;
$ret.d = n.ad;
$ret.item = h;
$ret.a = i;
return $ret;
})());
this.calloutContentUpdating(this, u);
if (u.a != null && u.a != m.b.aa) {
m.b.content = u.a;
}
}
else {
if (i != null && i != m.b.aa) {
m.b.content = i;
}
}
}
if (o) {
this.aeo(m);
}
if (m.c == null) {
let v = new LabelCollisionInfo();
m.c = v;
let w = this.aai.cy(this.ach(m), m.b.backgroundPadding);
v.o = w.height / 2;
v.p = w.width / 2;
}
let x = this.aa5(m);
if (x == null || x.d < this.wu.left || x.d > this.wu.right || x.e < this.wu.top || x.e > this.wu.bottom) {
continue;
}
m.e = x.d;
m.f = x.e;
if (g.a != null) {
m.c.a = g.a;
}
c.add(m);
}
}
a.ki = null;
}
b3() {
return 1;
}
a2(a, b) {
let c = this.aa2.i(a, b);
if (c == null) {
return null;
}
return c.y;
}
gw(a, b) {
if (this.aa2 == null) {
return false;
}
return this.aa2.i(a, b) != null;
}
aem(a, b) {
let c = 0;
let d = new HashSet$1(CalloutAnnotationWrapper.$, 0);
for (c = 0; c < a.q.count; c++) {
let e = a.n._inner[c];
if (isNaN_(a.u._inner[c]) || isNaN_(a.v._inner[c])) {
continue;
}
let f = this.aai.ci.item(e);
d.add_1(e);
if (f.h != a.q._inner[c]) {
f.h = a.q._inner[c];
let g = f.u();
}
f.e = a.o._inner[c];
f.m = a.f._inner[c];
f.p = a.p._inner[c];
f.o = f.e >