UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

2,178 lines • 75.5 kB
/*
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.aav = true;
        _this.afu = new Size(1, 0, 0);
        _this.calloutStyleUpdating = null;
        _this.calloutRenderStyleUpdating = null;
        _this.aaj = null;
        _this.aak = null;
        _this.aal = null;
        _this.aai = null;
        _this.aah = null;
        _this.abh = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        _this.abk = new List$1(CalloutAnnotationWrapper.$, 0);
        _this.abl = new List$1(CalloutAnnotationWrapper.$, 0);
        _this.z8 = null;
        _this.zw = null;
        _this.aaf = null;
        _this.abi = new LinkedList$1(CalloutAnnotationWrapper.$);
        _this.abf = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
        _this.aar = null;
        _this.afs = new Rect(0, 0, 0, 1, 1);
        _this.aaz = false;
        _this.ab0 = 0;
        _this.afr = Rect.empty;
        _this.aax = false;
        _this.aay = false;
        _this.calloutContentUpdating = null;
        _this.calloutLabelUpdating = null;
        _this.calloutSeriesSelecting = null;
        _this.abj = new List$1(SeriesPointOfInterest.$, 0);
        _this.aa1 = false;
        _this.aa2 = false;
        _this.abn = 0;
        _this.aa0 = false;
        _this.zz = null;
        _this.aaw = true;
        _this.z0 = 1;
        FastItemObjectColumn.m();
        _this.zw = null;
        _this.z8 = new CalloutPlacementPositionsCollection();
        var a = _this.z8;
        a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.adv));
        _this.xj = true;
        var b = new CalloutLayerFrame();
        var c = new CalloutLayerFrame();
        var d = new CalloutLayerFrame();
        var e = _this.kc / 1000;
        _this.xb = b;
        _this.xa = c;
        _this.xc = d;
        _this.ab = CalloutLayer.$;
        return _this;
    }
    CalloutLayer.prototype.bj = function () {
        return new CalloutLayer();
    };
    CalloutLayer.prototype.get_eo = function () {
        return true;
    };
    CalloutLayer.prototype.adv = function (a, b) {
        this.ad4();
    };
    CalloutLayer.prototype.ad4 = function () {
        this.zw = this.zy(this.z9);
        this.ad1();
    };
    CalloutLayer.prototype.adw = function (a, b) {
        this.abl.clear();
        this.rq(false);
    };
    CalloutLayer.prototype.pa = function (a, b, c, d) {
        _super.prototype.pa.call(this, a, b, c, d);
        var e = this.abg();
        switch (a) {
            case 3:
                this.aea(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.aae;
                    this.abl.insert(f, h);
                    this.aea(f, e);
                }
                break;
            case 0:
                this.abl.v(b, c);
                break;
            case 2:
                for (var i = b; i < b + c; i++) {
                    this.aea(i, e);
                }
                break;
            case 4:
                this.abl.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.aae;
                    this.abl.add(l);
                    this.aea(j, e);
                }
                break;
        }
        this.rq(true);
    };
    CalloutLayer.prototype.ge = function (a) {
        return false;
    };
    CalloutLayer.prototype.afw = function () {
        var a = new Thickness(0, DeviceUtils.g(3));
        if (isNaN_(this.afv.left) || isNaN_(this.afv.top) || isNaN_(this.afv.right) || isNaN_(this.afv.bottom)) {
            a = new Thickness(0, DeviceUtils.g(3));
        }
        else {
            a = this.afv;
        }
        return a;
    };
    CalloutLayer.prototype.ws = function () {
        var a = 0;
        var b = 0;
        if (!this.aa3) {
            return new Size(1, b, a);
        }
        if (!this.aav) {
            return this.afu;
        }
        var c = "Ig";
        var d = this.afw();
        var e = this.z7.cr(c, d);
        if (!isNaN_(e.height)) {
            a = Math.max(e.height, a);
        }
        if (!isNaN_(this.abx)) {
            a += this.abx;
        }
        if (!isNaN_(this.abx)) {
            b += this.abx;
        }
        if (!isNaN_(this.abr)) {
            a = Math.max(a, this.abr);
        }
        if (!isNaN_(this.abp)) {
            a = Math.min(a, this.abp);
        }
        if (!isNaN_(this.abs)) {
            b = Math.max(b, this.abs);
        }
        if (!isNaN_(this.abq)) {
            b = Math.min(b, this.abq);
        }
        this.aav = false;
        this.afu = new Size(1, b, a);
        return this.afu;
    };
    CalloutLayer.prototype.abg = 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.aea = function (a, b) {
        var _this = this;
        if (this.aaq == null || this.aao == null) {
            return;
        }
        var c = a;
        if (this.aap != null) {
            c = this.aap.item(a);
        }
        var d = this.aaq.item(a);
        var e = this.aao.item(a);
        var f = this.abl._inner[a];
        if (this.aan != null) {
            if (f.b.ab != this.aan.item(a)) {
                f.b.key = this.aan.item(a);
            }
        }
        if (this.abf.containsKey(f)) {
            f.b = this.abf.item(f).c.b;
        }
        f.b.xValue = c;
        f.b.yValue = d;
        if (this.calloutLabelUpdating != null) {
            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.zz != null) {
                    f.b.text = this.zz.i(h);
                }
                else {
                    f.b.text = h != null ? h.toString() : "";
                }
            }
        }
        else {
            if (this.zz != null) {
                f.b.text = this.zz.i(e);
            }
            else {
                f.b.text = e != null ? e.toString() : "";
            }
        }
        if (this.aam != null) {
            f.b.content = this.aam.item(a);
        }
        else {
            f.b.content = this.dn.item(a);
        }
        if (this.calloutSeriesSelecting != null) {
            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.aeb(f);
    };
    CalloutLayer.prototype.aeb = function (a) {
        var b = new Thickness(0, DeviceUtils.g(3));
        if (isNaN_(this.afv.left) || isNaN_(this.afv.top) || isNaN_(this.afv.right) || isNaN_(this.afv.bottom)) {
            b = new Thickness(0, DeviceUtils.g(3));
        }
        else {
            b = this.afv;
        }
        var c = DeviceUtils.g(3);
        if (isNaN_(this.abo)) {
            c = DeviceUtils.g(3);
        }
        else {
            c = this.abo;
        }
        var d = this.afl != null && !this.abb ? this.afl : this.z7.cl(a.b.l, a.b.itemColor);
        var e = this.afq != null ? this.afq : null;
        var f = this.afo != null ? this.afo : this.z7.co();
        var g = this.afm != null ? this.afm : this.z7.cm();
        var h = this.afp != null && !this.abc ? this.afp : this.z7.cp(a.b.l, a.b.itemColor);
        var i = this.afn != null ? this.afn : this.z7.cn(a.b.l, a.b.itemColor);
        var j = isNaN_(this.aby) ? 0 : this.aby;
        if (e == null && (this.aa9 || this.afo != null || this.afm != 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.z7.co();
        }
        if (this.aa7 && 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.kp = function (a, b) {
        var c = this.nc(b);
        if (c == CalloutLayer.$$p[31]) {
            return this.kq(a, b, this.ada);
        }
        if (c == CalloutLayer.$$p[42]) {
            return this.kq(a, b, this.adq);
        }
        if (c == CalloutLayer.$$p[43]) {
            return this.kq(a, b, this.adt);
        }
        if (c == CalloutLayer.$$p[28]) {
            return this.kq(a, b, this.ac4);
        }
        if (c == CalloutLayer.$$p[22]) {
            return this.kq(a, b, this.acw);
        }
        return _super.prototype.kp.call(this, a, b);
    };
    CalloutLayer.prototype.mc = function (a) {
        var b = this.nc(a);
        if (b == CalloutLayer.$$p[31]) {
            return this.ada;
        }
        if (b == CalloutLayer.$$p[42]) {
            return this.adq;
        }
        if (b == CalloutLayer.$$p[43]) {
            return this.adt;
        }
        if (b == CalloutLayer.$$p[28]) {
            return this.ac4;
        }
        if (b == CalloutLayer.$$p[22]) {
            return this.acw;
        }
        return _super.prototype.mc.call(this, a);
    };
    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("LabelColumn", b, this.aaj);
            }
        },
        enumerable: false,
        configurable: true
    });
    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("XColumn", 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("YColumn", b, this.aal);
            }
        },
        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("KeyColumn", b, this.aai);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aam", {
        get: function () {
            return this.aah;
        },
        set: function (a) {
            if (this.aah != a) {
                var b = this.aah;
                this.aah = a;
                this.raisePropertyChanged("ContentColumn", b, this.aah);
            }
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.ady = function (a, b) {
        if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
            var c = a.k;
            if (!this.abh.contains(c)) {
                this.abh.add_1(c);
                this.abk.add(c);
                this.rq(false);
            }
        }
    };
    CalloutLayer.prototype.cs = function () {
        return new CalloutLayerView(this);
    };
    CalloutLayer.prototype.q0 = function (a) {
        _super.prototype.q0.call(this, a);
        this.z7 = a;
    };
    Object.defineProperty(CalloutLayer.prototype, "z9", {
        get: function () {
            return this.z8;
        },
        set: function (a) {
            var b = this.z9;
            if (a != b) {
                this.z8 = a;
                this.raisePropertyChanged("AllowedPositions", b, this.z9);
            }
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.gt = function (a) {
        if (this.aae == null) {
            return true;
        }
        if (this.aae == a) {
            return true;
        }
        return false;
    };
    Object.defineProperty(CalloutLayer.prototype, "z2", {
        get: function () {
            return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.aex));
        },
        set: function (a) {
            this.h(CalloutLayer.aex, enumGetBox(AutoCalloutVisibilityMode_$type, a));
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "z1", {
        get: function () {
            return this.z0;
        },
        set: function (a) {
            this.z0 = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "afv", {
        get: function () {
            return new Thickness(1, this.abu, this.abw, this.abv, this.abt);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aag", {
        get: function () {
            if (this.aaf == null) {
                this.aaf = FontUtil.toFontInfo(this.jy, this.adg);
            }
            return this.aaf;
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.yo = function (a, b) {
        if (this.aae == null || this.aae == a) {
            if (!this.a1.c) {
                this.rq(b);
            }
        }
    };
    CalloutLayer.prototype.yq = function (a, b) {
        var e_1, _a;
        var _this = this;
        _super.prototype.yq.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.abm();
        var e = new List$1(CalloutAnnotationWrapper.$, 0);
        var f = Number.POSITIVE_INFINITY;
        var g = true;
        if (this.aa4) {
            if (this.xh(this.aae)) {
                if (typeCast(IHasCategoryAxis_$type, this.aae) !== null) {
                    var h = this.aae.getCategoryWidth();
                    if (!isNaN_(h) && !isInfinity(h) && h > 0) {
                        f = Math.min(f, h);
                    }
                }
                this.ad6(this.aae, 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.xh(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.aad == 0 || this.aad == 3 || this.aad == 2) {
                                if (this.aad == 0 || this.aad == 2) {
                                    k = true;
                                }
                                i.p0(function (l) {
                                    _this.ad6(l, c, e);
                                    return true;
                                });
                            }
                            if (!k) {
                                this.ad6(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.aa4 && this.z1 == 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.ad5(c, d, e);
    };
    CalloutLayer.prototype.sq = function (a, b) {
        _super.prototype.sq.call(this, a, b);
        var c = b.width - this.afs.width;
        var d = b.height - this.afs.height;
        var e = 0;
        if (Math.abs(c) > Math.abs(d)) {
            e = c;
            this.abn = c * this.wr.width;
        }
        else {
            e = d;
            this.abn = d * this.wr.height;
        }
        if (e > 0 && this.abn > 5) {
            this.aa2 = true;
        }
        if (e < 0 && this.abn > 5) {
            this.aa1 = true;
        }
    };
    CalloutLayer.prototype.sp = function (a, b) {
        _super.prototype.sp.call(this, a, b);
        if (!a.equals1(b)) {
            this.aa0 = true;
        }
    };
    Object.defineProperty(CalloutLayer.prototype, "aft", {
        get: function () {
            return this.afr;
        },
        set: function (a) {
            this.afr = a;
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.ad5 = function (a, b, c) {
        var e_2, _a;
        if (this.db != null) {
            this.afs = this.db.v4;
        }
        if (this.wr.isEmpty) {
            return;
        }
        this.aft = new Rect(0, this.wr.left, this.wr.top, this.wr.width, this.wr.height);
        if (this.aar != null && this.act != null && this.act != this.aar.bd) {
            this.ad0();
        }
        if (this.aar != null && this.aar.j != this.aat()) {
            this.ad0();
        }
        if (this.aar == null) {
            var d = this.aas();
            if (d != null) {
                this.aar = d;
                var e = this.aar;
                e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.adx));
            }
            else {
                var f = this.wi(this.cv);
                var g = new Array(2);
                g[0] = 0;
                g[1] = 3;
                if (this.aae != null) {
                    if (this.aae.isVertical) {
                        g = new Array(2);
                        g[0] = 2;
                        g[1] = 1;
                    }
                }
                else {
                    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.z4 == 4 || this.z4 == 6) {
                    g = new Array(4);
                    g[0] = 10;
                    g[1] = 11;
                    g[2] = 8;
                    g[3] = 9;
                }
                if (this.z4 == 5) {
                    g = new Array(4);
                    g[0] = 9;
                    g[1] = 10;
                    g[2] = 11;
                    g[3] = 8;
                }
                if (this.z4 == 7) {
                    g = new Array(4);
                    g = new Array(4);
                    g[0] = 8;
                    g[1] = 10;
                    g[2] = 11;
                    g[3] = 9;
                }
                this.aar = new LabelCollisionManager(this.wr.right, this.wr.bottom, this.wr, this.z7.j(), this.abx, this.aat(), g, this.ab4(), this.ab3(), this.aa5, this.zw);
                this.aar.v = this.aa8;
                if (this.act != null) {
                    this.aar.bd = this.act;
                    this.aar.bb = this;
                }
                var j = this.aar;
                j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.adx));
            }
        }
        if (this.aa1) {
            this.aa1 = false;
            if (this.aar.a9 > 2) {
                this.aaz = true;
            }
        }
        if (this.aa2) {
            this.aa2 = false;
            if (this.abn > 5) {
                this.aaz = true;
            }
        }
        if (this.aa0) {
            this.aa0 = false;
            this.aar.bs(this.wr.right, this.wr.bottom, this.wr);
            this.aaz = true;
        }
        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.abi.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.ady));
                this.abi.h(r);
                this.abf.removeItem(r.c);
                this.aar.br(r.c.c);
            }
            r = s;
        }
        for (var u = 0; u < b.count; u++) {
            if (!this.abf.containsKey(b._inner[u])) {
                this.abi.f(b._inner[u]);
                var v = b._inner[u].b;
                v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.ady));
                this.abf.addItem(b._inner[u], this.abi.d);
                m.add(b._inner[u]);
                k.add_1(b._inner[u]);
                this.aaz = true;
            }
        }
        for (var w = 0; w < c.count; w++) {
            if (!this.abf.containsKey(c._inner[w])) {
                this.abi.f(c._inner[w]);
                this.abf.addItem(c._inner[w], this.abi.d);
                var x = c._inner[w].b;
                x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.ady));
                m.add(c._inner[w]);
                k.add_1(c._inner[w]);
                this.aaz = true;
            }
        }
        if (this.aax == true) {
            this.aax = false;
            this.aaz = true;
        }
        var y = false;
        if (this.abk.count > 0) {
            y = true;
            this.abk.clear();
            this.abh.clear();
        }
        r = this.abi.c;
        while (r != null) {
            var z = this.aau(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.aar.ad(ab, false);
                    }
                    if (aa) {
                        this.aar.be(ab);
                    }
                    else {
                        this.aar.bo(ab);
                    }
                }
            }
            r = r.a;
        }
        var ac = this.aar.ba();
        var ad = this.aar.af();
        if (!this.aaz && y && (ac != 0 || ad)) {
            {
                this.aaz = true;
            }
        }
        if (ad) {
            if (this.aar.x()) {
                this.aaz = true;
            }
        }
        if (this.aaz && (ac != 0 || ad)) {
            this.aaz = false;
            this.ab0 = 0x7FFFFFFF;
            if (this.act != null) {
                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.act == this.act) {
                            if (!ah.aft.equals1(this.aar.b0)) {
                                ae = false;
                                break;
                            }
                        }
                    }
                }
                if (ae) {
                    this.aar.bv();
                }
                else {
                    this.aar.bf();
                    this.aar.bg();
                }
            }
            else {
                this.aar.bv();
            }
        }
        else {
            this.aar.bg();
        }
        var ai = this.abi.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.aa6;
        var a0 = this.aa8;
        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.aar.ab(a4.c)) {
                    a5 = true;
                }
            }
            if (a2.c.h && !a5) {
                av = NaN;
                aw = NaN;
            }
            if (!a2.c.h && (a2.c.b == 8 || a2.c.b == 9)) {
                al = a1;
                av = a4.k;
                aw = a4.l;
            }
            if (a5) {
                at = this.adi(a2, at);
                var a6 = this.aar.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.adi = function (a, b) {
        var c = Math.max(this.aar.as(a.c.c), this.aar.at(a.c.c));
        if (c <= 0) {
            return b;
        }
        var d = b.length;
        var e = this.z7.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.z7.cr(b, a.b.backgroundPadding);
            f = e.width;
        }
        return b;
    };
    CalloutLayer.prototype.ad0 = function () {
        if (this.aar != null) {
            var a = this.abi.c;
            while (a != null) {
                var b = a.c.c;
                if (b != null) {
                    this.aar.br(b);
                }
                a = a.a;
            }
            var c = this.aar;
            c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.adx));
            this.aar = null;
        }
        this.adz();
    };
    CalloutLayer.prototype.aas = 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.act != null && c.act == this.act) {
                        if (c.aar != null) {
                            return c.aar;
                        }
                    }
                }
            }
        }
        return null;
    };
    CalloutLayer.prototype.ab3 = function () {
        return 20000;
    };
    CalloutLayer.prototype.ab4 = function () {
        return 300;
    };
    CalloutLayer.prototype.aat = function () {
        switch (this.z4) {
            case 0: return 2;
            case 2: return 1;
            case 3: return 2;
            case 1: return 0;
            case 4: return 3;
            case 7: return 7;
            case 5: return 5;
            case 6: return 6;
        }
        return 2;
    };
    CalloutLayer.prototype.adx = function (a) {
        var b = this.aar.ba();
        var c = this.ab0;
        if (b < this.ab0) {
            this.ab0 = b;
            if (c != 0x7FFFFFFF) {
                this.rq(false);
            }
        }
    };
    CalloutLayer.prototype.aau = function (a) {
        var b = this.aae;
        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.ix();
        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.abz(a.b.ac), m) + k;
            p = h.el(this.abz(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.abz(a.b.ac), m) + k;
            p = h.el(this.abz(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.abz = function (a) {
        if (typeCast(Date_$type, a) !== null) {
            return a.getTime();
        }
        if (a == null) {
            return 0;
        }
        return a;
    };
    CalloutLayer.prototype.abm = function () {
        var a = new List$1(CalloutAnnotationWrapper.$, 0);
        for (var b = 0; b < this.abl.count; b++) {
            if (stringIsNullOrEmpty(this.abl._inner[b].b.ao)) {
                continue;
            }
            if (this.abl._inner[b].c == null) {
                var c = new LabelCollisionInfo();
                this.abl._inner[b].c = c;
                var d = this.z7.cr(this.ab5(this.abl._inner[b]), this.abl._inner[b].b.backgroundPadding);
                c.o = d.height / 2;
                c.p = d.width / 2;
            }
            var e = this.aau(this.abl._inner[b]);
            if (e == null || e.d < this.wr.left || e.d > this.wr.right || e.e < this.wr.top || e.e > this.wr.bottom) {
                continue;
            }
            a.add(this.abl._inner[b]);
        }
        return a;
    };
    CalloutLayer.prototype.ab5 = function (a) {
        return a.b.ao;
    };
    CalloutLayer.prototype.xh = function (a) {
        if (!_super.prototype.xh.call(this, a)) {
            return false;
        }
        if (this.add != null) {
            if (a.isFragment) {
                var b = a.nb();
                if (!Base.equalsStatic(this.add, b)) {
                    return false;
                }
            }
            else {
                if (!Base.equalsStatic(this.add, a.name)) {
                    return false;
                }
            }
        }
        return true;
    };
    CalloutLayer.prototype.qo = function () {
        _super.prototype.qo.call(this);
        if (!this.a1.c && !this.d3()) {
            return;
        }
        if (this.aaw) {
            this.aaw = false;
            this.ad7();
            this.ad2();
        }
        if (this.d3()) {
            this.ad9(this.xc, false);
        }
        else {
            this.ad9(this.xa, false);
        }
    };
    CalloutLayer.prototype.ad3 = function () {
        if (!this.aay) {
            this.aay = true;
            this.rq(true);
        }
    };
    CalloutLayer.prototype.ad6 = function (a, b, c) {
        var d = false;
        if (this.aay) {
            this.aay = false;
            d = true;
        }
        a.kh = this.zz;
        if (!a.gh && a.eb(this.abj, this.abe, this.aba, this.ab1, false)) {
            var e = this.abj;
            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.abf.containsKey(m)) {
                    m = this_1.abf.item(m).c;
                    n = m.b;
                    o = d;
                }
                else {
                    o = true;
                }
                var p = n.ac;
                var q = n.ad;
                if (this_1.abz(p) != this_1.abz(g.d) && (!isNaN_(this_1.abz(p)) || !isNaN_(this_1.abz(g.d)))) {
                    n.xValue = g.d;
                }
                if (this_1.abz(q) != this_1.abz(g.e) && (!isNaN_(this_1.abz(q)) || !isNaN_(this_1.abz(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.zz != null) {
                                m.b.text = this_1.zz.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.aeb(m);
                }
                if (m.c == null) {
                    var v = new LabelCollisionInfo();
                    m.c = v;
                    var w = this_1.z7.cr(this_1.ab5(m), m.b.backgroundPadding);
                    v.o = w.height / 2;
                    v.p = w.width / 2;
                }
                var x = this_1.aau(m);
                if (x == null || x.d < this_1.wr.left || x.d > this_1.wr.right || x.e < this_1.wr.top || x.e > this_1.wr.bottom) {
                    return "continue";
                }
                m.e = x.d;
                m.f = x.e;
                if (g.a != null) {
                    m.c.a = g.a;
                }
                c.add(m);
            };
            var this_1 = this;
            for (var f = 0; f < this.abj.count; f++) {
                _loop_1(f);
            }
        }
        a.kh = null;
    };
    CalloutLayer.prototype.b2 = function () {
        return 1;
    };
    CalloutLayer.prototype.a2 = function (a, b) {
        var c = this.aar.i(a, b);
        if (c == null) {
            return null;
        }
        return c.y;
    };
    CalloutLayer.prototype.gv = function (a, b) {
        if (this.aar == null) {
            return false;
        }
        return this.aar.i(a, b) != null;
    };
    CalloutLayer.prototype.ad9 = function (a, b) {
        var e_3, _a;
        var c = 0;
        var d = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        for (c = 0; c < a.q.count; c++) {
            var e = a.n._inner[c];
            if (isNaN_(a.u._inner[c]) || isNaN_(a.v._inner[c])) {
                continue;
            }
            var f = this.z7.cb.item(e);
            d.add_1(e);
            if (f.h != a.q._inner[c]) {
                f.h = a.q._inner[c];
                var g = f.u();
            }
            f.e = a.o._inner[c];
            f.m = a.f._inner[c];
            f.p = a.p._inner[c];
            f.o = f.e > 0 ? a.i._inner[c] : this.cv.bt();
            f.n = a.h._inner[c];
            f.x = new Thickness(1, a.k._inner[c], a.m._inner[c], a.l._inner[c], a.j._inner[c]);
            f.d = a.g._inner[c];
            this.z7.cj(f, Math.min(a.s._inner[c], a.s._inner[c] + a.u._inner[c]), Math.min(a.t._inner[c], a.t._inner[c] + a.v._inner[c]));
            this.z7.ck(f, e, a.r._inner[c]);
            f.r = { $type: Point_$type, x: a.u._inner[c], y: a.v._inner[c] };
        }
        var h = new List$1(CalloutAnnotationWrapper.$, 0);
        try {
            for (var _b = __values(fromEnum(this.z7.cb.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var i = _c.value;
                if (!d.contains(i)) {
                    h.add(i);
                }
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        for (var j = 0; j < h.count; j++) {
            this.z7.cb.h(h._inner[j]);
        }
    };
    CalloutLayer.prototype.yt = function (a, b) {
        _super.prototype.yt.call(this, a, b);
        if (this.d3()) {
            this.ad9(this.xc, true);
        }
        else {
            this.ad9(this.xa, false);
        }
    };
    CalloutLayer.prototype.f9 = function () {
        return true;
    };
    CalloutLayer.prototype.q8 = function (a, b, c, d) {
        _super.prototype.q8.call(this, a, b, c, d);
        switch (b) {
            case CalloutLayer.$$p[35]:
                this.aaf = null;
                this.z7.ci();
                this.rq(true);
                break;
            case CalloutLayer.$$p[33]:
            case CalloutLayer.$$p[34]:
                this.rq(true);
                break;
            case CalloutLayer.$$p[29]:
            case CalloutLayer.$$p[30]:
                if (this.ac7 != null) {
                    this.zz = new BindingFormatter();
                    this.zz.j = this.ac7;
                    this.zz.d = this.zx;
                }
                else {
                    this.zz = null;
                }
                break;
            case CalloutLayer.$$p[21]:
            case CalloutLayer.$$p[23]:
                this.rq(true);
                break;
            case "SeriesViewer":
                if (c != null) {
                    var e = c;
                    e.seriesAnimating = delegateRemove(e.seriesAnimating, runOn(this, this.ad8));
                }
                if (d != null) {
                    var f = d;
                    f.seriesAnimating = delegateCombine(f.seriesAnimating, runOn(this, this.ad8));
                }
                if (d == null) {
                    this.ad0();
                }
                break;
            case "AutoCalloutVisibilityMode":
                this.z1 = this.z3();
                this.ad1();
                break;
            case "AllowedPositions":
                if (c != null) {
                    var g = c;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.adv));
                }
                if (d != null) {
                    var h = d;
                    h.collectionChanged = delegateCombine(h.collectionChanged, runOn(this, this.adv));
                }
                this.zw = this.zy(this.z9);
                this.ad1();
                break;
            case CalloutLayer.$$p[24]:
            case CalloutLayer.$$p[25]:
            case CalloutLayer.$$p[1]:
            case CalloutLayer.$$p[13]:
            case CalloutLayer.$$p[11]:
            case CalloutLayer.$$p[37]:
            case CalloutLayer.$$p[40]:
            case CalloutLayer.$$p[27]:
            case CalloutLayer.$$p[26]:
            case CalloutLayer.$$p[15]:
            case CalloutLayer.$$p[17]:
            case CalloutLayer.$$p[16]:
            case CalloutLayer.$$p[14]:
            case "Visibility":
            case CalloutLayer.$$p[18]:
            case CalloutLayer.$$p[5]:
            case CalloutLayer.$$p[8]:
            case CalloutLayer.$$p[6]:
            case CalloutLayer.$$p[9]:
            case CalloutLayer.$$p[7]:
                this.aav = true;
                this.ad1();
                break;
            case CalloutLayer.$$p[19]:
            case CalloutLayer.$$p[20]:
            case CalloutLayer.$$p[2]:
                this.ad1();
                break;
            case CalloutLayer.$$p[32]:
                this.ad1();
                if (this.aar != null) {
                    this.aar.v = d;
                }
                break;
            case CalloutLayer.$$p[31]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.aao);
                    this.aao = this.dm(this.ada);
                }
                break;
            case "LabelColumn":
                this.ad1();
                break;
            case CalloutLayer.$$p[22]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.aam);
                    this.aam = this.dm(this.acw);
                }
                break;
            case "ContentColumn":
                this.ad1();
                break;
            case CalloutLayer.$$p[42]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.aap);
                    this.aap = stringIsNullOrEmpty(this.adq) == false ? this.dm(this.adq) : null;
                }
                break;
            case "XColumn":
                this.ad1();
                break;
            case CalloutLayer.$$p[43]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.aaq);
                    this.aaq = this.dm(this.adt);
                }
                break;
            case "YColumn":
                this.ad1();
                break;
            case CalloutLayer.$$p[28]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.aan);
                    this.aan = this.dm(this.ac4);
                }
                break;
            case "KeyColumn":
                this.ad1();
                break;
            case "FastItemsSource":
                this.aax = true;
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.aao);
                    c.deregisterColumn(this.aam);
                    c.deregisterColumn(this.aap);
                    c.deregisterColumn(this.aaq);
                    c.deregisterColumn(this.aan);
                    this.aao = null;
                    this.aam = null;
                    this.aap = null;
                    this.aaq = null;
                    this.aan = null;
                    this.abl.clear();
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.aao = this.dm(this.ada);
                    this.aam = this.dm(this.acw);
                    if (stringIsNullOrEmpty(this.adq) == false) {
                        this.aap = this.dm(this.adq);
                    }
                    this.aaq = this.dm(this.adt);
                    this.aan = this.dm(this.ac4);
                }
                this.ad1();
                break;
        }
    };
    CalloutLayer.prototype.z3 = function () {
        if (this.z2 == 0) {
            return 1;
        }
        return this.z2;
    };
    CalloutLayer.prototype.zy = function (a) {
        if (a == null || a.count == 0) {
            return null;
        }
        var b = new Array(a.count);
        for (var c = 0; c < a.count; c++) {
            b[c] = a._inner[c];
        }
        return b;
    };
    CalloutLayer.prototype.ad8 = function (a) {
        if (a.es) {
            return;
        }
        if ((a == this.aae || this.aae == null) && this.aa4) {
            this.rq(false);
        }
    };
    CalloutLayer.prototype.ad1 = function () {
        if (this.aaw == false) {
            this.aaw = true;
            this.rq(false);
        }
    };
    CalloutLayer.prototype.ax = function (a, b, c) {
        var d = this.getEffectiveViewport();
        var e = this.db.wk;
        var f = this.ws();
        var g = 0;
        if (b.cp) {
            var h = new ScalerParams(0, c, e, !b.ch, d);
            var i = b.eo(0, h);
            var j = b.eo(f.height, h);
            g = Math.abs(j - i);
            return new AxisRange(a.c - g, a.b + g);
        }
        else {
            var k = new ScalerParams(0, c, e, b.ch, d);
            var l = b.eo(0, k);
            var m = b.eo(f.width, k);
            g = Math.abs(m - l);
            return new AxisRange(a.c - g, a.b + g);
        }
    };
    CalloutLayer.prototype.ad7 = function () {
        var e_4, _a;
        if (!this.aa3) {
            return;
        }
        if (this.c9 == null) {
            return;
        }
        var a = this.c9.series;
        if (a == null) {
            return;
        }
        var b = this.c9.axes;
        if (b == null) {
            return;
        }
        try {
            for (var _b = __values(fromEnum(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.hl();
                c.c2(true);
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
    };
    CalloutLayer.prototype.adz = function () {
        this.z7.cb.clear();
        this.abi.g();
        this.abf.clear();
    };
    CalloutLayer.prototype.ad2 = function () {
        if (this.aaq == null || this.aao == null) {
            var a = this.abi.c;
            while (a != null) {
                this.aeb(a.c);
                a = a.a;
            }
            return;
        }
        var b = this.abg();
        for (var c = 0; c < this.aaq.count; c++) {
            var d = void 0;
            if (this.abl.count <= c) {
                var e = new CalloutAnnotation();
                d = new CalloutAnnotationWrapper();
                d.b = e;
                d.b.series = this.aae;
                this.abl.add(d);
            }
            else {
                d = this.abl._inner[c];
            }
            this.aea(c, b);
        }
    };
    CalloutLayer.$t = markType(CalloutLayer, 'CalloutLayer', AnnotationLayer.$);
    CalloutLayer.aex = DependencyProperty.i("AutoCalloutVisibilityMode", AutoCalloutVisibilityMode_$type, CalloutLayer.$, new PropertyMetadata(2, enumGetBox(AutoCalloutVisibilityMode_$type, 0), function (a, b) { return a.raisePropertyChanged("AutoCalloutVisibilityMode", b.oldValue, b.newValue); }));
    CalloutLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CalloutLayer, 'raisePropertyChanged', ['AutoCalloutLabelPrecision:ab1:aec', [1, 5], 'CalloutBackground:afl:aed', [Brush.$, null], 'CalloutCollisionMode:z4:aee', [CalloutCollisionMode_$type, enumGetBox(CalloutCollisionMode_$type, 3)], 'CalloutCornerRadius:abo:aef', [1, NaN], 'CalloutDarkTextColor:afm:aeg', [Brush.$, null], 'CalloutExpandsAxisBufferEnabled:aa3:aeh', [0, false], 'CalloutExpandsAxisBufferMaxHeight:abp:aei', [1, 400], 'CalloutExpandsAxisBufferMaxWidth:abq:aej', [1, 400], 'CalloutExpandsAxisBufferMinHeight:abr:aek', [1, 50], 'CalloutExpandsAxisBufferMinWidth:abs:ael', [1, 50], 'CalloutInterpolatedValuePrecision:ab2:aem', [1, -1], 'CalloutLeaderBrush:afn:aen', [Brush.$, null], 'CalloutLightTextColor:afo:aeo', [Brush.$, null], 'CalloutOutline:afp:aep', [Brush.$, null], 'CalloutPaddingBottom:abt:aeq', [1, NaN], 'CalloutPaddingLeft:abu:aer', [1, NaN], 'CalloutPaddingRight:abv:aes', [1, NaN], 'CalloutPaddingTop:abw:aet', [1, NaN], 'CalloutPositionPadding:abx:aeu', [1, 10], 'CalloutStrokeThickness:aby:aev', [1, NaN], 'CalloutTextColor:afq:aew', [Brush.$, null], 'CollisionChannel:act:aey', [2, null], 'ContentMemberPath:acw:aez', [2, null], 'HighlightedValueLabelMode:aad:ae0', [HighlightedValueLabelMode_$type, enumGetBox(HighlightedValueLabelMode_$type, 0)], 'IsAutoCalloutBehaviorEnabled:aa4:ae1', [0, false], 'IsCalloutOffsettingEnabled:aa5:ae2', [0, true], 'IsCustomCalloutRenderStyleEnabled:aa6:ae3', [0, false], 'IsCustomCalloutStyleEnabled:aa7:ae4', [0, false], 'KeyMemberPath:ac4:ae5', [2, null], 'LabelFormat:ac7:ae6', [2, null], 'LabelFormatSpecifiers:zx:ae7', [Array_$type, null], 'LabelMemberPath:ada:ae8', [2, null], 'ShouldTruncateOnBoundaryCollisions:aa8:ae9', [0, false], 'TargetSeriesName:add:afa', [2, null], 'TargetSeries:aae:afb', [Series.$, null], 'TextStyle:adg:afc', [2, null], 'UseAutoContrastingLabelColors:aa9:afd', [0, false], 'UseInterpolatedValueForAutoCalloutLabels:aba:afe', [0, false], 'UseItemColorForFill:abb:aff', [0, false], 'UseItemColorForOutline:abc:afg', [0, false], 'UseSeriesColorForOutline:abd:afh', [0, false], 'UseValueForAutoCalloutLabels:abe:afi', [0, true], 'XMemberPath:adq:afj', [2, null], 'YMemberPath:adt:afk', [2, null]]);
    return CalloutLayer;
}(AnnotationLayer));
export { CalloutLayer };
/**
 * @hidden
 */
var CalloutLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CalloutLayerView, _super);
    function CalloutLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.b7 = null;
        _this.cc = null;
        _this.cb = null;
        _this.cd = NaN;
        _this.b8 = null;
        _this.b7 = a;
        _this.cc = new List$1(CalloutView.$, 0);
        return _this;
    }
    CalloutLayerView.prototype.au = function () {
        var _this = this;
        _super.prototype.au.call(this);
        this.cb = ((function () {
            var $ret = new HashPool$2(CalloutAnnotationWrapper.$, CalloutView.$);
            $ret.create = runOn(_this, _this.b9);
            $ret.activate = runOn(_this, _this.cf);
            $ret.disactivate = runOn(_this, _this.ch);
            $ret.destroy = runOn(_this, _this.cg);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.b9 = function () {
        var a = new CalloutView(this);
        this.cc.add(a);
        return a;
    };
    CalloutLayerView.prototype.cf = function (a) {
        a.y = 0;
    };
    CalloutLayerView.prototype.ch = function (a) {
        a.y = 1;
    };
    CalloutLayerView.prototype.cg = function (a) {
        this.cc.remove(a);
    };
    CalloutLayerView.prototype.cq = function (a) {
        if (a == null) {
            return a;
        }
        return BrushUtil.m(a, 0.1);
    };
    CalloutLayerView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        a.ad(this.ca());
        if (a.d && !b) {
            for (var c = 0; c < this.cc.count; c++) {
                var d = this.cc._inner[c];
                if (d.y == 0) {
                    d.j(a);
                }
            }
        }
    };
    CalloutLayerView.prototype.ca = function () {
        if (this.b7.aag != null) {
            return this.b7.aag;
        }
        return this.e.db.getFontInfo();
    };
    CalloutLayerView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        for (var b = 0; b < this.cc.count; b++) {
            var c = this.cc._inner[b];
            if (c.y != 0) {
                continue;
            }
            c.i(this.b7, this.ca(), a);
        }
    };
    CalloutLayerView.prototype.cs = function (a) {
        this.k.ad(this.ca());
        this.cd = this.ce();
        var b = this.k.ah(a, this.cd, true);
        return new Size(1, b.c, b.b);
    };
    CalloutLayerView.prototype.ce = function () {
        var a = this.ca();
        if (isNaN_(this.cd)) {
            var b = FontUtil.getCurrentFontHeight(this.e.db.c9.j.ae, a);
            this.cd = b;
        }
        return this.cd;
    };
    CalloutLayerView.prototype.cr = function (a, b) {
        if (this.b8 == null) {
            this.b8 = new CalloutView(this);
        }
        this.b8.h = a;
        this.b8.x = b;
        var c = this.b8.u();
        this.b8.h = null;
        return c;
    };
    CalloutLayerView.prototype.cj = function (a, b, c) {
        a.f = b;
        a.g = c;
    };
    CalloutLayerView.prototype.ck = function (a, b, c) {
        a.k(this.e, b, c);
    };
    CalloutLayerView.prototype.cl = function (a, b) {
        if (b != null && this.b7.abb) {
            return this.cq(b);
        }
        if (a != null) {
            return this.cq(a.vf);
        }
        return this.e.vf;
    };
    CalloutLayerView.prototype.co = function () {
        return ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 255, 255, 255);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.cm = function () {
        return ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 0, 0, 0);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.cp = function (a, b) {
        if (b != null && this.b7.abc) {
            return this.cq(b);
        }
        if (this.b7.abd) {
            if (a != null) {
                return this.cq(a.vf);
            }
        }
        return ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 255, 255, 255);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.cn = function (a, b) {
        if (b != null && this.b7.abc) {
            return this.cq(b);
        }
        if (a != null) {
            return this.cq(a.u8);
        }
        return this.e.u8;
    };
    CalloutLayerView.prototype.ci = function () {
        this.cd = NaN;
    };
    CalloutLayerView.$t = markType(CalloutLayerView, 'CalloutLayerView', AnnotationLayerView.$);
    return CalloutLayerView;
}(AnnotationLayerView));
export { CalloutLayerView };
/**
 * @hidden
 */
var CalloutView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CalloutView, _super);
    function CalloutView(a) {
        var _this = _super.call(this) || this;
        _this.a = null;
        _this.y = 0;
        _this.l = null;
        _this.t = null;
        _this.q = { $type: Point_$type, x: 0, y: 0 };
        _this.s = null;
        _this.w = new Thickness(0, 0);
        _this.v = null;
        _this.c = 0;
        _this.f = 0;
        _this.g = 0;
        _this.b = null;
        _this.s = new Line();
        _this.s.ab = false;
        _this.s._stroke = ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 0, 0, 0);
            return $ret;
        })());
        _this.s.ad = 2;
        _this.l = new TextBlock();
        _this.t = new Rectangle();
        _this.t.ad = 0;
        _this.a = a;
        _this.y = 0;
        return _this;
    }
    CalloutView.prototype.j = function (a) {
        a.aa();
        a.ag(this.f, this.g);
        var b = new TranslateTransform();
        b.j = this.v.left;
        b.k = this.v.top;
        this.t.j = b;
        a.s(this.s);
        a.aa();
        this.t.width = this.l.m + this.w.left + this.w.right;
        this.t.height = this.l.l + this.w.top + this.w.bottom;
        this.t.ap = this.c;
        this.t.aq = this.c;
        a.k(this.t.j);
        a.w(this.t);
        this.l.ag = true;
        this.l.o = this.w.top;
        this.l.n = this.w.left;
        a.x(this.l);
        a.z();
        a.z();
    };
    Object.defineProperty(CalloutView.prototype, "r", {
        get: function () {
            return this.q;
        },
        set: function (a) {
            if (this.q.x != a.x || this.q.y != a.y) {
                var b = this.u();
                var c = b.height;
                var d = b.width;
                this.q = a;
                var e = CalloutViewHelper.b(this.r, d, c, this.s);
                this.v = e;
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "p", {
        get: function () {
            return this.l.ao;
        },
        set: function (a) {
            this.l.ao = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "o", {
        get: function () {
            return this.t._stroke;
        },
        set: function (a) {
            this.t._stroke = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "n", {
        get: function () {
            return this.s._stroke;
        },
        set: function (a) {
            this.s._stroke = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "m", {
        get: function () {
            return this.t._fill;
        },
        set: function (a) {
            this.t._fill = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "e", {
        get: function () {
            return this.t.ad;
        },
        set: function (a) {
            this.t.ad = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "x", {
        get: function () {
            return this.w;
        },
        set: function (a) {
            this.w = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "d", {
        get: function () {
            return this.c;
        },
        set: function (a) {
            this.c = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "h", {
        get: function () {
            return this.l.al;
        },
        set: function (a) {
            if (a == null) {
                this.l.al = "";
            }
            else {
                this.l.al = a.toString();
            }
            var b = this.u();
            var c = b.height;
            var d = b.width;
            var e = CalloutViewHelper.b(this.r, d, c, this.s);
            this.v = e;
        },
        enumerable: false,
        configurable: true
    });
    CalloutView.prototype.u = function () {
        var a = this.a.cs(this.l);
        this.l.m = a.width;
        this.l.l = a.height;
        return new Size(1, a.width + this.w.left + this.w.right, a.height + this.w.top + this.w.bottom);
    };
    CalloutView.prototype.k = function (a, b, c) {
        if (this.b == null) {
            this.b = new DataContext();
        }
        this.b.series = a;
        this.b.item = c;
        if (b.c != null) {
            b.c.y = this.b;
        }
    };
    CalloutView.prototype.i = function (a, b, c) {
        a.bc.exportCalloutData(this.f, this.g, this.v.left, this.v.top, c, this.t, this.l, b, this.s, "callout", ["Main", "Callout"]);
    };
    CalloutView.$t = markType(CalloutView, 'CalloutView');
    return CalloutView;
}(Base));
export { CalloutView };