igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,497 lines (1,496 loc) • 76.8 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.abl = false;
_this.abg = false;
_this.abi = false;
_this.abh = true;
_this.ag0 = new Size(1, 0, 0);
_this.abf = true;
_this.calloutStyleUpdating = null;
_this.calloutRenderStyleUpdating = null;
_this.aa3 = null;
_this.aa4 = null;
_this.aa5 = null;
_this.aa2 = null;
_this.aa1 = null;
_this.aca = new HashSet$1(CalloutAnnotationWrapper.$, 0);
_this.acd = new List$1(CalloutAnnotationWrapper.$, 0);
_this.ace = new List$1(CalloutAnnotationWrapper.$, 0);
_this.aas = null;
_this.aag = null;
_this.aaz = null;
_this.acf = new List$1(CalloutAnnotationWrapper.$, 0);
_this.acg = new List$1(CalloutAnnotationWrapper.$, 0);
_this.acy = 0;
_this.acj = -1;
_this.aci = -1;
_this.acb = new LinkedList$1(CalloutAnnotationWrapper.$);
_this.ab8 = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
_this.abb = null;
_this.agy = new Rect(0, 0, 0, 1, 1);
_this.abn = false;
_this.abp = false;
_this.acx = 0;
_this.agx = Rect.empty;
_this.abm = false;
_this.abo = false;
_this.calloutContentUpdating = null;
_this.calloutLabelUpdating = null;
_this.calloutSeriesSelecting = null;
_this.acc = new List$1(SeriesPointOfInterest.$, 0);
_this.abr = false;
_this.abs = false;
_this.ack = 0;
_this.abq = false;
_this.aaj = null;
_this.abj = false;
_this.abk = true;
_this.aak = 1;
FastItemObjectColumn.m();
_this.aag = null;
_this.aas = new CalloutPlacementPositionsCollection();
var a = _this.aas;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.aew));
_this.xv = true;
var b = new CalloutLayerFrame();
var c = new CalloutLayerFrame();
var d = new CalloutLayerFrame();
var e = _this.kh / 1000;
_this.xn = b;
_this.xm = c;
_this.xo = d;
_this.ab = CalloutLayer.$;
return _this;
}
CalloutLayer.prototype.bk = function () {
return new CalloutLayer();
};
CalloutLayer.prototype.get_eq = function () {
return true;
};
CalloutLayer.prototype.aew = function (a, b) {
this.ae5();
};
CalloutLayer.prototype.ae5 = function () {
this.aag = this.aai(this.aat);
this.ae2();
};
CalloutLayer.prototype.aex = function (a, b) {
this.ace.clear();
this.rz(false);
};
CalloutLayer.prototype.ph = function (a, b, c, d) {
_super.prototype.ph.call(this, a, b, c, d);
var e = this.ab9();
switch (a) {
case 3:
this.afd(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.aay;
this.ace.insert(f, h);
this.afd(f, e);
}
break;
case 0:
this.ace.v(b, c);
break;
case 2:
for (var i = b; i < b + c; i++) {
this.afd(i, e);
}
break;
case 4:
this.ace.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.aay;
this.ace.add(l);
this.afd(j, e);
}
break;
}
this.rz(true);
};
CalloutLayer.prototype.gg = function (a) {
return false;
};
CalloutLayer.prototype.ag2 = function () {
var a = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.ag1.left) || isNaN_(this.ag1.top) || isNaN_(this.ag1.right) || isNaN_(this.ag1.bottom)) {
a = new Thickness(0, DeviceUtils.g(3));
}
else {
a = this.ag1;
}
return a;
};
CalloutLayer.prototype.w4 = function () {
if (!this.abf) {
return this.ag0;
}
var a = 0;
var b = 0;
if (!this.abt) {
this.ag0 = new Size(1, 0, 0);
return this.ag0;
}
if (this.abv) {
this.abl = true;
var c = new CalloutLayerFrame();
this.y4(c, this.cw);
this.abl = false;
if (this.acf != null && this.acf.count == 0) {
this.ag0 = new Size(1, 0, 0);
return this.ag0;
}
}
var d = this.ag2();
var e = -1.7976931348623157E+308;
var f = -1.7976931348623157E+308;
for (var g = 0; g < this.acf.count; g++) {
var h = this.acf._inner[g].b.text;
var i = this.aar.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.acu)) {
a += this.acu;
}
if (!isNaN_(this.acu)) {
b += this.acu;
}
if (!isNaN_(this.aco)) {
a = Math.max(a, this.aco);
}
if (!isNaN_(this.acm)) {
a = Math.min(a, this.acm);
}
if (!isNaN_(this.acp)) {
b = Math.max(b, this.acp);
}
if (!isNaN_(this.acn)) {
b = Math.min(b, this.acn);
}
this.abh = false;
this.ag0 = new Size(1, b, a);
return this.ag0;
};
CalloutLayer.prototype.ab9 = 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.afd = function (a, b) {
var _this = this;
if (this.aba == null || this.aa8 == null) {
return;
}
var c = a;
if (this.aa9 != null) {
c = this.aa9.item(a);
}
var d = this.aba.item(a);
var e = this.aa8.item(a);
var f = this.ace._inner[a];
if (this.aa7 != null) {
if (f.b.ab != this.aa7.item(a)) {
f.b.key = this.aa7.item(a);
}
}
if (this.ab8.containsKey(f)) {
f.b = this.ab8.item(f).c.b;
}
f.b.xValue = c;
f.b.yValue = d;
var g = true;
if (this.calloutLabelUpdating != null) {
var h = ((function () {
var $ret = new CalloutLabelUpdatingEventArgs();
$ret.d = c;
$ret.e = d;
$ret.item = _this.dp.item(a);
return $ret;
})());
this.calloutLabelUpdating(this, h);
if (h.c != null && !Base.equalsStatic(h.c, f.b.ao)) {
g = false;
var i = h.c;
if (this.aaj != null) {
f.b.text = this.aaj.i(i);
}
else {
f.b.text = i != null ? i.toString() : "";
}
}
}
if (g) {
if (this.aaj != null) {
f.b.text = this.aaj.i(e);
}
else {
f.b.text = e != null ? e.toString() : "";
}
}
if (this.aa6 != null) {
f.b.content = this.aa6.item(a);
}
else {
f.b.content = this.dp.item(a);
}
if (this.calloutSeriesSelecting != null) {
var j = ((function () {
var $ret = new CalloutSeriesSelectingEventArgs();
$ret.c = c;
$ret.d = d;
$ret.item = _this.dp.item(a);
return $ret;
})());
this.calloutSeriesSelecting(this, j);
if (j.a != null) {
f.b.series = j.a;
}
else if (j.e != null) {
if (b.containsKey(j.e)) {
f.b.series = b.item(j.e);
}
}
}
this.afe(f);
};
CalloutLayer.prototype.afe = function (a) {
var b = new Thickness(0, DeviceUtils.g(3));
if (isNaN_(this.ag1.left) || isNaN_(this.ag1.top) || isNaN_(this.ag1.right) || isNaN_(this.ag1.bottom)) {
b = new Thickness(0, DeviceUtils.g(3));
}
else {
b = this.ag1;
}
var c = DeviceUtils.g(3);
if (isNaN_(this.acl)) {
c = DeviceUtils.g(3);
}
else {
c = this.acl;
}
var d = this.agr != null && !this.ab4 ? this.agr : this.aar.c1(a.b.l, a.b.itemColor);
var e = this.agw != null ? this.agw : null;
var f = this.agu != null ? this.agu : this.aar.c4();
var g = this.ags != null ? this.ags : this.aar.c2();
var h = this.agv != null && !this.ab5 ? this.agv : this.aar.c5(a.b.l, a.b.itemColor);
var i = this.agt != null ? this.agt : this.aar.c3(a.b.l, a.b.itemColor);
var j = isNaN_(this.acv) ? 0 : this.acv;
if (e == null && (this.ab2 || this.agu != null || this.ags != null)) {
var k = d;
if (k == null || BrushUtilCore.a(d)) {
k = this.dc != null ? this.dc.w3 : 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.aar.c4();
}
if (this.ab0 && 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.ku = function (a, b) {
var c = this.ni(b);
if (c == CalloutLayer.$$p[34]) {
return this.kv(a, b, this.aeb);
}
if (c == CalloutLayer.$$p[45]) {
return this.kv(a, b, this.aer);
}
if (c == CalloutLayer.$$p[46]) {
return this.kv(a, b, this.aeu);
}
if (c == CalloutLayer.$$p[31]) {
return this.kv(a, b, this.ad5);
}
if (c == CalloutLayer.$$p[25]) {
return this.kv(a, b, this.adx);
}
return _super.prototype.ku.call(this, a, b);
};
CalloutLayer.prototype.mi = function (a) {
var b = this.ni(a);
if (b == CalloutLayer.$$p[34]) {
return this.aeb;
}
if (b == CalloutLayer.$$p[45]) {
return this.aer;
}
if (b == CalloutLayer.$$p[46]) {
return this.aeu;
}
if (b == CalloutLayer.$$p[31]) {
return this.ad5;
}
if (b == CalloutLayer.$$p[25]) {
return this.adx;
}
return _super.prototype.mi.call(this, a);
};
Object.defineProperty(CalloutLayer.prototype, "aa8", {
get: function () {
return this.aa3;
},
set: function (a) {
if (this.aa3 != a) {
var b = this.aa3;
this.aa3 = a;
this.raisePropertyChanged("LabelColumn", b, this.aa3);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa9", {
get: function () {
return this.aa4;
},
set: function (a) {
if (this.aa4 != a) {
var b = this.aa4;
this.aa4 = a;
this.raisePropertyChanged("XColumn", b, this.aa4);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aba", {
get: function () {
return this.aa5;
},
set: function (a) {
if (this.aa5 != a) {
var b = this.aa5;
this.aa5 = a;
this.raisePropertyChanged("YColumn", b, this.aa5);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa7", {
get: function () {
return this.aa2;
},
set: function (a) {
if (this.aa2 != a) {
var b = this.aa2;
this.aa2 = a;
this.raisePropertyChanged("KeyColumn", b, this.aa2);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa6", {
get: function () {
return this.aa1;
},
set: function (a) {
if (this.aa1 != a) {
var b = this.aa1;
this.aa1 = a;
this.raisePropertyChanged("ContentColumn", b, this.aa1);
}
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.aez = function (a, b) {
if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
var c = a.k;
if (!this.aca.contains(c)) {
this.aca.add_1(c);
this.acd.add(c);
this.rz(false);
}
}
};
CalloutLayer.prototype.ct = function () {
return new CalloutLayerView(this);
};
CalloutLayer.prototype.q8 = function (a) {
_super.prototype.q8.call(this, a);
this.aar = a;
};
Object.defineProperty(CalloutLayer.prototype, "aat", {
get: function () {
return this.aas;
},
set: function (a) {
var b = this.aat;
if (a != b) {
this.aas = a;
this.raisePropertyChanged("AllowedPositions", b, this.aat);
}
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.gv = function (a) {
if (this.aay == null) {
return true;
}
if (this.aay == a) {
return true;
}
return false;
};
Object.defineProperty(CalloutLayer.prototype, "aam", {
get: function () {
return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.af3));
},
set: function (a) {
this.h(CalloutLayer.af3, enumGetBox(AutoCalloutVisibilityMode_$type, a));
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aal", {
get: function () {
return this.aak;
},
set: function (a) {
this.aak = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "ag1", {
get: function () {
return new Thickness(1, this.acr, this.act, this.acs, this.acq);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CalloutLayer.prototype, "aa0", {
get: function () {
if (this.aaz == null) {
this.aaz = FontUtil.toFontInfo(this.j3, this.aeh);
}
return this.aaz;
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.y2 = function (a, b) {
if (this.aay == null || this.aay == a) {
if (!this.a1.c) {
this.rz(b);
}
}
};
CalloutLayer.prototype.y4 = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.y4.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.acg = this.ach();
this.acf = new List$1(CalloutAnnotationWrapper.$, 0);
var d = Number.POSITIVE_INFINITY;
var e = true;
if (this.abx) {
if (this.xt(this.aay)) {
if (typeCast(IHasCategoryAxis_$type, this.aay) !== null) {
var f = this.aay.iy() > 0 ? this.aay.iy() : this.aay.getCategoryWidth();
if (!isNaN_(f) && !isInfinity(f) && f > 0) {
d = Math.min(d, f);
}
}
this.ae7(this.aay, c, this.acf);
}
else {
try {
for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var g = _c.value;
if (this.xt(g)) {
if (typeCast(IHasCategoryAxis_$type, g) !== null) {
var h = g.iy() > 0 ? g.iy() : 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.aax == 0 || this.aax == 3 || this.aax == 2) {
if (this.aax == 0 || this.aax == 2) {
i = true;
}
g.p7(function (j) {
_this.ae7(j, c, _this.acf);
return true;
});
}
if (!i) {
this.ae7(g, c, this.acf);
}
}
}
}
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.abx && this.aal == 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.acf.count > 0) {
if (this.acf._inner[0].c != null) {
j = this.acf._inner[0].e;
k = this.acf._inner[0].f;
}
for (var p = 0; p < this.acf.count; p++) {
var q = this.acf._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.acf.clear();
}
}
else {
if (o > m) {
this.acf.clear();
}
}
}
else {
if (!isNaN_(d) && !isInfinity(d)) {
if (n > d) {
this.acf.clear();
}
}
else {
if (n > l) {
this.acf.clear();
}
}
}
}
}
var t = this.acy <= 0 && this.acf.count > 0;
var u = this.acy > 0 && this.acf.count <= 0;
var v = t || u;
var w = this.acy != this.acf.count;
if (t && this.abw) {
return;
}
if (!this.abl) {
this.ae6(c, this.acg, this.acf);
}
var x = this.da.ih();
var y = this.da.ig();
var z = x != this.acj;
var aa = y != this.aci;
var ab = z || aa;
if (ab) {
this.acj = x;
this.aci = y;
}
this.acy = this.acf.count;
if (this.abl) {
return;
}
if (!this.abg && this.abt && this.abu && this.acf.count > 0 && this.acf.count == this.acy && this.aal == 2) {
this.abg = true;
this.ae9();
}
};
CalloutLayer.prototype.s0 = function (a, b) {
_super.prototype.s0.call(this, a, b);
var c = b.width - this.agy.width;
var d = b.height - this.agy.height;
var e = 0;
if (Math.abs(c) > Math.abs(d)) {
e = c;
this.ack = c * this.w3.width;
}
else {
e = d;
this.ack = d * this.w3.height;
}
if (e > 0 && this.ack > 5) {
this.abs = true;
}
if (e < 0 && this.ack > 5) {
this.abr = true;
}
};
CalloutLayer.prototype.sz = function (a, b) {
_super.prototype.sz.call(this, a, b);
if (!a.equals1(b)) {
this.abq = true;
}
};
Object.defineProperty(CalloutLayer.prototype, "agz", {
get: function () {
return this.agx;
},
set: function (a) {
this.agx = a;
},
enumerable: false,
configurable: true
});
CalloutLayer.prototype.ae6 = function (a, b, c) {
var e_2, _a;
if (this.dc != null) {
this.agy = this.dc.xn;
}
if (this.w3.isEmpty) {
return;
}
this.agz = new Rect(0, this.w3.left, this.w3.top, this.w3.width, this.w3.height);
if (this.abb != null && this.adu != null && this.adu != this.abb.bd) {
this.ae1();
}
if (this.abb != null && this.abb.j != this.abd()) {
this.ae1();
}
if (this.abb == null) {
var d = this.abc();
if (d != null) {
this.abb = d;
var e = this.abb;
e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.aey));
}
else {
var f = this.wu(this.cw);
var g = new Array(2);
g[0] = 0;
g[1] = 3;
if (this.aay != null) {
if (this.aay.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.aao == 4 || this.aao == 6) {
g = new Array(4);
g[0] = 10;
g[1] = 11;
g[2] = 8;
g[3] = 9;
}
if (this.aao == 5) {
g = new Array(4);
g[0] = 9;
g[1] = 10;
g[2] = 11;
g[3] = 8;
}
if (this.aao == 7) {
g = new Array(4);
g = new Array(4);
g[0] = 8;
g[1] = 10;
g[2] = 11;
g[3] = 9;
}
this.abb = new LabelCollisionManager(this.w3.right, this.w3.bottom, this.w3, this.aar.k(), this.acu, this.abd(), g, this.ac2(), this.ac1(), this.aby, this.aag);
this.abb.v = this.ab1;
if (this.adu != null) {
this.abb.bd = this.adu;
this.abb.bb = this;
}
var j = this.abb;
j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.aey));
}
}
if (this.abr) {
this.abr = false;
if (this.abb.a9 > 2) {
this.abp = true;
}
}
if (this.abs) {
this.abs = false;
if (this.ack > 5) {
this.abp = true;
}
}
if (this.abq) {
this.abq = false;
this.abb.bs(this.w3.right, this.w3.bottom, this.w3);
this.abp = 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.acb.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.aez));
this.acb.h(r);
this.ab8.removeItem(r.c);
this.abb.br(r.c.c);
}
r = s;
}
for (var u = 0; u < b.count; u++) {
if (!this.ab8.containsKey(b._inner[u])) {
this.acb.f(b._inner[u]);
var v = b._inner[u].b;
v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.aez));
this.ab8.addItem(b._inner[u], this.acb.d);
m.add(b._inner[u]);
k.add_1(b._inner[u]);
this.abp = true;
}
}
for (var w = 0; w < c.count; w++) {
if (!this.ab8.containsKey(c._inner[w])) {
this.acb.f(c._inner[w]);
this.ab8.addItem(c._inner[w], this.acb.d);
var x = c._inner[w].b;
x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.aez));
m.add(c._inner[w]);
k.add_1(c._inner[w]);
this.abp = true;
}
}
if (this.abm == true) {
this.abm = false;
this.abp = true;
}
var y = false;
if (this.acd.count > 0) {
y = true;
this.acd.clear();
this.aca.clear();
}
r = this.acb.c;
while (r != null) {
var z = this.abe(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.abb.ad(ab, false);
}
if (aa) {
this.abb.be(ab);
}
else {
this.abb.bo(ab);
}
}
}
r = r.a;
}
var ac = this.abb.ba();
var ad = this.abb.af();
if (!this.abp && y && (ac != 0 || ad)) {
{
this.abp = true;
}
}
if (ad) {
if (this.abb.x()) {
this.abp = true;
}
}
if (this.abp && (ac != 0 || ad || this.abn)) {
this.abn = false;
this.abp = false;
this.acx = 0x7FFFFFFF;
if (this.adu != 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.adu == this.adu) {
if (!ah.agz.equals1(this.abb.b0)) {
ae = false;
break;
}
}
}
}
if (ae) {
this.abb.bv();
}
else {
this.abb.bf();
this.abb.bg();
}
}
else {
this.abb.bv();
}
}
else {
this.abb.bg();
}
var ai = this.acb.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.abz;
var a0 = this.ab1;
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.abb.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.aej(a2, at);
var a6 = this.abb.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.aej = function (a, b) {
var c = Math.max(this.abb.as(a.c.c), this.abb.at(a.c.c));
if (c <= 0) {
return b;
}
var d = b.length;
var e = this.aar.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.aar.c7(b, a.b.backgroundPadding);
f = e.width;
}
return b;
};
CalloutLayer.prototype.ae1 = function () {
if (this.abb != null) {
var a = this.acb.c;
while (a != null) {
var b = a.c.c;
if (b != null) {
this.abb.br(b);
}
a = a.a;
}
var c = this.abb;
c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.aey));
this.abb = null;
}
this.ae0();
};
CalloutLayer.prototype.abc = 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.adu != null && c.adu == this.adu) {
if (c.abb != null) {
return c.abb;
}
}
}
}
}
return null;
};
CalloutLayer.prototype.ac1 = function () {
return 20000;
};
CalloutLayer.prototype.ac2 = function () {
return 300;
};
CalloutLayer.prototype.abd = function () {
switch (this.aao) {
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.aey = function (a) {
var b = this.abb.ba();
var c = this.acx;
if (b < this.acx) {
this.acx = b;
if (c != 0x7FFFFFFF) {
this.rz(false);
}
}
};
CalloutLayer.prototype.abe = function (a) {
var b = this.aay;
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.i0();
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].c5) {
i = true;
g = e[j];
}
else if (e[j].dl) {
i = true;
h = e[j];
}
else if (e[j].dq) {
h = e[j];
}
else {
g = e[j];
}
}
if (g == null || h == null) {
return null;
}
if (!g.dp() || !h.dp()) {
return null;
}
var k = 0;
var l = 0;
if (g.c8 && g.categoryMode != 0) {
if (b.e8) {
k = b.getOffsetValue();
}
else if (b.e0) {
k = b.getOffsetValue();
}
}
if (h.c8 && h.categoryMode != 0) {
if (b.e0) {
l = b.getOffsetValue();
}
}
var m = new ScalerParams(0, this.dc.xn, g.n1, g.df, g.nw());
m.b = f;
var n = new ScalerParams(0, this.dc.xn, h.n1, h.df, h.nw());
n.b = f;
var o = 0;
var p = 0;
if (i) {
o = g.ft(this.acw(a.b.ac), m) + k;
p = h.ft(this.acw(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.ft(this.acw(a.b.ac), m) + k;
p = h.ft(this.acw(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.acw = function (a) {
if (typeCast(Date_$type, a) !== null) {
return a.getTime();
}
if (a == null) {
return 0;
}
return a;
};
CalloutLayer.prototype.ach = function () {
var a = new List$1(CalloutAnnotationWrapper.$, 0);
for (var b = 0; b < this.ace.count; b++) {
if (stringIsNullOrEmpty(this.ace._inner[b].b.ao)) {
continue;
}
if (this.ace._inner[b].c == null) {
var c = new LabelCollisionInfo();
this.ace._inner[b].c = c;
var d = this.aar.c7(this.ac3(this.ace._inner[b]), this.ace._inner[b].b.backgroundPadding);
c.o = d.height / 2;
c.p = d.width / 2;
}
var e = this.abe(this.ace._inner[b]);
if (e == null || e.d < this.w3.left || e.d > this.w3.right || e.e < this.w3.top || e.e > this.w3.bottom) {
continue;
}
a.add(this.ace._inner[b]);
}
return a;
};
CalloutLayer.prototype.ac3 = function (a) {
return a.b.ao;
};
CalloutLayer.prototype.xt = function (a) {
if (!_super.prototype.xt.call(this, a)) {
return false;
}
if (this.aee != null) {
if (a.isFragment) {
var b = a.nh();
if (!Base.equalsStatic(this.aee, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aee, a.name)) {
return false;
}
}
}
return true;
};
CalloutLayer.prototype.qw = function () {
_super.prototype.qw.call(this);
if (!this.a1.c && !this.d4()) {
return;
}
if (this.abk) {
this.abk = false;
this.ae8();
this.ae3();
}
if (this.d4()) {
this.afc(this.xo, false);
}
else {
this.afc(this.xm, false);
}
};
CalloutLayer.prototype.ae4 = function () {
if (!this.abo) {
this.abo = true;
this.rz(true);
}
};
CalloutLayer.prototype.ae7 = function (a, b, c) {
var d = false;
if (this.abo) {
this.abo = false;
d = true;
}
a.km = this.aaj;
if (!a.gj && a.ed(this.acc, this.ab7, this.ab3, this.acz, false)) {
var e = this.acc;
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.ab8.containsKey(m)) {
m = this_1.ab8.item(m).c;
n = m.b;
o = d;
}
else {
o = true;
}
var p = n.ac;
var q = n.ad;
if (this_1.acw(p) != this_1.acw(g.d) && (!isNaN_(this_1.acw(p)) || !isNaN_(this_1.acw(g.d)))) {
n.xValue = g.d;
}
if (this_1.acw(q) != this_1.acw(g.e) && (!isNaN_(this_1.acw(q)) || !isNaN_(this_1.acw(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) {
var s = true;
if (this_1.calloutLabelUpdating != null) {
var t = ((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, t);
if (t.c != null && !Base.equalsStatic(t.c, m.b.ao)) {
s = false;
var u = t.c;
if (this_1.aaj != null) {
m.b.text = this_1.aaj.i(u);
}
else {
m.b.text = u != null ? u.toString() : "";
}
}
}
if (s) {
if (g.f != null) {
n.text = g.f;
}
}
}
if (n.ao == null) {
return "continue";
}
if (o || r) {
if (this_1.calloutContentUpdating != null) {
var v = ((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, v);
if (v.a != null && v.a != m.b.aa) {
m.b.content = v.a;
}
}
else {
if (i != null && i != m.b.aa) {
m.b.content = i;
}