igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,369 lines • 73.4 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-angular-core";
import { Base, runOn, delegateCombine, String_$type, Array_$type, enumGetBox, EnumUtil, typeCast, fromEnum, delegateRemove, Point_$type, Date_$type, markType, markDep } from "igniteui-angular-core";
import { Series } from "./Series";
import { CalloutPlacementPositionsCollection } from "./CalloutPlacementPositionsCollection";
import { HighlightedValueLabelMode_$type } from "igniteui-angular-core";
import { AutoCalloutVisibilityMode_$type } from "./AutoCalloutVisibilityMode";
import { Brush } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { CalloutCollisionMode_$type } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { BindingFormatter } from "igniteui-angular-core";
import { CalloutLayerFrame } from "./CalloutLayerFrame";
import { Size } from "igniteui-angular-core";
import { HashSet$1 } from "igniteui-angular-core";
import { CalloutAnnotationWrapper } from "./CalloutAnnotationWrapper";
import { List$1 } from "igniteui-angular-core";
import { LinkedList$1 } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { LinkedListNode$1 } from "igniteui-angular-core";
import { LabelCollisionManager } from "igniteui-angular-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { CalloutAnnotation } from "./CalloutAnnotation";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { CalloutLabelUpdatingEventArgs } from "./CalloutLabelUpdatingEventArgs";
import { CalloutSeriesSelectingEventArgs } from "./CalloutSeriesSelectingEventArgs";
import { CalloutStyleUpdatingEventArgs } from "./CalloutStyleUpdatingEventArgs";
import { BrushUtilCore } from "igniteui-angular-core";
import { LabelCollisionInfo } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { CalloutRenderStyleUpdatingEventArgs } from "./CalloutRenderStyleUpdatingEventArgs";
import { IHasCategoryAxis_$type } from "./IHasCategoryAxis";
import { QuadTreeBoundingBox } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { ViewportUtils } from "./ViewportUtils";
import { CalloutContentUpdatingEventArgs } from "./CalloutContentUpdatingEventArgs";
import { CalloutKey } from "./CalloutKey";
import { DataContext } from "igniteui-angular-core";
import { HashPool$2 } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
import { FastItemObjectColumn } from "igniteui-angular-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { TextBlock } from "igniteui-angular-core";
import { Color } from "igniteui-angular-core";
import { Line } from "igniteui-angular-core";
import { CalloutViewHelper } from "./CalloutViewHelper";
import { Rectangle } from "igniteui-angular-core";
import { TranslateTransform } from "igniteui-angular-core";
/**
* @hidden
*/
export let CalloutLayer = /*@__PURE__*/ (() => {
class CalloutLayer extends AnnotationLayer {
constructor() {
super();
this.aav = true;
this.afu = new Size(1, 0, 0);
this.calloutStyleUpdating = null;
this.calloutRenderStyleUpdating = null;
this.aaj = null;
this.aak = null;
this.aal = null;
this.aai = null;
this.aah = null;
this.abh = new HashSet$1(CalloutAnnotationWrapper.$, 0);
this.abk = new List$1(CalloutAnnotationWrapper.$, 0);
this.abl = new List$1(CalloutAnnotationWrapper.$, 0);
this.z8 = null;
this.zw = null;
this.aaf = null;
this.abi = new LinkedList$1(CalloutAnnotationWrapper.$);
this.abf = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
this.aar = null;
this.afs = new Rect(0, 0, 0, 1, 1);
this.aaz = false;
this.ab0 = 0;
this.afr = Rect.empty;
this.aax = false;
this.aay = false;
this.calloutContentUpdating = null;
this.calloutLabelUpdating = null;
this.calloutSeriesSelecting = null;
this.abj = new List$1(SeriesPointOfInterest.$, 0);
this.aa1 = false;
this.aa2 = false;
this.abn = 0;
this.aa0 = false;
this.zz = null;
this.aaw = true;
this.z0 = 1;
FastItemObjectColumn.m();
this.zw = null;
this.z8 = new CalloutPlacementPositionsCollection();
let a = this.z8;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.adv));
this.xj = true;
let b = new CalloutLayerFrame();
let c = new CalloutLayerFrame();
let d = new CalloutLayerFrame();
let e = this.kc / 1000;
this.xb = b;
this.xa = c;
this.xc = d;
this.ab = CalloutLayer.$;
}
bj() {
return new CalloutLayer();
}
get_eo() {
return true;
}
adv(a, b) {
this.ad4();
}
ad4() {
this.zw = this.zy(this.z9);
this.ad1();
}
adw(a, b) {
this.abl.clear();
this.rq(false);
}
pa(a, b, c, d) {
super.pa(a, b, c, d);
let e = this.abg();
switch (a) {
case 3:
this.aea(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.aae;
this.abl.insert(f, h);
this.aea(f, e);
}
break;
case 0:
this.abl.v(b, c);
break;
case 2:
for (let i = b; i < b + c; i++) {
this.aea(i, e);
}
break;
case 4:
this.abl.clear();
for (let j = 0; j < this.dn.count; j++) {
let k = new CalloutAnnotation();
let l = new CalloutAnnotationWrapper();
l.b = k;
l.b.series = this.aae;
this.abl.add(l);
this.aea(j, e);
}
break;
}
this.rq(true);
}
ge(a) {
return false;
}
afw() {
let a = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.afv.left) || isNaN_(this.afv.top) || isNaN_(this.afv.right) || isNaN_(this.afv.bottom)) {
a = new Thickness(0, DeviceUtils.g(3));
}
else {
a = this.afv;
}
return a;
}
ws() {
let a = 0;
let b = 0;
if (!this.aa3) {
return new Size(1, b, a);
}
if (!this.aav) {
return this.afu;
}
let c = "Ig";
let d = this.afw();
let e = this.z7.cr(c, d);
if (!isNaN_(e.height)) {
a = Math.max(e.height, a);
}
if (!isNaN_(this.abx)) {
a += this.abx;
}
if (!isNaN_(this.abx)) {
b += this.abx;
}
if (!isNaN_(this.abr)) {
a = Math.max(a, this.abr);
}
if (!isNaN_(this.abp)) {
a = Math.min(a, this.abp);
}
if (!isNaN_(this.abs)) {
b = Math.max(b, this.abs);
}
if (!isNaN_(this.abq)) {
b = Math.min(b, this.abq);
}
this.aav = false;
this.afu = new Size(1, b, a);
return this.afu;
}
abg() {
let a = new Dictionary$2(String_$type, Series.$, 0);
if (this.db != null) {
for (let b = 0; b < this.db.series.count; b++) {
let c = this.db.series._inner[b];
if (c.name != null && !a.containsKey(c.name)) {
a.addItem(c.name, c);
}
}
}
return a;
}
aea(a, b) {
if (this.aaq == null || this.aao == null) {
return;
}
let c = a;
if (this.aap != null) {
c = this.aap.item(a);
}
let d = this.aaq.item(a);
let e = this.aao.item(a);
let f = this.abl._inner[a];
if (this.aan != null) {
if (f.b.ab != this.aan.item(a)) {
f.b.key = this.aan.item(a);
}
}
if (this.abf.containsKey(f)) {
f.b = this.abf.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.dn.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.zz != null) {
f.b.text = this.zz.i(h);
}
else {
f.b.text = h != null ? h.toString() : "";
}
}
}
else {
if (this.zz != null) {
f.b.text = this.zz.i(e);
}
else {
f.b.text = e != null ? e.toString() : "";
}
}
if (this.aam != null) {
f.b.content = this.aam.item(a);
}
else {
f.b.content = this.dn.item(a);
}
if (this.calloutSeriesSelecting != null) {
let i = ((() => {
let $ret = new CalloutSeriesSelectingEventArgs();
$ret.c = c;
$ret.d = d;
$ret.item = this.dn.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.aeb(f);
}
aeb(a) {
let b = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.afv.left) || isNaN_(this.afv.top) || isNaN_(this.afv.right) || isNaN_(this.afv.bottom)) {
b = new Thickness(0, DeviceUtils.g(3));
}
else {
b = this.afv;
}
let c = DeviceUtils.g(3);
if (isNaN_(this.abo)) {
c = DeviceUtils.g(3);
}
else {
c = this.abo;
}
let d = this.afl != null && !this.abb ? this.afl : this.z7.cl(a.b.l, a.b.itemColor);
let e = this.afq != null ? this.afq : null;
let f = this.afo != null ? this.afo : this.z7.co();
let g = this.afm != null ? this.afm : this.z7.cm();
let h = this.afp != null && !this.abc ? this.afp : this.z7.cp(a.b.l, a.b.itemColor);
let i = this.afn != null ? this.afn : this.z7.cn(a.b.l, a.b.itemColor);
let j = isNaN_(this.aby) ? 0 : this.aby;
if (e == null && (this.aa9 || this.afo != null || this.afm != null)) {
let k = d;
if (k == null || BrushUtilCore.a(d)) {
k = this.db != null ? this.db.vk : 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.z7.co();
}
if (this.aa7 && 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;
}
kp(a, b) {
let c = this.nc(b);
if (c == CalloutLayer.$$p[31]) {
return this.kq(a, b, this.ada);
}
if (c == CalloutLayer.$$p[42]) {
return this.kq(a, b, this.adq);
}
if (c == CalloutLayer.$$p[43]) {
return this.kq(a, b, this.adt);
}
if (c == CalloutLayer.$$p[28]) {
return this.kq(a, b, this.ac4);
}
if (c == CalloutLayer.$$p[22]) {
return this.kq(a, b, this.acw);
}
return super.kp(a, b);
}
mc(a) {
let b = this.nc(a);
if (b == CalloutLayer.$$p[31]) {
return this.ada;
}
if (b == CalloutLayer.$$p[42]) {
return this.adq;
}
if (b == CalloutLayer.$$p[43]) {
return this.adt;
}
if (b == CalloutLayer.$$p[28]) {
return this.ac4;
}
if (b == CalloutLayer.$$p[22]) {
return this.acw;
}
return super.mc(a);
}
get aao() {
return this.aaj;
}
set aao(a) {
if (this.aaj != a) {
let b = this.aaj;
this.aaj = a;
this.raisePropertyChanged("LabelColumn", b, this.aaj);
}
}
get aap() {
return this.aak;
}
set aap(a) {
if (this.aak != a) {
let b = this.aak;
this.aak = a;
this.raisePropertyChanged("XColumn", b, this.aak);
}
}
get aaq() {
return this.aal;
}
set aaq(a) {
if (this.aal != a) {
let b = this.aal;
this.aal = a;
this.raisePropertyChanged("YColumn", b, this.aal);
}
}
get aan() {
return this.aai;
}
set aan(a) {
if (this.aai != a) {
let b = this.aai;
this.aai = a;
this.raisePropertyChanged("KeyColumn", b, this.aai);
}
}
get aam() {
return this.aah;
}
set aam(a) {
if (this.aah != a) {
let b = this.aah;
this.aah = a;
this.raisePropertyChanged("ContentColumn", b, this.aah);
}
}
ady(a, b) {
if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
let c = a.k;
if (!this.abh.contains(c)) {
this.abh.add_1(c);
this.abk.add(c);
this.rq(false);
}
}
}
cs() {
return new CalloutLayerView(this);
}
q0(a) {
super.q0(a);
this.z7 = a;
}
get z9() {
return this.z8;
}
set z9(a) {
let b = this.z9;
if (a != b) {
this.z8 = a;
this.raisePropertyChanged("AllowedPositions", b, this.z9);
}
}
gt(a) {
if (this.aae == null) {
return true;
}
if (this.aae == a) {
return true;
}
return false;
}
get z2() {
return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.aex));
}
set z2(a) {
this.h(CalloutLayer.aex, enumGetBox(AutoCalloutVisibilityMode_$type, a));
}
get z1() {
return this.z0;
}
set z1(a) {
this.z0 = a;
}
get afv() {
return new Thickness(1, this.abu, this.abw, this.abv, this.abt);
}
get aag() {
if (this.aaf == null) {
this.aaf = FontUtil.toFontInfo(this.jy, this.adg);
}
return this.aaf;
}
yo(a, b) {
if (this.aae == null || this.aae == a) {
if (!this.a1.c) {
this.rq(b);
}
}
}
yq(a, b) {
super.yq(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.abm();
let e = new List$1(CalloutAnnotationWrapper.$, 0);
let f = Number.POSITIVE_INFINITY;
let g = true;
if (this.aa4) {
if (this.xh(this.aae)) {
if (typeCast(IHasCategoryAxis_$type, this.aae) !== null) {
let h = this.aae.getCategoryWidth();
if (!isNaN_(h) && !isInfinity(h) && h > 0) {
f = Math.min(f, h);
}
}
this.ad6(this.aae, c, e);
}
else {
for (let i of fromEnum(this.db.series)) {
if (this.xh(i)) {
if (typeCast(IHasCategoryAxis_$type, i) !== null) {
let j = i.getCategoryWidth();
if (!isNaN_(j) && !isInfinity(j) && j > 0) {
f = Math.min(f, j);
}
}
if (!i.es) {
if (!i.isVertical) {
g = false;
}
}
let k = false;
if (i.eg && this.aad == 0 || this.aad == 3 || this.aad == 2) {
if (this.aad == 0 || this.aad == 2) {
k = true;
}
i.p0((l) => {
this.ad6(l, c, e);
return true;
});
}
if (!k) {
this.ad6(i, c, e);
}
}
}
}
}
if (this.aa4 && this.z1 == 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.ad5(c, d, e);
}
sq(a, b) {
super.sq(a, b);
let c = b.width - this.afs.width;
let d = b.height - this.afs.height;
let e = 0;
if (Math.abs(c) > Math.abs(d)) {
e = c;
this.abn = c * this.wr.width;
}
else {
e = d;
this.abn = d * this.wr.height;
}
if (e > 0 && this.abn > 5) {
this.aa2 = true;
}
if (e < 0 && this.abn > 5) {
this.aa1 = true;
}
}
sp(a, b) {
super.sp(a, b);
if (!a.equals1(b)) {
this.aa0 = true;
}
}
get aft() {
return this.afr;
}
set aft(a) {
this.afr = a;
}
ad5(a, b, c) {
if (this.db != null) {
this.afs = this.db.v4;
}
if (this.wr.isEmpty) {
return;
}
this.aft = new Rect(0, this.wr.left, this.wr.top, this.wr.width, this.wr.height);
if (this.aar != null && this.act != null && this.act != this.aar.bd) {
this.ad0();
}
if (this.aar != null && this.aar.j != this.aat()) {
this.ad0();
}
if (this.aar == null) {
let d = this.aas();
if (d != null) {
this.aar = d;
let e = this.aar;
e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.adx));
}
else {
let f = this.wi(this.cv);
let g = new Array(2);
g[0] = 0;
g[1] = 3;
if (this.aae != null) {
if (this.aae.isVertical) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
else {
let h = false;
if (this.db != null && this.db.series.count > 0) {
h = true;
for (let i of fromEnum(this.db.series)) {
if (!i.es) {
if (!i.isVertical) {
h = false;
}
}
}
}
if (h) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
if (this.z4 == 4 || this.z4 == 6) {
g = new Array(4);
g[0] = 10;
g[1] = 11;
g[2] = 8;
g[3] = 9;
}
if (this.z4 == 5) {
g = new Array(4);
g[0] = 9;
g[1] = 10;
g[2] = 11;
g[3] = 8;
}
if (this.z4 == 7) {
g = new Array(4);
g = new Array(4);
g[0] = 8;
g[1] = 10;
g[2] = 11;
g[3] = 9;
}
this.aar = new LabelCollisionManager(this.wr.right, this.wr.bottom, this.wr, this.z7.j(), this.abx, this.aat(), g, this.ab4(), this.ab3(), this.aa5, this.zw);
this.aar.v = this.aa8;
if (this.act != null) {
this.aar.bd = this.act;
this.aar.bb = this;
}
let j = this.aar;
j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.adx));
}
}
if (this.aa1) {
this.aa1 = false;
if (this.aar.a9 > 2) {
this.aaz = true;
}
}
if (this.aa2) {
this.aa2 = false;
if (this.abn > 5) {
this.aaz = true;
}
}
if (this.aa0) {
this.aa0 = false;
this.aar.bs(this.wr.right, this.wr.bottom, this.wr);
this.aaz = 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.abi.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.ady));
this.abi.h(r);
this.abf.removeItem(r.c);
this.aar.br(r.c.c);
}
r = s;
}
for (let u = 0; u < b.count; u++) {
if (!this.abf.containsKey(b._inner[u])) {
this.abi.f(b._inner[u]);
let v = b._inner[u].b;
v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.ady));
this.abf.addItem(b._inner[u], this.abi.d);
m.add(b._inner[u]);
k.add_1(b._inner[u]);
this.aaz = true;
}
}
for (let w = 0; w < c.count; w++) {
if (!this.abf.containsKey(c._inner[w])) {
this.abi.f(c._inner[w]);
this.abf.addItem(c._inner[w], this.abi.d);
let x = c._inner[w].b;
x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.ady));
m.add(c._inner[w]);
k.add_1(c._inner[w]);
this.aaz = true;
}
}
if (this.aax == true) {
this.aax = false;
this.aaz = true;
}
let y = false;
if (this.abk.count > 0) {
y = true;
this.abk.clear();
this.abh.clear();
}
r = this.abi.c;
while (r != null) {
let z = this.aau(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.aar.ad(ab, false);
}
if (aa) {
this.aar.be(ab);
}
else {
this.aar.bo(ab);
}
}
}
r = r.a;
}
let ac = this.aar.ba();
let ad = this.aar.af();
if (!this.aaz && y && (ac != 0 || ad)) {
{
this.aaz = true;
}
}
if (ad) {
if (this.aar.x()) {
this.aaz = true;
}
}
if (this.aaz && (ac != 0 || ad)) {
this.aaz = false;
this.ab0 = 0x7FFFFFFF;
if (this.act != null) {
let ae = true;
for (let af = 0; af < this.db.series.count; af++) {
let ag = this.db.series._inner[af];
if (ag.es && typeCast(CalloutLayer.$, ag) !== null) {
let ah = ag;
if (ah.act == this.act) {
if (!ah.aft.equals1(this.aar.b0)) {
ae = false;
break;
}
}
}
}
if (ae) {
this.aar.bv();
}
else {
this.aar.bf();
this.aar.bg();
}
}
else {
this.aar.bv();
}
}
else {
this.aar.bg();
}
let ai = this.abi.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.aa6;
let a0 = this.aa8;
let a1 = this.cv.bt();
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.aar.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.adi(a2, at);
let a6 = this.aar.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;
}
}
adi(a, b) {
let c = Math.max(this.aar.as(a.c.c), this.aar.at(a.c.c));
if (c <= 0) {
return b;
}
let d = b.length;
let e = this.z7.cr(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.z7.cr(b, a.b.backgroundPadding);
f = e.width;
}
return b;
}
ad0() {
if (this.aar != null) {
let a = this.abi.c;
while (a != null) {
let b = a.c.c;
if (b != null) {
this.aar.br(b);
}
a = a.a;
}
let c = this.aar;
c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.adx));
this.aar = null;
}
this.adz();
}
aas() {
if (this.db == null) {
return null;
}
for (let a = 0; a < this.db.series.count; a++) {
let b = this.db.series._inner[a];
if (b.es && typeCast(CalloutLayer.$, b) !== null) {
let c = b;
if (c != this) {
if (c.act != null && c.act == this.act) {
if (c.aar != null) {
return c.aar;
}
}
}
}
}
return null;
}
ab3() {
return 20000;
}
ab4() {
return 300;
}
aat() {
switch (this.z4) {
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;
}
adx(a) {
let b = this.aar.ba();
let c = this.ab0;
if (b < this.ab0) {
this.ab0 = b;
if (c != 0x7FFFFFFF) {
this.rq(false);
}
}
}
aau(a) {
let b = this.aae;
if (a.b.l != null) {
b = a.b.l;
}
if (b == null) {
for (let c = 0; c < this.db.series.count; c++) {
let d = this.db.series._inner[c];
if (!d.es) {
b = d;
break;
}
}
}
if (b == null) {
return null;
}
let e = b.ai();
let f = b.ix();
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.e6) {
k = b.getOffsetValue();
}
else if (b.ey) {
k = b.getOffsetValue();
}
}
if (h.cb && h.categoryMode != 0) {
if (b.ey) {
l = b.getOffsetValue();
}
}
let m = new ScalerParams(0, this.db.v4, g.kh, g.ch, g.kc());
m.b = f;
let n = new ScalerParams(0, this.db.v4, h.kh, h.ch, h.kc());
n.b = f;
let o = 0;
let p = 0;
if (i) {
o = g.el(this.abz(a.b.ac), m) + k;
p = h.el(this.abz(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.abz(a.b.ac), m) + k;
p = h.el(this.abz(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;
}
abz(a) {
if (typeCast(Date_$type, a) !== null) {
return a.getTime();
}
if (a == null) {
return 0;
}
return a;
}
abm() {
let a = new List$1(CalloutAnnotationWrapper.$, 0);
for (let b = 0; b < this.abl.count; b++) {
if (stringIsNullOrEmpty(this.abl._inner[b].b.ao)) {
continue;
}
if (this.abl._inner[b].c == null) {
let c = new LabelCollisionInfo();
this.abl._inner[b].c = c;
let d = this.z7.cr(this.ab5(this.abl._inner[b]), this.abl._inner[b].b.backgroundPadding);
c.o = d.height / 2;
c.p = d.width / 2;
}
let e = this.aau(this.abl._inner[b]);
if (e == null || e.d < this.wr.left || e.d > this.wr.right || e.e < this.wr.top || e.e > this.wr.bottom) {
continue;
}
a.add(this.abl._inner[b]);
}
return a;
}
ab5(a) {
return a.b.ao;
}
xh(a) {
if (!super.xh(a)) {
return false;
}
if (this.add != null) {
if (a.isFragment) {
let b = a.nb();
if (!Base.equalsStatic(this.add, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.add, a.name)) {
return false;
}
}
}
return true;
}
qo() {
super.qo();
if (!this.a1.c && !this.d3()) {
return;
}
if (this.aaw) {
this.aaw = false;
this.ad7();
this.ad2();
}
if (this.d3()) {
this.ad9(this.xc, false);
}
else {
this.ad9(this.xa, false);
}
}
ad3() {
if (!this.aay) {
this.aay = true;
this.rq(true);
}
}
ad6(a, b, c) {
let d = false;
if (this.aay) {
this.aay = false;
d = true;
}
a.kh = this.zz;
if (!a.gh && a.eb(this.abj, this.abe, this.aba, this.ab1, false)) {
let e = this.abj;
for (let f = 0; f < this.abj.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.abf.containsKey(m)) {
m = this.abf.item(m).c;
n = m.b;
o = d;
}
else {
o = true;
}
let p = n.ac;
let q = n.ad;
if (this.abz(p) != this.abz(g.d) && (!isNaN_(this.abz(p)) || !isNaN_(this.abz(g.d)))) {
n.xValue = g.d;
}
if (this.abz(q) != this.abz(g.e) && (!isNaN_(this.abz(q)) || !isNaN_(this.abz(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.zz != null) {
m.b.text = this.zz.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.aeb(m);
}
if (m.c == null) {
let v = new LabelCollisionInfo();
m.c = v;
let w = this.z7.cr(this.ab5(m), m.b.backgroundPadding);
v.o = w.height / 2;
v.p = w.width / 2;
}
let x = this.aau(m);
if (x == null || x.d < this.wr.left || x.d > this.wr.right || x.e < this.wr.top || x.e > this.wr.bottom) {
continue;
}
m.e =