igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,452 lines (1,451 loc) • 75.3 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 { __extends, __values } from "tslib";
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
*/
var CalloutLayer = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CalloutLayer, _super);
function CalloutLayer() {
var _this = _super.call(this) || this;
_this.aaw = true;
_this.afv = new Size(1, 0, 0);
_this.calloutStyleUpdating = null;
_this.calloutRenderStyleUpdating = null;
_this.aak = null;
_this.aal = null;
_this.aam = null;
_this.aaj = null;
_this.aai = null;
_this.abi = new HashSet$1(CalloutAnnotationWrapper.$, 0);
_this.abl = new List$1(CalloutAnnotationWrapper.$, 0);
_this.abm = new List$1(CalloutAnnotationWrapper.$, 0);
_this.z9 = null;
_this.zx = null;
_this.aag = null;
_this.abj = new LinkedList$1(CalloutAnnotationWrapper.$);
_this.abg = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
_this.aas = null;
_this.aft = new Rect(0, 0, 0, 1, 1);
_this.aa0 = false;
_this.ab1 = 0;
_this.afs = Rect.empty;
_this.aay = false;
_this.aaz = false;
_this.calloutContentUpdating = null;
_this.calloutLabelUpdating = null;
_this.calloutSeriesSelecting = null;
_this.abk = new List$1(SeriesPointOfInterest.$, 0);
_this.aa2 = false;
_this.aa3 = false;
_this.abo = 0;
_this.aa1 = false;
_this.z0 = null;
_this.aax = true;
_this.z1 = 1;
FastItemObjectColumn.m();
_this.zx = null;
_this.z9 = new CalloutPlacementPositionsCollection();
var a = _this.z9;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.adw));
_this.xk = true;
var b = new CalloutLayerFrame();
var c = new CalloutLayerFrame();
var d = new CalloutLayerFrame();
var e = _this.kd / 1000;
_this.xc = b;
_this.xb = c;
_this.xd = d;
_this.ab = CalloutLayer.$;
return _this;
}
CalloutLayer.prototype.bj = function () {
return new CalloutLayer();
};
CalloutLayer.prototype.get_eo = function () {
return true;
};
CalloutLayer.prototype.adw = function (a, b) {
this.ad5();
};
CalloutLayer.prototype.ad5 = function () {
this.zx = this.zz(this.aaa);
this.ad2();
};
CalloutLayer.prototype.adx = function (a, b) {
this.abm.clear();
this.rr(false);
};
CalloutLayer.prototype.pb = function (a, b, c, d) {
_super.prototype.pb.call(this, a, b, c, d);
var e = this.abh();
switch (a) {
case 3:
this.aeb(b, e);
break;
case 1:
for (var f = b; f < b + c; f++) {
var g = new CalloutAnnotation();
var h = new CalloutAnnotationWrapper();
h.b = g;
h.b.series = this.aaf;
this.abm.insert(f, h);
this.aeb(f, e);
}
break;
case 0:
this.abm.v(b, c);
break;
case 2:
for (var i = b; i < b + c; i++) {
this.aeb(i, e);
}
break;
case 4:
this.abm.clear();
for (var j = 0; j < this.dn.count; j++) {
var k = new CalloutAnnotation();
var l = new CalloutAnnotationWrapper();
l.b = k;
l.b.series = this.aaf;
this.abm.add(l);
this.aeb(j, e);
}
break;
}
this.rr(true);
};
CalloutLayer.prototype.gf = function (a) {
return false;
};
CalloutLayer.prototype.afx = function () {
var a = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.afw.left) || isNaN_(this.afw.top) || isNaN_(this.afw.right) || isNaN_(this.afw.bottom)) {
a = new Thickness(0, DeviceUtils.g(3));
}
else {
a = this.afw;
}
return a;
};
CalloutLayer.prototype.wt = function () {
var a = 0;
var b = 0;
if (!this.aa4) {
return new Size(1, b, a);
}
if (!this.aaw) {
return this.afv;
}
var c = "Ig";
var d = this.afx();
var e = this.z8.cr(c, d);
if (!isNaN_(e.height)) {
a = Math.max(e.height, a);
}
if (!isNaN_(this.aby)) {
a += this.aby;
}
if (!isNaN_(this.aby)) {
b += this.aby;
}
if (!isNaN_(this.abs)) {
a = Math.max(a, this.abs);
}
if (!isNaN_(this.abq)) {
a = Math.min(a, this.abq);
}
if (!isNaN_(this.abt)) {
b = Math.max(b, this.abt);
}
if (!isNaN_(this.abr)) {
b = Math.min(b, this.abr);
}
this.aaw = false;
this.afv = new Size(1, b, a);
return this.afv;
};
CalloutLayer.prototype.abh = function () {
var a = new Dictionary$2(String_$type, Series.$, 0);
if (this.db != null) {
for (var b = 0; b < this.db.series.count; b++) {
var c = this.db.series._inner[b];
if (c.name != null && !a.containsKey(c.name)) {
a.addItem(c.name, c);
}
}
}
return a;
};
CalloutLayer.prototype.aeb = function (a, b) {
var _this = this;
if (this.aar == null || this.aap == null) {
return;
}
var c = a;
if (this.aaq != null) {
c = this.aaq.item(a);
}
var d = this.aar.item(a);
var e = this.aap.item(a);
var f = this.abm._inner[a];
if (this.aao != null) {
if (f.b.ab != this.aao.item(a)) {
f.b.key = this.aao.item(a);
}
}
if (this.abg.containsKey(f)) {
f.b = this.abg.item(f).c.b;
}
f.b.xValue = c;
f.b.yValue = d;
if (this.calloutLabelUpdating != null) {
var g = ((function () {
var $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)) {
var h = g.c;
if (this.z0 != null) {
f.b.text = this.z0.i(h);
}
else {
f.b.text = h != null ? h.toString() : "";
}
}
}
else {
if (this.z0 != null) {
f.b.text = this.z0.i(e);
}
else {
f.b.text = e != null ? e.toString() : "";
}
}
if (this.aan != null) {
f.b.content = this.aan.item(a);
}
else {
f.b.content = this.dn.item(a);
}
if (this.calloutSeriesSelecting != null) {
var i = ((function () {
var $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.aec(f);
};
CalloutLayer.prototype.aec = function (a) {
var b = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.afw.left) || isNaN_(this.afw.top) || isNaN_(this.afw.right) || isNaN_(this.afw.bottom)) {
b = new Thickness(0, DeviceUtils.g(3));
}
else {
b = this.afw;
}
var c = DeviceUtils.g(3);
if (isNaN_(this.abp)) {
c = DeviceUtils.g(3);
}
else {
c = this.abp;
}
var d = this.afm != null && !this.abc ? this.afm : this.z8.cl(a.b.l, a.b.itemColor);
var e = this.afr != null ? this.afr : null;
var f = this.afp != null ? this.afp : this.z8.co();
var g = this.afn != null ? this.afn : this.z8.cm();
var h = this.afq != null && !this.abd ? this.afq : this.z8.cp(a.b.l, a.b.itemColor);
var i = this.afo != null ? this.afo : this.z8.cn(a.b.l, a.b.itemColor);
var j = isNaN_(this.abz) ? 0 : this.abz;
if (e == null && (this.aba || this.afp != null || this.afn != null)) {
var 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.z8.co();
}
if (this.aa8 && this.calloutStyleUpdating != null) {
var 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;
};
CalloutLayer.prototype.kq = function (a, b) {
var c = this.nd(b);
if (c == CalloutLayer.$$p[31]) {
return this.kr(a, b, this.adb);
}
if (c == CalloutLayer.$$p[42]) {
return this.kr(a, b, this.adr);
}
if (c == CalloutLayer.$$p[43]) {
return this.kr(a, b, this.adu);
}
if (c == CalloutLayer.$$p[28]) {
return this.kr(a, b, this.ac5);
}
if (c == CalloutLayer.$$p[22]) {
return this.kr(a, b, this.acx);
}
return _super.prototype.kq.call(this, a, b);
};
CalloutLayer.prototype.md = function (a) {
var b = this.nd(a);
if (b == CalloutLayer.$$p[31]) {
return this.adb;
}
if (b == CalloutLayer.$$p[42]) {
return this.adr;
}
if (b == CalloutLayer.$$p[43]) {
return this.adu;
}
if (b == CalloutLayer.$$p[28]) {
return this.ac5;
}
if (b == CalloutLayer.$$p[22]) {
return this.acx;
}
return _super.prototype.md.call(this, a);
};
Object.defineProperty(CalloutLayer.prototype, "aap", {
get: function () {
return this.aak;
},
set: function (a) {
if (this.aak != a) {
var b = this.aak;
this.aak = a;
this.raisePropertyChanged("LabelColumn", b, this.aak);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aaq", {
get: function () {
return this.aal;
},
set: function (a) {
if (this.aal != a) {
var b = this.aal;
this.aal = a;
this.raisePropertyChanged("XColumn", b, this.aal);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aar", {
get: function () {
return this.aam;
},
set: function (a) {
if (this.aam != a) {
var b = this.aam;
this.aam = a;
this.raisePropertyChanged("YColumn", b, this.aam);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aao", {
get: function () {
return this.aaj;
},
set: function (a) {
if (this.aaj != a) {
var b = this.aaj;
this.aaj = a;
this.raisePropertyChanged("KeyColumn", b, this.aaj);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aan", {
get: function () {
return this.aai;
},
set: function (a) {
if (this.aai != a) {
var b = this.aai;
this.aai = a;
this.raisePropertyChanged("ContentColumn", b, this.aai);
}
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.adz = function (a, b) {
if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
var c = a.k;
if (!this.abi.contains(c)) {
this.abi.add_1(c);
this.abl.add(c);
this.rr(false);
}
}
};
CalloutLayer.prototype.cs = function () {
return new CalloutLayerView(this);
};
CalloutLayer.prototype.q1 = function (a) {
_super.prototype.q1.call(this, a);
this.z8 = a;
};
Object.defineProperty(CalloutLayer.prototype, "aaa", {
get: function () {
return this.z9;
},
set: function (a) {
var b = this.aaa;
if (a != b) {
this.z9 = a;
this.raisePropertyChanged("AllowedPositions", b, this.aaa);
}
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.gu = function (a) {
if (this.aaf == null) {
return true;
}
if (this.aaf == a) {
return true;
}
return false;
};
Object.defineProperty(CalloutLayer.prototype, "z3", {
get: function () {
return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.aey));
},
set: function (a) {
this.h(CalloutLayer.aey, enumGetBox(AutoCalloutVisibilityMode_$type, a));
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "z2", {
get: function () {
return this.z1;
},
set: function (a) {
this.z1 = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "afw", {
get: function () {
return new Thickness(1, this.abv, this.abx, this.abw, this.abu);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aah", {
get: function () {
if (this.aag == null) {
this.aag = FontUtil.toFontInfo(this.jz, this.adh);
}
return this.aag;
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.yp = function (a, b) {
if (this.aaf == null || this.aaf == a) {
if (!this.a1.c) {
this.rr(b);
}
}
};
CalloutLayer.prototype.yr = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.yr.call(this, a, b);
var 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();
var d = this.abn();
var e = new List$1(CalloutAnnotationWrapper.$, 0);
var f = Number.POSITIVE_INFINITY;
var g = true;
if (this.aa5) {
if (this.xi(this.aaf)) {
if (typeCast(IHasCategoryAxis_$type, this.aaf) !== null) {
var h = this.aaf.getCategoryWidth();
if (!isNaN_(h) && !isInfinity(h) && h > 0) {
f = Math.min(f, h);
}
}
this.ad7(this.aaf, c, e);
}
else {
try {
for (var _b = __values(fromEnum(this.db.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var i = _c.value;
if (this.xi(i)) {
if (typeCast(IHasCategoryAxis_$type, i) !== null) {
var j = i.getCategoryWidth();
if (!isNaN_(j) && !isInfinity(j) && j > 0) {
f = Math.min(f, j);
}
}
if (!i.es) {
if (!i.isVertical) {
g = false;
}
}
var k = false;
if (i.eg && this.aae == 0 || this.aae == 3 || this.aae == 2) {
if (this.aae == 0 || this.aae == 2) {
k = true;
}
i.p1(function (l) {
_this.ad7(l, c, e);
return true;
});
}
if (!k) {
this.ad7(i, c, e);
}
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
}
}
if (this.aa5 && this.z2 == 2) {
var l = 0;
var m = 0;
var n = 1.7976931348623157E+308;
var o = 1.7976931348623157E+308;
var p = -1.7976931348623157E+308;
var 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 (var r = 0; r < e.count; r++) {
var s = e._inner[r];
if (s.c != null) {
var t = s.e;
var 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.ad6(c, d, e);
};
CalloutLayer.prototype.sr = function (a, b) {
_super.prototype.sr.call(this, a, b);
var c = b.width - this.aft.width;
var d = b.height - this.aft.height;
var e = 0;
if (Math.abs(c) > Math.abs(d)) {
e = c;
this.abo = c * this.ws.width;
}
else {
e = d;
this.abo = d * this.ws.height;
}
if (e > 0 && this.abo > 5) {
this.aa3 = true;
}
if (e < 0 && this.abo > 5) {
this.aa2 = true;
}
};
CalloutLayer.prototype.sq = function (a, b) {
_super.prototype.sq.call(this, a, b);
if (!a.equals1(b)) {
this.aa1 = true;
}
};
Object.defineProperty(CalloutLayer.prototype, "afu", {
get: function () {
return this.afs;
},
set: function (a) {
this.afs = a;
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.ad6 = function (a, b, c) {
var e_2, _a;
if (this.db != null) {
this.aft = this.db.v4;
}
if (this.ws.isEmpty) {
return;
}
this.afu = new Rect(0, this.ws.left, this.ws.top, this.ws.width, this.ws.height);
if (this.aas != null && this.acu != null && this.acu != this.aas.bd) {
this.ad1();
}
if (this.aas != null && this.aas.j != this.aau()) {
this.ad1();
}
if (this.aas == null) {
var d = this.aat();
if (d != null) {
this.aas = d;
var e = this.aas;
e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.ady));
}
else {
var f = this.wj(this.cv);
var g = new Array(2);
g[0] = 0;
g[1] = 3;
if (this.aaf != null) {
if (this.aaf.isVertical) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
else {
var h = false;
if (this.db != null && this.db.series.count > 0) {
h = true;
try {
for (var _b = __values(fromEnum(this.db.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var i = _c.value;
if (!i.es) {
if (!i.isVertical) {
h = false;
}
}
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
}
if (h) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
if (this.z5 == 4 || this.z5 == 6) {
g = new Array(4);
g[0] = 10;
g[1] = 11;
g[2] = 8;
g[3] = 9;
}
if (this.z5 == 5) {
g = new Array(4);
g[0] = 9;
g[1] = 10;
g[2] = 11;
g[3] = 8;
}
if (this.z5 == 7) {
g = new Array(4);
g = new Array(4);
g[0] = 8;
g[1] = 10;
g[2] = 11;
g[3] = 9;
}
this.aas = new LabelCollisionManager(this.ws.right, this.ws.bottom, this.ws, this.z8.j(), this.aby, this.aau(), g, this.ab5(), this.ab4(), this.aa6, this.zx);
this.aas.v = this.aa9;
if (this.acu != null) {
this.aas.bd = this.acu;
this.aas.bb = this;
}
var j = this.aas;
j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.ady));
}
}
if (this.aa2) {
this.aa2 = false;
if (this.aas.a9 > 2) {
this.aa0 = true;
}
}
if (this.aa3) {
this.aa3 = false;
if (this.abo > 5) {
this.aa0 = true;
}
}
if (this.aa1) {
this.aa1 = false;
this.aas.bs(this.ws.right, this.ws.bottom, this.ws);
this.aa0 = true;
}
var k = new HashSet$1(CalloutAnnotationWrapper.$, 0);
var l = new HashSet$1(CalloutAnnotationWrapper.$, 0);
var m = new List$1(CalloutAnnotationWrapper.$, 0);
var n = new List$1(CalloutAnnotationWrapper.$, 0);
var o = new HashSet$1(CalloutAnnotationWrapper.$, 0);
for (var p = 0; p < b.count; p++) {
o.add_1(b._inner[p]);
}
for (var q = 0; q < c.count; q++) {
o.add_1(c._inner[q]);
}
var r = this.abj.c;
while (r != null) {
var s = r.a;
if (!o.contains(r.c)) {
n.add(r.c);
l.add_1(r.c);
var t = r.c.b;
t.propertyChanged = delegateRemove(t.propertyChanged, runOn(this, this.adz));
this.abj.h(r);
this.abg.removeItem(r.c);
this.aas.br(r.c.c);
}
r = s;
}
for (var u = 0; u < b.count; u++) {
if (!this.abg.containsKey(b._inner[u])) {
this.abj.f(b._inner[u]);
var v = b._inner[u].b;
v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.adz));
this.abg.addItem(b._inner[u], this.abj.d);
m.add(b._inner[u]);
k.add_1(b._inner[u]);
this.aa0 = true;
}
}
for (var w = 0; w < c.count; w++) {
if (!this.abg.containsKey(c._inner[w])) {
this.abj.f(c._inner[w]);
this.abg.addItem(c._inner[w], this.abj.d);
var x = c._inner[w].b;
x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.adz));
m.add(c._inner[w]);
k.add_1(c._inner[w]);
this.aa0 = true;
}
}
if (this.aay == true) {
this.aay = false;
this.aa0 = true;
}
var y = false;
if (this.abl.count > 0) {
y = true;
this.abl.clear();
this.abi.clear();
}
r = this.abj.c;
while (r != null) {
var z = this.aav(r.c);
if (z == null) {
return;
}
if (!Base.equalsStatic(z, r.c.c.e)) {
var aa = false;
if (r.c.c.e == null) {
aa = true;
}
var 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.aas.ad(ab, false);
}
if (aa) {
this.aas.be(ab);
}
else {
this.aas.bo(ab);
}
}
}
r = r.a;
}
var ac = this.aas.ba();
var ad = this.aas.af();
if (!this.aa0 && y && (ac != 0 || ad)) {
{
this.aa0 = true;
}
}
if (ad) {
if (this.aas.x()) {
this.aa0 = true;
}
}
if (this.aa0 && (ac != 0 || ad)) {
this.aa0 = false;
this.ab1 = 0x7FFFFFFF;
if (this.acu != null) {
var ae = true;
for (var af = 0; af < this.db.series.count; af++) {
var ag = this.db.series._inner[af];
if (ag.es && typeCast(CalloutLayer.$, ag) !== null) {
var ah = ag;
if (ah.acu == this.acu) {
if (!ah.afu.equals1(this.aas.b0)) {
ae = false;
break;
}
}
}
}
if (ae) {
this.aas.bv();
}
else {
this.aas.bf();
this.aas.bg();
}
}
else {
this.aas.bv();
}
}
else {
this.aas.bg();
}
var ai = this.abj.c;
var aj;
var ak;
var al;
var am;
var an;
var ao;
var ap;
var aq;
var ar;
var as;
var at;
var au;
var av;
var aw;
var ax;
var ay;
var az = this.aa7;
var a0 = this.aa9;
var a1 = this.cv.bt();
while (ai != null) {
var a2 = ai.c;
var 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;
var 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;
var a5 = false;
if (a0) {
if (a4.c != null && this.aas.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.adj(a2, at);
var a6 = this.aas.as(a2.c.c);
if (a6 > 0) {
ax += a6;
av -= a6;
}
}
if (az) {
var 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;
}
};
CalloutLayer.prototype.adj = function (a, b) {
var c = Math.max(this.aas.as(a.c.c), this.aas.at(a.c.c));
if (c <= 0) {
return b;
}
var d = b.length;
var e = this.z8.cr(b, a.b.backgroundPadding);
var f = e.width;
var g = f - c;
while (f - g > 0.0001 && d > 0) {
d--;
b = b.substr(0, d) + "…";
e = this.z8.cr(b, a.b.backgroundPadding);
f = e.width;
}
return b;
};
CalloutLayer.prototype.ad1 = function () {
if (this.aas != null) {
var a = this.abj.c;
while (a != null) {
var b = a.c.c;
if (b != null) {
this.aas.br(b);
}
a = a.a;
}
var c = this.aas;
c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.ady));
this.aas = null;
}
this.ad0();
};
CalloutLayer.prototype.aat = function () {
if (this.db == null) {
return null;
}
for (var a = 0; a < this.db.series.count; a++) {
var b = this.db.series._inner[a];
if (b.es && typeCast(CalloutLayer.$, b) !== null) {
var c = b;
if (c != this) {
if (c.acu != null && c.acu == this.acu) {
if (c.aas != null) {
return c.aas;
}
}
}
}
}
return null;
};
CalloutLayer.prototype.ab4 = function () {
return 20000;
};
CalloutLayer.prototype.ab5 = function () {
return 300;
};
CalloutLayer.prototype.aau = function () {
switch (this.z5) {
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;
};
CalloutLayer.prototype.ady = function (a) {
var b = this.aas.ba();
var c = this.ab1;
if (b < this.ab1) {
this.ab1 = b;
if (c != 0x7FFFFFFF) {
this.rr(false);
}
}
};
CalloutLayer.prototype.aav = function (a) {
var b = this.aaf;
if (a.b.l != null) {
b = a.b.l;
}
if (b == null) {
for (var c = 0; c < this.db.series.count; c++) {
var d = this.db.series._inner[c];
if (!d.es) {
b = d;
break;
}
}
}
if (b == null) {
return null;
}
var e = b.ai();
var f = b.iy();
var g = null;
var h = null;
var i = false;
for (var 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;
}
var k = 0;
var 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();
}
}
var m = new ScalerParams(0, this.db.v4, g.kh, g.ch, g.kc());
m.b = f;
var n = new ScalerParams(0, this.db.v4, h.kh, h.ch, h.kc());
n.b = f;
var o = 0;
var p = 0;
if (i) {
o = g.el(this.ab0(a.b.ac), m) + k;
p = h.el(this.ab0(a.b.ad), n) + l;
var q = o;
var r = p;
var s = { $type: Point_$type, x: 0.5, y: 0.5 };
var t = s.x + (r * Math.cos(q));
o = ViewportUtils.e(t, m.e, m.d, m.c);
var u = s.y + (r * Math.sin(q));
p = ViewportUtils.i(u, n.e, n.d, n.c);
}
else {
o = g.el(this.ab0(a.b.ac), m) + k;
p = h.el(this.ab0(a.b.ad), n) + l;
}
var v = new QuadTreeBoundingBox();
v.d = o;
v.e = p;
v.g = 3;
v.f = 3;
v.i = a.b;
return v;
};
CalloutLayer.prototype.ab0 = function (a) {
if (typeCast(Date_$type, a) !== null) {
return a.getTime();
}
if (a == null) {
return 0;
}
return a;
};
CalloutLayer.prototype.abn = function () {
var a = new List$1(CalloutAnnotationWrapper.$, 0);
for (var b = 0; b < this.abm.count; b++) {
if (stringIsNullOrEmpty(this.abm._inner[b].b.ao)) {
continue;
}
if (this.abm._inner[b].c == null) {
var c = new LabelCollisionInfo();
this.abm._inner[b].c = c;
var d = this.z8.cr(this.ab6(this.abm._inner[b]), this.abm._inner[b].b.backgroundPadding);
c.o = d.height / 2;
c.p = d.width / 2;
}
var e = this.aav(this.abm._inner[b]);
if (e == null || e.d < this.ws.left || e.d > this.ws.right || e.e < this.ws.top || e.e > this.ws.bottom) {
continue;
}
a.add(this.abm._inner[b]);
}
return a;
};
CalloutLayer.prototype.ab6 = function (a) {
return a.b.ao;
};
CalloutLayer.prototype.xi = function (a) {
if (!_super.prototype.xi.call(this, a)) {
return false;
}
if (this.ade != null) {
if (a.fb) {
var b = a.nc();
if (!Base.equalsStatic(this.ade, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.ade, a.name)) {
return false;
}
}
}
return true;
};
CalloutLayer.prototype.qp = function () {
_super.prototype.qp.call(this);
if (!this.a1.c && !this.d3()) {
return;
}
if (this.aax) {
this.aax = false;
this.ad8();
this.ad3();
}
if (this.d3()) {
this.aea(this.xd, false);
}
else {
this.aea(this.xb, false);
}
};
CalloutLayer.prototype.ad4 = function () {
if (!this.aaz) {
this.aaz = true;
this.rr(true);
}
};
CalloutLayer.prototype.ad7 = function (a, b, c) {
var d = false;
if (this.aaz) {
this.aaz = false;
d = true;
}
a.ki = this.z0;
if (!a.gi && a.eb(this.abk, this.abf, this.abb, this.ab2, false)) {
var e = this.abk;
var _loop_1 = function (f) {
var g = e._inner[f];
var h = g.b != null ? g.b.item : null;
var i = g.b.item != null ? g.b.item : g.b;
var j = g.g;
var k = a;
var l = new CalloutKey(i, k);
var m = new CalloutAnnotationWrapper();
var n = new CalloutAnnotation();
m.b = n;
n.key = l;
var o = false;
if (this_1.abg.containsKey(m)) {
m = this_1.abg.item(m).c;
n = m.b;
o = d;
}
else {
o = true;
}
var p = n.ac;
var q = n.ad;
if (this_1.ab0(p) != this_1.ab0(g.d) && (!isNaN_(this_1.ab0(p)) || !isNaN_(this_1.ab0(g.d)))) {
n.xValue = g.d;
}
if (this_1.ab0(q) != this_1.ab0(g.e) && (!isNaN_(this_1.ab0(q)) || !isNaN_(this_1.ab0(g.e)))) {
n.yValue = g.e;
}
n.itemColor = j;
n.series = a;
var r = false;
if (g.f != n.az) {
n.az = g.f;
r = true;
}
if (o || r) {
if (this_1.calloutLabelUpdating != null) {
var s = ((function () {
var $ret = new CalloutLabelUpdatingEventArgs();
$ret.d = n.ac;
$ret.e = n.ad;
$ret.item = h;
$ret.a = a;
$ret.f = a.name;
return $ret;
})());
this_1.calloutLabelUpdating(this_1, s);
if (s.c != null && !Base.equalsStatic(s.c, m.b.ao)) {
var t = s.c;
if (this_1.z0 != null) {
m.b.text = this_1.z0.i(t);
}
else {
m.b.text = t != null ? t.toString() : "";
}
}
}
else {
if (g.f != null) {
n.text = g.f;
}
}
}
if (n.ao == null) {
return "continue";
}
if (o || r) {
if (this_1.calloutContentUpdating != null) {
var u = ((function () {
var $ret = new CalloutContentUpdatingEventArgs();
$ret.c = n.ac;
$ret.d = n.ad;
$ret.item = h;
$ret.a = i;
return $ret;
})());
this_1.calloutContentUpdating(this_1, 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_1.aec(m);
}
if (m.c == null) {
var v = new LabelCollisionInfo();
m.c = v;
var w = this_1.z8.cr(this_1.ab6(m), m.b.backgroundPadding);
v.o = w.height / 2;
v.p = w.width / 2;
}
var x = this_1.aav(m);
if (x == null || x.d < this_1.ws.left || x.d > this_1.ws.right || x.e < this_1.ws.top || x.e > this_1.ws.bottom) {
return "continue";
}
m.e = x.d;