igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,496 lines • 76.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 { __extends, __values } from "tslib";
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
*/
var CalloutLayer = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CalloutLayer, _super);
function CalloutLayer() {
var _this = _super.call(this) || this;
_this.abe = false;
_this.aa9 = false;
_this.abb = false;
_this.aba = true;
_this.agt = new Size(1, 0, 0);
_this.calloutStyleUpdating = null;
_this.calloutRenderStyleUpdating = null;
_this.aax = null;
_this.aay = null;
_this.aaz = null;
_this.aaw = null;
_this.aav = null;
_this.ab3 = new HashSet$1(CalloutAnnotationWrapper.$, 0);
_this.ab6 = new List$1(CalloutAnnotationWrapper.$, 0);
_this.ab7 = new List$1(CalloutAnnotationWrapper.$, 0);
_this.aam = null;
_this.aaa = null;
_this.aat = null;
_this.ab8 = new List$1(CalloutAnnotationWrapper.$, 0);
_this.ab9 = new List$1(CalloutAnnotationWrapper.$, 0);
_this.acr = 0;
_this.acc = -1;
_this.acb = -1;
_this.ab4 = new LinkedList$1(CalloutAnnotationWrapper.$);
_this.ab1 = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
_this.aa5 = null;
_this.agr = new Rect(0, 0, 0, 1, 1);
_this.abg = false;
_this.abi = false;
_this.acq = 0;
_this.agq = Rect.empty;
_this.abf = false;
_this.abh = false;
_this.calloutContentUpdating = null;
_this.calloutLabelUpdating = null;
_this.calloutSeriesSelecting = null;
_this.ab5 = new List$1(SeriesPointOfInterest.$, 0);
_this.abk = false;
_this.abl = false;
_this.acd = 0;
_this.abj = false;
_this.aad = null;
_this.abc = false;
_this.abd = true;
_this.aae = 1;
FastItemObjectColumn.m();
_this.aaa = null;
_this.aam = new CalloutPlacementPositionsCollection();
var a = _this.aam;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.aep));
_this.xp = true;
var b = new CalloutLayerFrame();
var c = new CalloutLayerFrame();
var d = new CalloutLayerFrame();
var e = _this.ke / 1000;
_this.xh = b;
_this.xg = c;
_this.xi = d;
_this.ab = CalloutLayer.$;
return _this;
}
CalloutLayer.prototype.bk = function () {
return new CalloutLayer();
};
CalloutLayer.prototype.get_eq = function () {
return true;
};
CalloutLayer.prototype.aep = function (a, b) {
this.aey();
};
CalloutLayer.prototype.aey = function () {
this.aaa = this.aac(this.aan);
this.aev();
};
CalloutLayer.prototype.aeq = function (a, b) {
this.ab7.clear();
this.ru(false);
};
CalloutLayer.prototype.pd = function (a, b, c, d) {
_super.prototype.pd.call(this, a, b, c, d);
var e = this.ab2();
switch (a) {
case 3:
this.ae6(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.aas;
this.ab7.insert(f, h);
this.ae6(f, e);
}
break;
case 0:
this.ab7.v(b, c);
break;
case 2:
for (var i = b; i < b + c; i++) {
this.ae6(i, e);
}
break;
case 4:
this.ab7.clear();
for (var j = 0; j < this.dp.count; j++) {
var k = new CalloutAnnotation();
var l = new CalloutAnnotationWrapper();
l.b = k;
l.b.series = this.aas;
this.ab7.add(l);
this.ae6(j, e);
}
break;
}
this.ru(true);
};
CalloutLayer.prototype.gg = function (a) {
return false;
};
CalloutLayer.prototype.agv = function () {
var a = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.agu.left) || isNaN_(this.agu.top) || isNaN_(this.agu.right) || isNaN_(this.agu.bottom)) {
a = new Thickness(0, DeviceUtils.g(3));
}
else {
a = this.agu;
}
return a;
};
CalloutLayer.prototype.wy = function () {
var a = 0;
var b = 0;
if (!this.abm) {
this.agt = new Size(1, 0, 0);
return this.agt;
}
if (this.abo) {
this.abe = true;
var c = new CalloutLayerFrame();
this.yy(c, this.cw);
this.abe = false;
if (this.ab8 != null && this.ab8.count == 0) {
this.agt = new Size(1, 0, 0);
return this.agt;
}
}
var d = this.agv();
var e = -1.7976931348623157E+308;
var f = -1.7976931348623157E+308;
for (var g = 0; g < this.ab8.count; g++) {
var h = this.ab8._inner[g].b.text;
var i = this.aal.c7(h, d);
if (!isNaN_(i.height)) {
f = Math.max(i.height, f);
}
if (!isNaN_(i.width)) {
e = Math.max(i.width, e);
}
}
a = f;
b = e;
if (!isNaN_(this.acn)) {
a += this.acn;
}
if (!isNaN_(this.acn)) {
b += this.acn;
}
if (!isNaN_(this.ach)) {
a = Math.max(a, this.ach);
}
if (!isNaN_(this.acf)) {
a = Math.min(a, this.acf);
}
if (!isNaN_(this.aci)) {
b = Math.max(b, this.aci);
}
if (!isNaN_(this.acg)) {
b = Math.min(b, this.acg);
}
this.aba = false;
this.agt = new Size(1, b, a);
return this.agt;
};
CalloutLayer.prototype.ab2 = function () {
var a = new Dictionary$2(String_$type, Series.$, 0);
if (this.dc != null) {
for (var b = 0; b < this.dc.series.count; b++) {
var c = this.dc.series._inner[b];
if (c.name != null && !a.containsKey(c.name)) {
a.addItem(c.name, c);
}
}
}
return a;
};
CalloutLayer.prototype.ae6 = function (a, b) {
var _this = this;
if (this.aa4 == null || this.aa2 == null) {
return;
}
var c = a;
if (this.aa3 != null) {
c = this.aa3.item(a);
}
var d = this.aa4.item(a);
var e = this.aa2.item(a);
var f = this.ab7._inner[a];
if (this.aa1 != null) {
if (f.b.ab != this.aa1.item(a)) {
f.b.key = this.aa1.item(a);
}
}
if (this.ab1.containsKey(f)) {
f.b = this.ab1.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.dp.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.aad != null) {
f.b.text = this.aad.i(h);
}
else {
f.b.text = h != null ? h.toString() : "";
}
}
}
else {
if (this.aad != null) {
f.b.text = this.aad.i(e);
}
else {
f.b.text = e != null ? e.toString() : "";
}
}
if (this.aa0 != null) {
f.b.content = this.aa0.item(a);
}
else {
f.b.content = this.dp.item(a);
}
if (this.calloutSeriesSelecting != null) {
var i = ((function () {
var $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.ae7(f);
};
CalloutLayer.prototype.ae7 = function (a) {
var b = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.agu.left) || isNaN_(this.agu.top) || isNaN_(this.agu.right) || isNaN_(this.agu.bottom)) {
b = new Thickness(0, DeviceUtils.g(3));
}
else {
b = this.agu;
}
var c = DeviceUtils.g(3);
if (isNaN_(this.ace)) {
c = DeviceUtils.g(3);
}
else {
c = this.ace;
}
var d = this.agk != null && !this.abx ? this.agk : this.aal.c1(a.b.l, a.b.itemColor);
var e = this.agp != null ? this.agp : null;
var f = this.agn != null ? this.agn : this.aal.c4();
var g = this.agl != null ? this.agl : this.aal.c2();
var h = this.ago != null && !this.aby ? this.ago : this.aal.c5(a.b.l, a.b.itemColor);
var i = this.agm != null ? this.agm : this.aal.c3(a.b.l, a.b.itemColor);
var j = isNaN_(this.aco) ? 0 : this.aco;
if (e == null && (this.abv || this.agn != null || this.agl != null)) {
var k = d;
if (k == null || BrushUtilCore.a(d)) {
k = this.dc != null ? this.dc.v9 : 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.j(255, 255, 255, 255);
}
}
e = BrushUtil.l(k, g, f);
}
if (e == null) {
e = this.aal.c4();
}
if (this.abt && 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.kr = function (a, b) {
var c = this.nf(b);
if (c == CalloutLayer.$$p[34]) {
return this.ks(a, b, this.ad4);
}
if (c == CalloutLayer.$$p[45]) {
return this.ks(a, b, this.aek);
}
if (c == CalloutLayer.$$p[46]) {
return this.ks(a, b, this.aen);
}
if (c == CalloutLayer.$$p[31]) {
return this.ks(a, b, this.ady);
}
if (c == CalloutLayer.$$p[25]) {
return this.ks(a, b, this.adq);
}
return _super.prototype.kr.call(this, a, b);
};
CalloutLayer.prototype.mf = function (a) {
var b = this.nf(a);
if (b == CalloutLayer.$$p[34]) {
return this.ad4;
}
if (b == CalloutLayer.$$p[45]) {
return this.aek;
}
if (b == CalloutLayer.$$p[46]) {
return this.aen;
}
if (b == CalloutLayer.$$p[31]) {
return this.ady;
}
if (b == CalloutLayer.$$p[25]) {
return this.adq;
}
return _super.prototype.mf.call(this, a);
};
Object.defineProperty(CalloutLayer.prototype, "aa2", {
get: function () {
return this.aax;
},
set: function (a) {
if (this.aax != a) {
var b = this.aax;
this.aax = a;
this.raisePropertyChanged("LabelColumn", b, this.aax);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa3", {
get: function () {
return this.aay;
},
set: function (a) {
if (this.aay != a) {
var b = this.aay;
this.aay = a;
this.raisePropertyChanged("XColumn", b, this.aay);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa4", {
get: function () {
return this.aaz;
},
set: function (a) {
if (this.aaz != a) {
var b = this.aaz;
this.aaz = a;
this.raisePropertyChanged("YColumn", b, this.aaz);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa1", {
get: function () {
return this.aaw;
},
set: function (a) {
if (this.aaw != a) {
var b = this.aaw;
this.aaw = a;
this.raisePropertyChanged("KeyColumn", b, this.aaw);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa0", {
get: function () {
return this.aav;
},
set: function (a) {
if (this.aav != a) {
var b = this.aav;
this.aav = a;
this.raisePropertyChanged("ContentColumn", b, this.aav);
}
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.aes = function (a, b) {
if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
var c = a.k;
if (!this.ab3.contains(c)) {
this.ab3.add_1(c);
this.ab6.add(c);
this.ru(false);
}
}
};
CalloutLayer.prototype.ct = function () {
return new CalloutLayerView(this);
};
CalloutLayer.prototype.q3 = function (a) {
_super.prototype.q3.call(this, a);
this.aal = a;
};
Object.defineProperty(CalloutLayer.prototype, "aan", {
get: function () {
return this.aam;
},
set: function (a) {
var b = this.aan;
if (a != b) {
this.aam = a;
this.raisePropertyChanged("AllowedPositions", b, this.aan);
}
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.gv = function (a) {
if (this.aas == null) {
return true;
}
if (this.aas == a) {
return true;
}
return false;
};
Object.defineProperty(CalloutLayer.prototype, "aag", {
get: function () {
return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.afw));
},
set: function (a) {
this.h(CalloutLayer.afw, enumGetBox(AutoCalloutVisibilityMode_$type, a));
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aaf", {
get: function () {
return this.aae;
},
set: function (a) {
this.aae = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "agu", {
get: function () {
return new Thickness(1, this.ack, this.acm, this.acl, this.acj);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aau", {
get: function () {
if (this.aat == null) {
this.aat = FontUtil.toFontInfo(this.j0, this.aea);
}
return this.aat;
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.yw = function (a, b) {
if (this.aas == null || this.aas == a) {
if (!this.a1.c) {
this.ru(b);
}
}
};
CalloutLayer.prototype.yy = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.yy.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();
this.ab9 = this.aca();
this.ab8 = new List$1(CalloutAnnotationWrapper.$, 0);
var d = Number.POSITIVE_INFINITY;
var e = true;
if (this.abq) {
if (this.xn(this.aas)) {
if (typeCast(IHasCategoryAxis_$type, this.aas) !== null) {
var f = this.aas.ix() > 0 ? this.aas.ix() : this.aas.getCategoryWidth();
if (!isNaN_(f) && !isInfinity(f) && f > 0) {
d = Math.min(d, f);
}
}
this.ae0(this.aas, c, this.ab8);
}
else {
try {
for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var g = _c.value;
if (this.xn(g)) {
if (typeCast(IHasCategoryAxis_$type, g) !== null) {
var h = g.ix() > 0 ? g.ix() : g.getCategoryWidth();
if (!isNaN_(h) && !isInfinity(h) && h > 0) {
d = Math.min(d, h);
}
}
if (!g.eu) {
if (!g.isVertical) {
e = false;
}
}
var i = false;
if (g.ei && this.aar == 0 || this.aar == 3 || this.aar == 2) {
if (this.aar == 0 || this.aar == 2) {
i = true;
}
g.p3(function (j) {
_this.ae0(j, c, _this.ab8);
return true;
});
}
if (!i) {
this.ae0(g, c, this.ab8);
}
}
}
}
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.abq && this.aaf == 2) {
var j = 0;
var k = 0;
var l = 1.7976931348623157E+308;
var m = 1.7976931348623157E+308;
var n = -1.7976931348623157E+308;
var o = -1.7976931348623157E+308;
if (this.ab8.count > 0) {
if (this.ab8._inner[0].c != null) {
j = this.ab8._inner[0].e;
k = this.ab8._inner[0].f;
}
for (var p = 0; p < this.ab8.count; p++) {
var q = this.ab8._inner[p];
if (q.c != null) {
var r = q.e;
var s = q.f;
if (r != j) {
l = Math.min(l, Math.abs(r - j));
}
if (s != k) {
m = Math.min(m, Math.abs(s - k));
}
n = Math.max(q.c.p + q.c.p, n);
o = Math.max(q.c.o + q.c.o, o);
}
}
if (e) {
if (!isNaN_(d) && !isInfinity(d)) {
if (o > d) {
this.ab8.clear();
}
}
else {
if (o > m) {
this.ab8.clear();
}
}
}
else {
if (!isNaN_(d) && !isInfinity(d)) {
if (n > d) {
this.ab8.clear();
}
}
else {
if (n > l) {
this.ab8.clear();
}
}
}
}
}
var t = this.acr <= 0 && this.ab8.count > 0;
var u = this.acr > 0 && this.ab8.count <= 0;
var v = t || u;
var w = this.acr != this.ab8.count;
if (t && this.abp) {
return;
}
if (!this.abe) {
this.aez(c, this.ab9, this.ab8);
}
var x = this.da.h2();
var y = this.da.h1();
var z = x != this.acc;
var aa = y != this.acb;
var ab = z || aa;
if (ab) {
this.acc = x;
this.acb = y;
}
this.acr = this.ab8.count;
if (this.abe) {
return;
}
if (!this.aa9 && this.abm && this.abn && this.ab8.count > 0 && this.ab8.count == this.acr && this.aaf == 2) {
this.aa9 = true;
this.ae2();
}
};
CalloutLayer.prototype.sv = function (a, b) {
_super.prototype.sv.call(this, a, b);
var c = b.width - this.agr.width;
var d = b.height - this.agr.height;
var e = 0;
if (Math.abs(c) > Math.abs(d)) {
e = c;
this.acd = c * this.wx.width;
}
else {
e = d;
this.acd = d * this.wx.height;
}
if (e > 0 && this.acd > 5) {
this.abl = true;
}
if (e < 0 && this.acd > 5) {
this.abk = true;
}
};
CalloutLayer.prototype.su = function (a, b) {
_super.prototype.su.call(this, a, b);
if (!a.equals1(b)) {
this.abj = true;
}
};
Object.defineProperty(CalloutLayer.prototype, "ags", {
get: function () {
return this.agq;
},
set: function (a) {
this.agq = a;
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.aez = function (a, b, c) {
var e_2, _a;
if (this.dc != null) {
this.agr = this.dc.wt;
}
if (this.wx.isEmpty) {
return;
}
this.ags = new Rect(0, this.wx.left, this.wx.top, this.wx.width, this.wx.height);
if (this.aa5 != null && this.adn != null && this.adn != this.aa5.bd) {
this.aeu();
}
if (this.aa5 != null && this.aa5.j != this.aa7()) {
this.aeu();
}
if (this.aa5 == null) {
var d = this.aa6();
if (d != null) {
this.aa5 = d;
var e = this.aa5;
e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.aer));
}
else {
var f = this.wo(this.cw);
var g = new Array(2);
g[0] = 0;
g[1] = 3;
if (this.aas != null) {
if (this.aas.isVertical) {
g = new Array(2);
g[0] = 2;
g[1] = 1;
}
}
else {
var h = false;
if (this.dc != null && this.dc.series.count > 0) {
h = true;
try {
for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var i = _c.value;
if (!i.eu) {
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.aai == 4 || this.aai == 6) {
g = new Array(4);
g[0] = 10;
g[1] = 11;
g[2] = 8;
g[3] = 9;
}
if (this.aai == 5) {
g = new Array(4);
g[0] = 9;
g[1] = 10;
g[2] = 11;
g[3] = 8;
}
if (this.aai == 7) {
g = new Array(4);
g = new Array(4);
g[0] = 8;
g[1] = 10;
g[2] = 11;
g[3] = 9;
}
this.aa5 = new LabelCollisionManager(this.wx.right, this.wx.bottom, this.wx, this.aal.k(), this.acn, this.aa7(), g, this.acv(), this.acu(), this.abr, this.aaa);
this.aa5.v = this.abu;
if (this.adn != null) {
this.aa5.bd = this.adn;
this.aa5.bb = this;
}
var j = this.aa5;
j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.aer));
}
}
if (this.abk) {
this.abk = false;
if (this.aa5.a9 > 2) {
this.abi = true;
}
}
if (this.abl) {
this.abl = false;
if (this.acd > 5) {
this.abi = true;
}
}
if (this.abj) {
this.abj = false;
this.aa5.bs(this.wx.right, this.wx.bottom, this.wx);
this.abi = 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.ab4.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.aes));
this.ab4.h(r);
this.ab1.removeItem(r.c);
this.aa5.br(r.c.c);
}
r = s;
}
for (var u = 0; u < b.count; u++) {
if (!this.ab1.containsKey(b._inner[u])) {
this.ab4.f(b._inner[u]);
var v = b._inner[u].b;
v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.aes));
this.ab1.addItem(b._inner[u], this.ab4.d);
m.add(b._inner[u]);
k.add_1(b._inner[u]);
this.abi = true;
}
}
for (var w = 0; w < c.count; w++) {
if (!this.ab1.containsKey(c._inner[w])) {
this.ab4.f(c._inner[w]);
this.ab1.addItem(c._inner[w], this.ab4.d);
var x = c._inner[w].b;
x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.aes));
m.add(c._inner[w]);
k.add_1(c._inner[w]);
this.abi = true;
}
}
if (this.abf == true) {
this.abf = false;
this.abi = true;
}
var y = false;
if (this.ab6.count > 0) {
y = true;
this.ab6.clear();
this.ab3.clear();
}
r = this.ab4.c;
while (r != null) {
var z = this.aa8(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.aa5.ad(ab, false);
}
if (aa) {
this.aa5.be(ab);
}
else {
this.aa5.bo(ab);
}
}
}
r = r.a;
}
var ac = this.aa5.ba();
var ad = this.aa5.af();
if (!this.abi && y && (ac != 0 || ad)) {
{
this.abi = true;
}
}
if (ad) {
if (this.aa5.x()) {
this.abi = true;
}
}
if (this.abi && (ac != 0 || ad || this.abg)) {
this.abg = false;
this.abi = false;
this.acq = 0x7FFFFFFF;
if (this.adn != null) {
var ae = true;
for (var af = 0; af < this.dc.series.count; af++) {
var ag = this.dc.series._inner[af];
if (ag.eu && typeCast(CalloutLayer.$, ag) !== null) {
var ah = ag;
if (ah.adn == this.adn) {
if (!ah.ags.equals1(this.aa5.b0)) {
ae = false;
break;
}
}
}
}
if (ae) {
this.aa5.bv();
}
else {
this.aa5.bf();
this.aa5.bg();
}
}
else {
this.aa5.bv();
}
}
else {
this.aa5.bg();
}
var ai = this.ab4.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.abs;
var a0 = this.abu;
var a1 = this.cw.b5();
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.aa5.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.aec(a2, at);
var a6 = this.aa5.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.aec = function (a, b) {
var c = Math.max(this.aa5.as(a.c.c), this.aa5.at(a.c.c));
if (c <= 0) {
return b;
}
var d = b.length;
var e = this.aal.c7(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.aal.c7(b, a.b.backgroundPadding);
f = e.width;
}
return b;
};
CalloutLayer.prototype.aeu = function () {
if (this.aa5 != null) {
var a = this.ab4.c;
while (a != null) {
var b = a.c.c;
if (b != null) {
this.aa5.br(b);
}
a = a.a;
}
var c = this.aa5;
c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.aer));
this.aa5 = null;
}
this.aet();
};
CalloutLayer.prototype.aa6 = function () {
if (this.dc == null) {
return null;
}
for (var a = 0; a < this.dc.series.count; a++) {
var b = this.dc.series._inner[a];
if (b.eu && typeCast(CalloutLayer.$, b) !== null) {
var c = b;
if (c != this) {
if (c.adn != null && c.adn == this.adn) {
if (c.aa5 != null) {
return c.aa5;
}
}
}
}
}
return null;
};
CalloutLayer.prototype.acu = function () {
return 20000;
};
CalloutLayer.prototype.acv = function () {
return 300;
};
CalloutLayer.prototype.aa7 = function () {
switch (this.aai) {
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.aer = function (a) {
var b = this.aa5.ba();
var c = this.acq;
if (b < this.acq) {
this.acq = b;
if (c != 0x7FFFFFFF) {
this.ru(false);
}
}
};
CalloutLayer.prototype.aa8 = function (a) {
var b = this.aas;
if (a.b.l != null) {
b = a.b.l;
}
if (b == null) {
for (var c = 0; c < this.dc.series.count; c++) {
var d = this.dc.series._inner[c];
if (!d.eu) {
b = d;
break;
}
}
}
if (b == null) {
return null;
}
var e = b.ai();
var f = b.iz();
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.e8) {
k = b.getOffsetValue();
}
else if (b.e0) {
k = b.getOffsetValue();
}
}
if (h.cb && h.categoryMode != 0) {
if (b.e0) {
l = b.getOffsetValue();
}
}
var m = new ScalerParams(0, this.dc.wt, g.kh, g.ch, g.kc());
m.b = f;
var n = new ScalerParams(0, this.dc.wt, h.kh, h.ch, h.kc());
n.b = f;
var o = 0;
var p = 0;
if (i) {
o = g.el(this.acp(a.b.ac), m) + k;
p = h.el(this.acp(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.acp(a.b.ac), m) + k;
p = h.el(this.acp(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.acp = function (a) {
if (typeCast(Date_$type, a) !== null) {
return a.getTime();
}
if (a == null) {
return 0;
}
return a;
};
CalloutLayer.prototype.aca = function () {
var a = new List$1(CalloutAnnotationWrapper.$, 0);
for (var b = 0; b < this.ab7.count; b++) {
if (stringIsNullOrEmpty(this.ab7._inner[b].b.ao)) {
continue;
}
if (this.ab7._inner[b].c == null) {
var c = new LabelCollisionInfo();
this.ab7._inner[b].c = c;
var d = this.aal.c7(this.acw(this.ab7._inner[b]), this.ab7._inner[b].b.backgroundPadding);
c.o = d.height / 2;
c.p = d.width / 2;
}
var e = this.aa8(this.ab7._inner[b]);
if (e == null || e.d < this.wx.left || e.d > this.wx.right || e.e < this.wx.top || e.e > this.wx.bottom) {
continue;
}
a.add(this.ab7._inner[b]);
}
return a;
};
CalloutLayer.prototype.acw = function (a) {
return a.b.ao;
};
CalloutLayer.prototype.xn = function (a) {
if (!_super.prototype.xn.call(this, a)) {
return false;
}
if (this.ad7 != null) {
if (a.isFragment) {
var b = a.ne();
if (!Base.equalsStatic(this.ad7, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.ad7, a.name)) {
return false;
}
}
}
return true;
};
CalloutLayer.prototype.qr = function () {
_super.prototype.qr.call(this);
if (!this.a1.c && !this.d4()) {
return;
}
if (this.abd) {
this.abd = false;
this.ae1();
this.aew();
}
if (this.d4()) {
this.ae5(this.xi, false);
}
else {
this.ae5(this.xg, false);
}
};
CalloutLayer.prototype.aex = function () {
if (!this.abh) {
this.abh = true;
this.ru(true);
}
};
CalloutLayer.prototype.ae0 = function (a, b, c) {
var d = false;
if (this.abh) {
this.abh = false;
d = true;
}
a.kj = this.aad;
if (!a.gj && a.ed(this.ab5, this.ab0, this.abw, this.acs, false)) {
var e = this.ab5;
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.ab1.containsKey(m)) {
m = this_1.ab1.item(m).c;
n = m.b;
o = d;
}
else {
o = true;
}
var p = n.ac;
var q = n.ad;
if (this_1.acp(p) != this_1.acp(g.d) && (!isNaN_(this_1.acp(p)) || !isNaN_(this_1.acp(g.d)))) {
n.xValue = g.d;
}
if (this_1.acp(q) != this_1.acp(g.e) && (!isNaN_(this_1.acp(q)) || !isNaN_(this_1.acp(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.aad != null) {
m.b.text = this_1.aad.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.ae7(m);
}
if (m.c == null) {
var v = new LabelCollisionInfo();
m.c