UNPKG

igniteui-angular-charts

Version:

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

2,336 lines 80.1 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 { MarkerSeries } from "./MarkerSeries";
import { ISupportsErrorBars_$type } from "./ISupportsErrorBars";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { ScatterAxisInfoCache } from "./ScatterAxisInfoCache";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-angular-core";
import { NumericYAxis } from "./NumericYAxis";
import { Series } from "./Series";
import { TrendLineType_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { ScatterErrorBarSettings } from "./ScatterErrorBarSettings";
import { HighlightingInfo } from "igniteui-angular-core";
import { ScatterFrame } from "./ScatterFrame";
import { Base, runOn, delegateCombine, enumGetBox, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, PointUtil } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { Clipper } from "igniteui-angular-core";
import { OwnedPoint } from "./OwnedPoint";
import { Dictionary$2 } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { CoreGeometryUtil } from "igniteui-angular-core";
import { GeometryUtil } from "igniteui-angular-core";
import { HashPool$2 } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { Thickness } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { AssigningScatterStyleEventArgs } from "./AssigningScatterStyleEventArgs";
import { AssigningScatterMarkerStyleEventArgs } from "./AssigningScatterMarkerStyleEventArgs";
import { ChartSelection } from "./ChartSelection";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { ErrorBarsHelper } from "./ErrorBarsHelper";
import { PathGeometry } from "igniteui-angular-core";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { boxArray$1, arrayShallowClone } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { DataTemplateMeasureInfo } from "igniteui-angular-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var ScatterBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterBase, _super);
    function ScatterBase() {
        var _this = _super.call(this) || this;
        _this.zh = null;
        _this.z0 = null;
        _this.z1 = null;
        _this.ac6 = null;
        _this.ac7 = null;
        _this.zq = 1;
        _this.y7 = null;
        _this.y8 = null;
        _this.zn = null;
        _this.zp = null;
        _this.zl = null;
        _this.z6 = false;
        _this.z5 = false;
        _this.zy = null;
        _this.zz = null;
        _this.assigningScatterStyle = null;
        _this.assigningScatterMarkerStyle = null;
        _this.zu = null;
        _this.zo = null;
        _this.zk = null;
        _this.z4 = true;
        _this.aaj = 0;
        _this.aak = 0;
        _this.aal = 0;
        _this.aam = 0;
        _this.zr = _this.zs();
        _this.zu = new ScatterSeriesRenderManager();
        _this.zo = new ScatterFrame();
        _this.ac7 = Rect.empty;
        _this.ac6 = Rect.empty;
        return _this;
    }
    ScatterBase.prototype.ct = function () {
        return new ScatterBaseView(this);
    };
    ScatterBase.prototype.pf = function () {
        _super.prototype.pf.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    ScatterBase.prototype.rh = function (a) {
        _super.prototype.rh.call(this, a);
        this.zi = a;
    };
    ScatterBase.prototype.get_fz = function () {
        return true;
    };
    ScatterBase.prototype.ai = function () {
        return [this.xAxis, this.yAxis];
    };
    ScatterBase.prototype.kz = function (a, b) {
        var c = this.no(b);
        if (c == ScatterBase.$$p[12]) {
            return this.k0(a, b, this.abe);
        }
        if (c == ScatterBase.$$p[16]) {
            return this.k0(a, b, this.abm);
        }
        if (c == ScatterBase.$$p[1]) {
            return this.k0(a, b, this.aay);
        }
        if (c == ScatterBase.$$p[2]) {
            return this.k0(a, b, this.aa0);
        }
        return null;
    };
    ScatterBase.prototype.mo = function (a) {
        var b = this.no(a);
        if (b == ScatterBase.$$p[12]) {
            return this.abe;
        }
        if (b == ScatterBase.$$p[16]) {
            return this.abm;
        }
        if (b == ScatterBase.$$p[1]) {
            return this.aay;
        }
        if (b == ScatterBase.$$p[2]) {
            return this.aa0;
        }
        return _super.prototype.mo.call(this, a);
    };
    ScatterBase.prototype.ed = function (a, b, c, d, e) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var f = this.xAxis;
        var g = new ScalerParams(1, this.dc.yr, this.xd, f.dn);
        g.c = this.getEffectiveViewport1(this.cw);
        var h = this.yAxis;
        var i = new ScalerParams(1, this.dc.yr, this.xd, h.dn);
        i.c = this.getEffectiveViewport1(this.cw);
        a.clear();
        this.xr.cw(function (j) {
            if (j._visibility == 0) {
                var k = new SeriesPointOfInterest();
                var l = j.n;
                var m = j.o;
                if (!e && (l < _this.xd.left || l > _this.xd.right || m < _this.xd.top || m > _this.xd.bottom)) {
                    return;
                }
                k.d = f.f9(l, g);
                k.e = h.f9(m, i);
                k.b = j.content;
                k.g = _this.v0;
                k.c = j.ak;
                if (_this.hf) {
                    k.g = _this.v7(j.ak);
                }
                a.add(k);
            }
        });
        return true;
    };
    ScatterBase.prototype.b3 = function () {
        if (this.b4 == 0) {
            {
                return 1;
            }
        }
        else {
            return _super.prototype.b3.call(this);
        }
    };
    ScatterBase.prototype.xa = function (a) {
        if (!this.hasMarkers || !this.x1()) {
            return Rect.empty;
        }
        var b = this.xr.ce(this.wr(a));
        if (b != null) {
            return this.xr.c7(b);
        }
        return Rect.empty;
    };
    ScatterBase.prototype.g2 = function (a, b) {
        if (this.x2(a, b)) {
            return true;
        }
        return false;
    };
    Object.defineProperty(ScatterBase.prototype, "z2", {
        get: function () {
            return this.z0;
        },
        set: function (a) {
            if (this.z0 != a) {
                var b = this.z2;
                this.z0 = a;
                this.raisePropertyChanged("XColumn", b, this.z2);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "z3", {
        get: function () {
            return this.z1;
        },
        set: function (a) {
            if (this.z1 != a) {
                var b = this.z3;
                this.z1 = a;
                this.raisePropertyChanged("YColumn", b, this.z3);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.gh = function () {
        return this.highlightedItemsSource != null || (this.aay != null && this.aa0 != null);
    };
    ScatterBase.prototype.aah = function () {
        return false;
    };
    ScatterBase.prototype.hz = function () {
        var a = _super.prototype.hz.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "YMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedYMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.abu));
            a.add(b);
        }
        {
            var c = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "XMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedXMemberPath";
                $ret.q = true;
                return $ret;
            })());
            c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.abt));
            a.add(c);
        }
        if (this.aah()) {
            var d = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "DashArray";
                $ret.p = true;
                $ret.x = ((function () {
                    var $ret = new DoubleCollection();
                    $ret.add(5);
                    $ret.add(5);
                    return $ret;
                })());
                $ret.q = true;
                return $ret;
            })());
            a.add(d);
        }
        if (!this.aah()) {
            var e = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Brush";
                $ret.p = true;
                $ret.y = "ActualBrush";
                $ret.q = true;
                return $ret;
            })());
            e.valueResolving = delegateCombine(e.valueResolving, runOn(this, this.si));
            a.add(e);
        }
        if (!this.aah()) {
            var f = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Outline";
                $ret.p = true;
                $ret.y = "ActualOutline";
                $ret.q = true;
                return $ret;
            })());
            f.valueResolving = delegateCombine(f.valueResolving, runOn(this, this.si));
            a.add(f);
        }
        return a;
    };
    ScatterBase.prototype.abt = function (a, b) {
        if (this.aay != null) {
            b.value = this.aay;
            return;
        }
        b.value = this.abe;
    };
    ScatterBase.prototype.abu = function (a, b) {
        if (this.aa0 != null) {
            b.value = this.aa0;
            return;
        }
        b.value = this.abm;
    };
    Object.defineProperty(ScatterBase.prototype, "ac3", {
        get: function () {
            return this.c(ScatterBase.ace);
        },
        set: function (a) {
            this.h(ScatterBase.ace, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "GetErrorBarsXAxis", {
        get: function () {
            return this.xAxis;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "GetErrorBarsYAxis", {
        get: function () {
            return this.yAxis;
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.qp = function () {
        _super.prototype.qp.call(this);
        if (this.xAxis != null) {
            this.xAxis.ly(false);
        }
        if (this.yAxis != null) {
            this.yAxis.ly(false);
        }
    };
    ScatterBase.prototype.rq = function (a, b, c, d) {
        _super.prototype.rq.call(this, a, b, c, d);
        if (this.zi.df.g$e(a, b, c, d)) {
            this.r8(false);
            this.q0();
        }
        switch (b) {
            case ScatterBase.$$p[10]:
            case ScatterBase.$$p[14]:
            case ScatterBase.$$p[11]:
            case ScatterBase.$$p[15]:
                this.qu();
                break;
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.z2);
                    c.deregisterColumn(this.z3);
                    this.z2 = null;
                    this.z3 = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.z2 = this.dl(this.abe);
                    this.z3 = this.dl(this.abm);
                }
                if ((this.yAxis != null && !this.yAxis.ed()) || (this.xAxis != null && !this.xAxis.ed())) {
                    this.r8(this.gm && c != null);
                }
                break;
            case ScatterBase.$$p[9]:
                if (c != null) {
                    c.cx(this);
                }
                if (d != null) {
                    d.d3(this);
                }
                if ((this.xAxis != null && !this.xAxis.ed()) || (d == null && c != null)) {
                    this.r8(false);
                }
                this.q0();
                break;
            case ScatterBase.$$p[13]:
                if (c != null) {
                    c.cx(this);
                }
                if (d != null) {
                    d.d3(this);
                }
                if ((this.yAxis != null && !this.yAxis.ed()) || (d == null && c != null)) {
                    this.r8(false);
                }
                this.q0();
                break;
            case ScatterBase.$$p[12]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.z2);
                    this.z2 = this.dl(this.abe);
                }
                break;
            case "XColumn":
                this.zi.df.g$m();
                if (this.xAxis != null && !this.xAxis.ed()) {
                    this.r8(this.gm && this.d9);
                }
                break;
            case ScatterBase.$$p[16]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.z3);
                    this.z3 = this.dl(this.abm);
                }
                break;
            case "YColumn":
                this.zi.df.g$m();
                if (this.yAxis != null && !this.yAxis.ed()) {
                    this.r8(this.gm && this.d9);
                }
                break;
            case ScatterBase.$$p[7]:
                this.r8(false);
                this.q0();
                break;
            case ScatterBase.$$p[8]:
                this.r8(false);
                this.q0();
                break;
            case "TransitionProgress":
                this.zp.d(this.jz, this.zn, this.zl);
                this.abo();
                try {
                    if (this.d7(this.cw)) {
                        return;
                    }
                    if ((Math.round(this.jz * 100000) / 100000) == 1) {
                        this.acb(this.zl, this.zi);
                    }
                    else {
                        this.acb(this.zp, this.zi);
                    }
                    if (this.dc != null) {
                        this.dc.st(this);
                    }
                }
                finally {
                    this.acc();
                }
                break;
            case "TrendLineBrush":
                this.rw(b);
                break;
            case ScatterBase.$$p[0]:
                if (this.zj != null) {
                    this.zj.r = this;
                }
                this.r8(false);
                this.q0();
                break;
            case "TrendLineType":
                this.q0();
                break;
            case ScatterBase.$$p[4]:
                this.z6 = this.aae();
                this.r8(false);
                break;
            case ScatterBase.$$p[3]:
                this.z5 = this.aad();
                this.r8(false);
                break;
            case ScatterBase.$$p[5]:
                this.zr = this.zs();
                break;
        }
    };
    ScatterBase.prototype.aae = function () {
        return this.aaa;
    };
    ScatterBase.prototype.aad = function () {
        return this.z9;
    };
    ScatterBase.prototype.z8 = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.z7 = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.acc = function () {
        this.ac6 = Rect.empty;
        this.ac7 = Rect.empty;
    };
    ScatterBase.prototype.abo = function () {
        var a = this.getViewInfo(this.ac6, this.ac7);
        this.ac6 = a.p0;
        this.ac7 = a.p1;
    };
    ScatterBase.prototype.aac = function (a, b) {
        if (b != 3) {
            return true;
        }
        if (a == null) {
            return true;
        }
        if (this.abe == a || this.abm == a) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.po = function (a, b, c, d) {
        var e_1, _a;
        var e = false;
        if (!this.aac(d, a)) {
            return;
        }
        this.zi.df.g$i(a, b, c, d);
        if (this.zi.aa.count > 0) {
            try {
                for (var _b = __values(fromEnum(this.zi.aa)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var f = _c.value;
                    f.g$i(a, b, c, d);
                }
            }
            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.xAxis != null && !this.xAxis.ed()) {
            e = true;
        }
        if (this.yAxis != null && !this.yAxis.ed()) {
            e = true;
        }
        if (a == 0 || a == 2 || a == 3 || a == 4) {
            this.z4 = true;
        }
        else if (a == 1) {
            for (var g = b; g < b + c; g++) {
                this.aaj += this.z2.item(g);
                this.aak += this.z3.item(g);
            }
            this.aal = this.aaj / this.z2.count;
            this.aam = this.aak / this.z3.count;
        }
        if (e) {
            this.r8(true);
        }
    };
    ScatterBase.prototype.ab3 = function (a) {
        this.ab4(a, null);
    };
    ScatterBase.prototype.ab4 = function (a, b) {
        var e_2, _a, e_3, _b;
        var c = this.z2 != null ? this.z2.count : 0;
        var d = this.z3 != null ? this.z3.count : 0;
        var e = Math.min(c, d);
        if (e <= this.aau) {
            a.q.clear();
            var f = new List$1(OwnedPoint.$, 0);
            try {
                for (var _c = __values(fromEnum(a.y.values)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var g = _d.value;
                    f.add(g);
                }
            }
            catch (e_2_1) {
                e_2 = { error: e_2_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_2)
                        throw e_2.error;
                }
            }
            var h_1 = this.dp;
            f.aa(function (i, j) {
                var k = h_1.indexOf(i.a);
                var l = h_1.indexOf(j.a);
                if (k < l) {
                    return -1;
                }
                if (k > l) {
                    return 1;
                }
                return 0;
            });
            if (b != null) {
                b.i = a.q;
            }
            try {
                for (var _e = __values(fromEnum(f)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var i = _f.value;
                    if (h_1.indexOf(i.a) >= 0) {
                        if (b != null) {
                            b.j(i.c);
                        }
                        else {
                            a.q.add({ $type: Point_$type, x: i.c.x, y: i.c.y });
                        }
                    }
                }
            }
            catch (e_3_1) {
                e_3 = { error: e_3_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_3)
                        throw e_3.error;
                }
            }
        }
    };
    ScatterBase.prototype.ay = function (a) {
        if (a != null && a == this.xAxis && this.z2 != null) {
            return new AxisRange(this.z2.minimum, this.z2.maximum);
        }
        if (a != null && a == this.yAxis && this.z3 != null) {
            return new AxisRange(this.z3.minimum, this.z3.maximum);
        }
        return null;
    };
    ScatterBase.prototype.kw = function (a) {
        var b = this.kc(a);
        if (this.dp != null && b >= 0 && b < this.dp.count) {
            return this.dp.item(b);
        }
        return null;
    };
    Object.defineProperty(ScatterBase.prototype, "zr", {
        get: function () {
            return this.zq;
        },
        set: function (a) {
            var b = this.zq;
            this.zq = a;
            if (b != this.zq) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.zq));
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.zs = function () {
        if (this.zt != 0) {
            return this.zt;
        }
        return this.aab ? 4 : 1;
    };
    ScatterBase.prototype.kc = function (a) {
        var b = truncate(Math.round(this.iy(a)));
        return b;
    };
    ScatterBase.prototype.iy = function (a) {
        switch (this.zr) {
            case 1: return this.aaq(a);
            case 3: return this.aar(a);
            case 2: return this.aao(a);
            case 4: return this.aap(a);
            case 5: return this.aan(a);
        }
        return -1;
    };
    ScatterBase.prototype.aap = function (a) {
        return this.aas(a, false);
    };
    ScatterBase.prototype.aao = function (a) {
        var b = this.wr(a);
        var c = b.x;
        var d = b.y;
        if (this.dp == null || this.xAxis == null || this.yAxis == null || this.z2 == null || this.z3 == null) {
            return -1;
        }
        if (this.dp.count > this.aat) {
            return -1;
        }
        this.abr();
        var e = this.y7;
        var f = this.y8;
        if (e == null || f == null) {
            return -1;
        }
        var g = 1.7976931348623157E+308;
        var h = -1;
        for (var i = 0; i < this.z2.count; i++) {
            var j = e[i];
            var k = f[i];
            var l = (c - j) * (c - j) + (d - k) * (d - k);
            if (l < g) {
                g = l;
                h = i;
            }
        }
        return h;
    };
    ScatterBase.prototype.abr = function () {
        var _this = this;
        var a = this.cw.ca;
        var b = this.cw.b9;
        var c = this.getEffectiveViewport();
        if (this.zh == null) {
            return;
        }
        var d = new ScalerParams(0, a, b, this.zh.d, c);
        var e = ((function () {
            var $ret = new ScalerParams(0, a, b, _this.zh.e, c);
            $ret.b = _this.i5();
            return $ret;
        })());
        if (this.y7 == null || this.y8 == null) {
            var f = arrayShallowClone(this.z2.asArray());
            var g = arrayShallowClone(this.z3.asArray());
            this.xAxis.k1(boxArray$1(f), 0, f.length, d);
            this.yAxis.k1(boxArray$1(g), 0, g.length, e);
            this.y7 = f;
            this.y8 = g;
        }
    };
    ScatterBase.prototype.get_aab = function () {
        return false;
    };
    Object.defineProperty(ScatterBase.prototype, "aab", {
        get: function () {
            return this.get_aab();
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.aas = function (a, b) {
        if (!this.aab) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.zm();
        if (e == null) {
            return -1;
        }
        if (e.q == null) {
            return -1;
        }
        if (this.dp == null || this.dp.count > this.aat) {
            return -1;
        }
        this.abr();
        var f = this.y7;
        var g = this.y8;
        if (f == null || g == null) {
            return -1;
        }
        var h = this.wr(a);
        var i = 1.7976931348623157E+308;
        var j = -1;
        for (var k = 0; k < this.y7.length; k++) {
            var l = { $type: Point_$type, x: this.y7[k], y: this.y8[k] };
            if (k > 0) {
                if (!b || e.m.containsKey(this.dp.item(k)) || e.m.containsKey(this.dp.item(k - 1))) {
                    var m = CoreGeometryUtil.q(h, c, l);
                    if (m < i) {
                        i = m;
                        j = k;
                    }
                }
            }
            c = l;
        }
        if (j >= 0) {
            var n = { $type: Point_$type, x: this.y7[j], y: this.y8[j] };
            var o = { $type: Point_$type, x: this.y7[j - 1], y: this.y8[j - 1] };
            if (!b || (e.m.containsKey(this.dp.item(j)) && e.m.containsKey(this.dp.item(j - 1)))) {
                var p = GeometryUtil.j(h, o, n);
                return (j - 1) + p;
            }
            else if (e.m.containsKey(this.dp.item(j))) {
                return j;
            }
            else {
                return j - 1;
            }
        }
        return -1;
    };
    ScatterBase.prototype.aar = function (a) {
        return this.aas(a, true);
    };
    ScatterBase.prototype.aan = function (a) {
        var _this = this;
        var b = this.wr(a);
        var c = b.x;
        var d = b.y;
        if (this.zi.dg.e > this.aat) {
            return -1;
        }
        var e = -1;
        this.xr.cx(function (f) {
            var g = _this.zi.c7(f);
            var h = g.left;
            var i = g.top;
            var j = g.width;
            var k = g.height;
            if (_this.xy) {
                var l = h + j / 2;
                var m = i + k / 2;
                var n = (j / 2) * (j / 2);
                var o = (c - l) * (c - l) + (d - m) * (d - m);
                if (o < n) {
                    if (e == -1) {
                        e = f.ak;
                    }
                }
            }
            else {
                if (c > h && c < h + j && d > i && d < i + k) {
                    if (e == -1) {
                        e = f.ak;
                    }
                }
            }
        });
        return e;
    };
    ScatterBase.prototype.aaq = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.wr(a);
        var e = d.x;
        var f = d.y;
        if (this.zi.dg.e > this.aat) {
            return -1;
        }
        this.zi.dn(function (g) {
            if (g._visibility == 0) {
                var h = _this.zi.c7(g);
                var i = h.left + h.width / 2;
                var j = h.top + h.height / 2;
                var k = (e - i) * (e - i) + (f - j) * (f - j);
                if (k < c) {
                    c = k;
                    b = g;
                }
            }
        });
        if (b != null) {
            return b.ak;
        }
        return -1;
    };
    ScatterBase.prototype.ww = function (a, b, c) {
        var _this = this;
        if (this.xAxis == null || this.yAxis == null || this.z2 == null || this.z3 == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.cw.ca;
        var e = this.cw.b9;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.xAxis.dn, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.dn, f);
            $ret.b = _this.i5();
            return $ret;
        })());
        if (b) {
            var i = this.iy(a);
            if (i == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var j = truncate(Math.floor(i));
            var k = truncate(Math.ceil(i));
            if (j < 0) {
                j = 0;
            }
            if (k < 0) {
                k = 0;
            }
            if (k > this.dp.count - 1) {
                k = this.dp.count - 1;
            }
            if (j > this.dp.count - 1) {
                j = this.dp.count - 1;
            }
            if (k == j) {
                var l = this.xAxis.f6(this.z2.item(j), g);
                var m = this.yAxis.f6(this.z3.item(j), h);
                return { $type: Point_$type, x: l, y: m };
            }
            var n = i - Math.floor(i);
            var o = this.xAxis.f6(this.z2.item(j), g);
            var p = this.yAxis.f6(this.z3.item(j), h);
            var q = this.xAxis.f6(this.z2.item(k), g);
            var r = this.yAxis.f6(this.z3.item(k), h);
            var s = q - o;
            var t = r - p;
            return { $type: Point_$type, x: o + s * n, y: p + t * n };
        }
        else {
            var u = this.kc(a);
            if (u == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var v = this.xAxis.f6(this.z2.item(u), g);
            var w = this.yAxis.f6(this.z3.item(u), h);
            return { $type: Point_$type, x: v, y: w };
        }
    };
    ScatterBase.prototype.gj = function (a) {
        var _this = this;
        var b = this.dc != null ? this.dc.yr : Rect.empty;
        b = b.copy();
        var c = this.dc != null ? this.dc.y9 : Rect.empty;
        var d = new Rect(0, 0, 0, 1, 1);
        var e = this.w6(this.cw);
        var f = new ScalerParams(0, d, d, this.xAxis.dn, e);
        var g = ((function () {
            var $ret = new ScalerParams(0, d, d, _this.yAxis.dn, e);
            $ret.b = _this.i5();
            return $ret;
        })());
        var h = !b.isEmpty && !c.isEmpty && this.dp != null ? this.dp.indexOf(a) : -1;
        var i = this.xAxis != null && this.z2 != null && h < this.z2.count ? this.xAxis.f6(this.z2.item(h), f) : NaN;
        var j = this.yAxis != null && this.z3 != null && h < this.z3.count ? this.yAxis.f6(this.z3.item(h), g) : NaN;
        if (!isNaN_(i)) {
            if (i < b.left + 0.1 * b.width) {
                i = i + 0.4 * b.width;
                b.x = i - 0.5 * b.width;
            }
            if (i > b.right - 0.1 * b.width) {
                i = i - 0.4 * b.width;
                b.x = i - 0.5 * b.width;
            }
        }
        if (!isNaN_(j)) {
            if (j < b.top + 0.1 * b.height) {
                j = j + 0.4 * b.height;
                b.y = j - 0.5 * b.height;
            }
            if (j > b.bottom - 0.1 * b.height) {
                j = j - 0.4 * b.height;
                b.y = j - 0.5 * b.height;
            }
        }
        if (this.c4 != null) {
            this.c4.au(this.dc, b, true);
        }
        return h >= 0;
    };
    ScatterBase.prototype.s8 = function (a, b) {
        this.r8(false);
    };
    ScatterBase.prototype.s9 = function (a, b) {
        this.r8(false);
    };
    ScatterBase.prototype.zm = function () {
        var a = this.zl;
        if (this.d4()) {
            if (this.dd.g) {
                this.dd.t();
            }
            a = this.zp;
        }
        return a;
    };
    ScatterBase.prototype.abp = function (a, b, c, d, e) {
        var _this = this;
        b.j = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
        var f = this.getEffectiveViewport1(a);
        var g = this.dp;
        var h;
        var i;
        var j = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.zh.d, f);
            $ret.c = _this.getEffectiveViewport1(a);
            return $ret;
        })());
        var k = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.zh.e, f);
            $ret.c = _this.getEffectiveViewport1(a);
            $ret.b = _this.i5();
            return $ret;
        })());
        var l = false;
        var m = 0;
        if (this.dc != null) {
            if (this.dc.g0()) {
                var n = this.dc.oj(d, j);
                l = n.c;
                m = n.d;
            }
        }
        var _loop_1 = function (o) {
            h = this_1.z2.item(o);
            i = this_1.z3.item(o);
            var p = { $type: Point_$type, x: this_1.zh.a.f6(h, j), y: this_1.zh.b.f6(i, k) };
            if (l) {
                if (p.x < e.left || p.x > e.right) {
                    if (p.x + m >= e.left && p.x + m <= e.right) {
                        p = { $type: Point_$type, x: p.x + m, y: i };
                    }
                }
            }
            if (!isInfinity(p.x) && !isInfinity(p.y)) {
                var q_1 = g.item(o);
                if (!b.j.containsKey(q_1)) {
                    var r_1 = { $type: Point_$type, x: h, y: i };
                    var s_1 = { $type: Point_$type, x: p.x, y: p.y };
                    b.j.addItem(q_1, ((function () {
                        var $ret = new OwnedPoint();
                        $ret.a = q_1;
                        $ret.b = r_1;
                        $ret.c = s_1;
                        return $ret;
                    })()));
                }
            }
        };
        var this_1 = this;
        for (var o = 0; o < c; o++) {
            _loop_1(o);
        }
    };
    ScatterBase.prototype.ab0 = function (a, b) {
        var _this = this;
        this.y7 = null;
        this.y8 = null;
        a.m.clear();
        a.r.clear();
        a.k.clear();
        a.o.clear();
        a.l.clear();
        a.n.clear();
        var c = Math.min(this.z2 != null ? this.z2.count : 0, this.z3 != null ? this.z3.count : 0);
        var d = b.ca;
        var e = b.b9;
        var f = this.getEffectiveViewport1(b);
        var g = new ScalerParams(0, d, e, this.xAxis.dn, f);
        g.c = this.getEffectiveViewport1(b);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.dn, f);
            $ret.b = _this.i5();
            return $ret;
        })());
        h.c = this.getEffectiveViewport1(b);
        if (c < 1) {
            return;
        }
        this.zh = ((function () {
            var $ret = new ScatterAxisInfoCache();
            $ret.a = _this.xAxis;
            $ret.b = _this.yAxis;
            $ret.d = _this.xAxis.dn;
            $ret.e = _this.yAxis.dn;
            $ret.c = _this.dp;
            return $ret;
        })());
        var i = b;
        if (c <= this.aau) {
            this.abp(i, a, c, d, e);
        }
        if (this.x1()) {
            b.dd.l(a.m, this.aau, d, e, this.ik);
        }
        var j = ((function () {
            var $ret = new Clipper(0, e, false);
            $ret.i = a.r;
            return $ret;
        })());
        var k = this.w4(b);
        var l = this.xAxis.f9(k.left, g);
        var m = this.xAxis.f9(k.right, g);
        b.df.j(a.r, this.trendLineType, this.z2, this.z3, this.trendLinePeriod, function (n) { return _this.xAxis.f6(n, g); }, function (n) { return _this.yAxis.f6(n, h); }, ((function () {
            var $ret = new TrendResolutionParams();
            $ret.d = _this.ik;
            $ret.i = e;
            $ret.h = f;
            $ret.j = d;
            return $ret;
        })()), j, l, m);
        if (b.aa.count > 0) {
            a.p.clear();
            for (var n = 0; n < b.aa.count; n++) {
                a.p.add(new List$1(Point_$type, 0));
                var o = b.aa._inner[n];
                o.j(a.p._inner[n], o.g$b, this.z2, this.z3, o.g$f, function (p) { return _this.xAxis.f6(p, g); }, function (p) { return _this.yAxis.f6(p, h); }, ((function () {
                    var $ret = new TrendResolutionParams();
                    $ret.d = _this.ik;
                    $ret.i = e;
                    $ret.h = f;
                    $ret.j = d;
                    return $ret;
                })()), j, l, m);
            }
        }
        this.aby(a, b);
    };
    ScatterBase.prototype.pi = function (a, b) {
        _super.prototype.pi.call(this, a, b);
        var c = b;
        c.dm(a);
    };
    ScatterBase.prototype.get_fh = function () {
        return true;
    };
    ScatterBase.prototype.zw = function (a, b, c) {
        return null;
    };
    ScatterBase.prototype.zx = function (a, b, c) {
        if (this.dp == null) {
            return null;
        }
        var d = this.zm();
        var e = this.zi.ce(this.wr(b));
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.dp.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            f = e.ak;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.i = this;
        g.g = f;
        g.f = f;
        g.c = false;
        g.d = true;
        if (c != null && c.g == g.g && c.f == g.f) {
            return c;
        }
        return g;
    };
    ScatterBase.prototype.xg = function (a, b) {
        if (this.xt != 1 && this.xt != 13) {
            var c = this.xr.c8();
            var d = (c.width / 2) + (this.x4 / 2);
            var e = (c.height / 2) + (this.x4 / 2);
            var f = d;
            var g = d;
            var h = e;
            var i = e;
            if (a == 2 || a == 4) {
                f = 0;
            }
            if (a == 2 || a == 3) {
                g = 0;
            }
            if (b == 2 || b == 3) {
                h = 0;
            }
            if (b == 2 || b == 4) {
                i = 0;
            }
            return new Thickness(1, f, h, g, i);
        }
        return new Thickness(1, 0, 0, 0, 0);
    };
    ScatterBase.prototype.zv = function (a, b, c) {
        var d = new HighlightingInfo();
        d.i = this;
        d.g = 0;
        d.f = this.dp.count - 1;
        d.c = true;
        if (c != null && c.g == d.g && c.f == d.f) {
            return c;
        }
        return d;
    };
    ScatterBase.prototype.dh = function (a, b, c) {
        if (this.ef && this.f2(this.by) && !c) {
            var d = this.zw(a, b, this.zy);
            this.zy = d;
            return d;
        }
        else {
            var e = this.zv(a, b, this.zy);
            this.zy = e;
            return e;
        }
    };
    ScatterBase.prototype.di = function (a, b, c) {
        if (this.f2(this.by) && !c) {
            var d = this.zx(a, b, this.zz);
            this.zz = d;
            return d;
        }
        else {
            var e = this.zv(a, b, this.zz);
            e.d = true;
            this.zz = e;
            return e;
        }
    };
    ScatterBase.prototype.aag = function () {
        return (this.assigningScatterStyle != null && this.z6) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1);
    };
    ScatterBase.prototype.aaf = function () {
        return (this.assigningScatterMarkerStyle != null && this.z5) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1);
    };
    ScatterBase.prototype.acb = function (a, b) {
        var _this = this;
        this.rd();
        var c = b.b9;
        this.zh = ((function () {
            var $ret = new ScatterAxisInfoCache();
            $ret.a = _this.xAxis;
            $ret.b = _this.yAxis;
            $ret.d = _this.xAxis.dn;
            $ret.e = _this.yAxis.dn;
            return $ret;
        })());
        if (this.x1()) {
            b.dd.j(a.m, this.x3);
            if (this.aaf()) {
                this.abq(b, a);
            }
        }
        b.c4();
        var d = ((function () {
            var $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
            $ret.i = b.df.g$n.an;
            return $ret;
        })());
        b.df.g$l(a.r, d);
        if (b.aa.count > 0) {
            for (var e = 0; e < b.aa.count; e++) {
                var f = b.aa._inner[e];
                f.g$l(a.p._inner[e], d);
            }
        }
        this.ab8(a, b);
    };
    ScatterBase.prototype.ak = function (a, b) {
        var c = new List$1(ChartSelection.$, 0);
        this.qi(a, c, b);
        return c.toArray();
    };
    ScatterBase.prototype.qi = function (a, b, c) {
        this.abs(a, b, c, 0, null);
    };
    ScatterBase.prototype.abs = function (a, b, c, d, e) {
        var _this = this;
        var f = this.dc.y6(this.dc.yw(a));
        var g = this.dp.count;
        var h = this.zh.a;
        var i = this.zh.b;
        var j = this.dc.yz(this.xd, this.getEffectiveViewport(), f);
        var k = new ScalerParams(0, f, this.dc.y9, h.dn, this.getEffectiveViewport());
        var l = new ScalerParams(0, f, this.dc.y9, i.dn, this.getEffectiveViewport());
        if (d == 0) {
            var _loop_2 = function (m) {
                var n = h.f6(this_2.z2.item(m), k);
                var o = i.f6(this_2.z3.item(m), l);
                if (n < j.width && n > 0 && o < j.height && o > 0) {
                    if (c == 7 || c == 6) {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.series = _this;
                            return $ret;
                        })()));
                        return { value: void 0 };
                    }
                    else if (c == 2 || c == 1) {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.item = _this.dp.item(m);
                            return $ret;
                        })()));
                    }
                    else {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.item = _this.dp.item(m);
                            $ret.series = _this;
                            return $ret;
                        })()));
                    }
                }
            };
            var this_2 = this;
            for (var m = 0; m < g; m++) {
                var state_1 = _loop_2(m);
                if (typeof state_1 === "object")
                    return state_1.value;
            }
        }
        else {
            var _loop_3 = function (p) {
                var q = h.f6(this_3.z2.item(p), k);
                var r = i.f6(this_3.z3.item(p), l);
                var s = e.item(p) / f.height;
                var t = e.item(p) / f.width;
                var u = new Rect(0, q - t / 2, r - s / 2, t, s);
                if (j.intersectsWith(u)) {
                    if (c == 7 || c == 6) {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.series = _this;
                            return $ret;
                        })()));
                        return { value: void 0 };
                    }
                    else if (c == 2 || c == 1) {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.item = _this.dp.item(p);
                            return $ret;
                        })()));
                    }
                    else {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.item = _this.dp.item(p);
                            $ret.series = _this;
                            return $ret;
                        })()));
                    }
                }
            };
            var this_3 = this;
            for (var p = 0; p < g; p++) {
                var state_2 = _loop_3(p);
                if (typeof state_2 === "object")
                    return state_2.value;
            }
        }
    };
    ScatterBase.prototype.za = function (a, b) {
        return this.zb(a, b);
    };
    ScatterBase.prototype.zb = function (a, b) {
        if (b < a || a < 0 || a > this.z2.count || b < 0 || b > this.z2.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.dp.item(d);
        }
        return c;
    };
    ScatterBase.prototype.abq = function (a, b) {
        var _this = this;
        a.ck = true;
        this.zu.ay(this, this.aaf(), runOn(this, this.za));
        var c = this.zu.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.dp == null ? 0 : this.dp.count;
        this.zi.cw(function (g) {
            if (g._visibility == 0) {
                var h = g.ak;
                var i = g.content;
                if (i == null) {
                    i = new DataContext();
                    g.content = i;
                }
                if (d) {
                    _this.abv(h, f, a.t);
                }
                _this.zu.ac(g, i);
            }
        });
    };
    ScatterBase.prototype.abw = function (a, b, c) {
        var d = this.by != 1;
        var e = this.cq != 1;
        var f = this.cp != 1;
        this.zu.a0(this.zu.b, a, b, false);
        this.zu.ab(this.ii);
        var g = this.zu.ax;
        var h = null;
        var i = null;
        var j = null;
        var k = this.dp;
        if (d && this.dc != null) {
            h = this.dc.d7.getHighlightingInfo(this, k, g.z, g.y, false);
            g.c = h;
        }
        if (e && this.dc != null) {
            h = this.dc.d8.getHighlightingInfo(this, k, g.z, g.y, false);
            g.d = h;
        }
        if (f && this.dc != null) {
            h = this.dc.d6.getHighlightingInfo(this, k, g.z, g.y, false);
            g.b = h;
        }
        g.h = c;
        this.ab6(g);
        this.zu.z(this, h, i, j, c, d, e, f, a < 0);
    };
    ScatterBase.prototype.abv = function (a, b, c) {
        var d = this.by != 1;
        var e = this.cq != 1;
        var f = this.cp != 1;
        this.zu.a0(this.zu.d, a, b, true);
        this.zu.aa(this.ii);
        var g = this.zu.aw;
        var h = null;
        var i = null;
        var j = null;
        var k = this.dp;
        var l = null;
        var m = null;
        var n = null;
        if (d && this.dc != null) {
            h = this.dc.d7.getHighlightingInfo(this, k, g.z, g.y, true);
            if (this.dc.d7.isCrossContextHighlight(this)) {
                l = this.dc.d7.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.c = h;
        }
        if (e && this.dc != null) {
            i = this.dc.d8.getHighlightingInfo(this, k, g.z, g.y, true);
            if (i == null && this.bo != null) {
                i = this.dc.d8.getHighlightingInfo(this.bo, this.bo.dp, g.z, g.y, true);
            }
            if (i == null && this.bl != null) {
                i = this.dc.d8.getHighlightingInfo(this.bl, this.bl.dp, g.z, g.y, true);
            }
            if (this.dc.d8.isCrossContextHighlight(this)) {
                m = this.dc.d8.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.d = i;
        }
        if (f && this.dc != null) {
            j = this.dc.d6.getHighlightingInfo(this, k, g.z, g.y, true);
            if (this.dc.d6.isCrossContextHighlight(this)) {
                n = this.dc.d6.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.d = i;
        }
        g.h = c;
        this.ab5(g);
        this.zu.y(this, h, i, j, c, d, e, f, g.v, this.dc.d7.totalHighWaterMark, g.x, this.dc.d8.totalHighWaterMark, g.t, this.dc.d6.totalHighWaterMark);
    };
    ScatterBase.prototype.ab6 = function (a) {
        if (this.assigningScatterStyle != null && this.z6) {
            this.assigningScatterStyle(this, a);
        }
    };
    ScatterBase.prototype.ab5 = function (a) {
        if (this.assigningScatterMarkerStyle != null && this.z5) {
            this.assigningScatterMarkerStyle(this, a);
        }
    };
    ScatterBase.prototype.aby = function (a, b) {
        var e_4, _a;
        var c = new ErrorBarsHelper(this, b);
        if (this.zj == null) {
            return;
        }
        var d = this.zj.u;
        var e = this.zj.v;
        var f = 0;
        var g = 0;
        var h = 0;
        var i = 0;
        try {
            for (var _b = __values(fromEnum(a.m.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var j = _c.value;
                var k = a.m.item(j);
                if (d != null) {
                    switch (d.getCalculatorType()) {
                        case 1:
                            var l = this.ab1(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            var m = this.abz(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            var n = this.abx(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            var o = this.ab2(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            var p = this.abz(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    var q = new OwnedPoint();
                    q.c = c.l(d, this.zh.a, k.c, f);
                    q.a = k.a;
                    a.k.addItem(j, q);
                    a.l.addItem(j, [h, i]);
                }
                if (e != null) {
                    switch (e.getCalculatorType()) {
                        case 1:
                            var r = this.ab1(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            var s = this.abz(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            var t = this.abx(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            var u = this.ab2(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            var v = this.abz(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    var w = new OwnedPoint();
                    w.c = c.m(e, this.zh.b, k.c, g);
                    w.a = k.a;
                    a.o.addItem(j, w);
                    a.n.addItem(j, [h, i]);
                }
            }
        }
        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;
            }
        }
    };
    ScatterBase.prototype.ab1 = function (a, b, c, d, e, f) {
        if (f) {
            var g = void 0;
            var h = void 0, i = void 0;
            i = this.zh.a;
            if (this.zj.s == 0) {
                g = a.c.x;
                h = this.zh.a;
            }
            else {
                g = a.c.y;
                h = this.zh.b;
            }
            var j = b.f(g, c, h, i, d, e);
            d = j.p4;
            e = j.p5;
        }
        else {
            var k = void 0;
            var l = void 0, m = void 0;
            m = this.zh.b;
            if (this.zj.t == 0) {
                k = a.c.x;
                l = this.zh.a;
            }
            else {
                k = a.c.y;
                l = this.zh.b;
            }
            var n = b.f(k, c, l, m, d, e);
            d = n.p4;
            e = n.p5;
        }
        return {
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.abz = function (a, b, c, d, e, f) {
        if (f) {
            var g = b.j(a.c.x, c, this.zh.a, d, e);
            d = g.p3;
            e = g.p4;
        }
        else {
            var h = b.j(a.c.y, c, this.zh.b, d, e);
            d = h.p3;
            e = h.p4;
        }
        return {
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.abx = function (a, b, c, d, e, f, g) {
        var h = c.getItemColumn();
        var i = this.dp.indexOf(d);
        if (h != null && i < h.count) {
            var j = h.item(i);
            if (g) {
                var k = b.h(a.c.x, j, this.zh.a, e, f);
                e = k.p3;
                f = k.p4;
            }
            else {
                var l = b.h(a.c.y, j, this.zh.b, e, f);
                e = l.p3;
                f = l.p4;
            }
        }
        else {
            e = NaN;
            f = NaN;
        }
        return {
            p4: e,
            p5: f
        };
    };
    ScatterBase.prototype.ab2 = function (a, b, c, d, e, f) {
        var g = a.i(b, c);
        c = g.p1;
        if (f) {
            var h = a.k(c, b, this.zh.a, d, e);
            d = h.p3;
            e = h.p4;
        }
        else {
            var i = a.k(c, b, this.zh.b, d, e);
            d = i.p3;
            e = i.p4;
        }
        return {
            p2: c,
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.ab8 = function (a, b) {
        if (!b.r() || this.zj == null) {
            b.dp();
            return;
        }
        this.ab9(a, b);
        this.aca(a, b);
    };
    ScatterBase.prototype.ab9 = function (a, b) {
        var e_5, _a;
        b.dk();
        var c = new ErrorBarsHelper(this, b);
        var d = new PathGeometry();
        var e = this.zj.u;
        try {
            for (var _b = __values(fromEnum(a.m.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var f = _c.value;
                if (e != null && a.l.containsKey(f)) {
                    var g = a.l.item(f)[0];
                    var h = a.l.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        var i = a.k.item(f).c;
                        if (this.zj.o == 1 || this.zj.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.zj.o == 1 || this.zj.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
        }
        catch (e_5_1) {
            e_5 = { error: e_5_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_5)
                    throw e_5.error;
            }
        }
        b.dq(d);
    };
    ScatterBase.prototype.aca = function (a, b) {
        var e_6, _a;
        b.dl();
        var c = new ErrorBarsHelper(this, b);
        var d = new PathGeometry();
        var e = this.zj.v;
        try {
            for (var _b = __values(fromEnum(a.m.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var f = _c.value;
                if (e != null && a.n.containsKey(f)) {
                    var g = a.n.item(f)[0];
                    var h = a.n.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        var i = a.o.item(f).c;
                        if (this.zj.p == 1 || this.zj.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.zj.p == 1 || this.zj.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        catch (e_6_1) {
            e_6 = { error: e_6_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_6)
                    throw e_6.error;
            }
        }
    };
    ScatterBase.prototype.hk = function (a, b, c) {
        var d = true;
        if (!_super.prototype.hk.call(this, a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.b7 == null || this.yAxis.b7 == null || this.z2 == null || this.z3 == null || this.z2.count == 0 || this.z3.count == 0 || this.dp == null || this.dp.count != this.z2.count || this.dp.count != this.z3.count || this.xAxis.b7 == null || this.yAxis.b7 == null || this.xAxis.qw == this.xAxis.qv || this.yAxis.qw == this.yAxis.qv) {
            d = false;
        }
        return d;
    };
    ScatterBase.prototype.getViewInfo = function (a, b) {
        if (!this.ac6.isEmpty && !this.ac7.isEmpty) {
            a = this.ac6;
            b = this.ac7;
            return {
                p0: a,
                p1: b
            };
        }
        a = this.cw.b9;
        b = this.cw.ca;
        return {
            p0: a,
            p1: b
        };
    };
    ScatterBase.prototype.r9 = function (a) {
        _super.prototype.r9.call(this, a);
        this.abo();
        try {
            if (this.d7(this.cw)) {
                return;
            }
            if (this.dp != null && this.dp.count > this.aau) {
                a = false;
            }
            if (this.gl(a) && !this.gx) {
                var b = this.zn;
                if (this.d4()) {
                    if (this.dd.g) {
                        this.dd.t();
                    }
                    this.zn = this.zp;
                    this.zp = b;
                }
                else {
                    this.zn = this.zl;
                    this.zl = b;
                }
                this.ab0(this.zl, this.zi);
                this.sp();
            }
            else {
                if (!this.gx) {
                    this.ab0(this.zl, this.zi);
                }
                this.acb(this.zl, this.zi);
            }
        }
        finally {
            this.acc();
        }
    };
    ScatterBase.prototype.sz = function () {
        _super.prototype.sz.call(this);
        if (this.index < 0) {
            return;
        }
        this.zi.dt();
    };
    ScatterBase.prototype.sa = function (a, b) {
        _super.prototype.sa.call(this, a, b);
        if (!this.g6) {
            this.cw.be(b);
            return;
        }
        this.cw.be(b);
        if (this.d7(this.cv)) {
            return;
        }
        var c = typeCast(ScatterBaseView.$, this.cv);
        this.sb();
        this.g6 = false;
    };
    ScatterBase.prototype.sb = function () {
        _super.prototype.sb.call(this);
        var a = typeCast(ScatterBaseView.$, this.cv);
        if (!this.gy) {
            this.zo = new ScatterFrame();
            this.ab0(this.zo, a);
        }
        this.gy = false;
        this.acb(this.zo, a);
    };
    ScatterBase.prototype.r7 = function (a, b, c, d, e) {
        _super.prototype.r7.call(this, a, b, c, d, e);
        var f = this.ba.a$k.item(d);
        var g = f;
        f.bd(c);
        if (this.d7(g)) {
            return;
        }
        if (this.zk == null) {
            this.zk = new ScatterFrame();
        }
        this.ab0(this.zk, g);
        this.acb(this.zk, g);
    };
    ScatterBase.prototype.ab7 = function (a, b) {
        var e_7, _a, e_8, _b;
        var c = new List$1(Base.$, 0);
        try {
            for (var _c = __values(fromEnum(b.c)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var d = _d.value;
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
        }
        catch (e_7_1) {
            e_7 = { error: e_7_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_7)
                    throw e_7.error;
            }
        }
        try {
            for (var _e = __values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var e = _f.value;
                b.h(e);
            }
        }
        catch (e_8_1) {
            e_8 = { error: e_8_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_8)
                    throw e_8.error;
            }
        }
    };
    ScatterBase.prototype.y9 = function (a, b, c, d, e) {
        var _this = this;
        if (c == null || c.length != this.zh.c.count) {
            c = new Array(this.zh.c.count);
            for (var f = 0; f < this.zh.c.count; f++) {
                c[f] = PointUtil.create();
            }
        }
        var g = this.getEffectiveViewport1(a);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.xAxis.dn, g);
            $ret.c = _this.getEffectiveViewport1(a);
            return $ret;
        })());
        var i = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.dn, g);
            $ret.c = _this.getEffectiveViewport1(a);
            $ret.b = _this.i5();
            return $ret;
        })());
        var j = this.w4(a);
        var k = this.zh.a.f9(j.left, h);
        var l = this.zh.a.f9(j.right, h);
        var m = this.zh.b.f9(j.bottom, i);
        var n = this.zh.b.f9(j.top, i);
        if (this.zh.d) {
            var o = k;
            k = l;
            l = o;
        }
        if (this.zh.e) {
            var p = m;
            m = n;
            n = p;
        }
        var q = this.zh;
        var r = q.a;
        var s = q.b;
        var t;
        var u;
        var v = this.z2;
        var w = this.z3;
        var x = false;
        var y = 0;
        var z = 0;
        if (this.dc != null) {
            if (this.dc.g0()) {
                var aa = this.dc.oj(d, h);
                x = aa.c;
                y = aa.d;
                z = r.f9(0 + y, h);
                var ab = r.f9(0, h);
                z -= ab;
            }
        }
        for (var ac = 0; ac < this.zh.c.count; ac++) {
            t = v.item(ac);
            u = w.item(ac);
            var ad = 1E-10;
            if (x) {
                if (t >= k - ad && t <= l + ad && u >= m - ad && u <= n + ad) {
                    c[ac].x = r.f6(t, h);
                    c[ac].y = s.f6(u, i);
                }
                else {
                    if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                        c[ac].x = r.f6(t, h) + y;
                        c[ac].y = s.f6(u, i);
                    }
                    else {
                        c[ac].x = NaN;
                        c[ac].y = NaN;
                    }
                }
            }
            else {
                if (t >= k - ad && t <= l + ad && u >= m - ad && u <= n + ad) {
                    c[ac].x = r.f6(t, h);
                    c[ac].y = s.f6(u, i);
                }
                else {
                    c[ac].x = NaN;
                    c[ac].y = NaN;
                }
            }
        }
        return c;
    };
    ScatterBase.prototype.aai = function (a, b) {
        var e_9, _a;
        if (b == null) {
            b = new List$1(Number_$type, 2, a.e);
        }
        else {
            b.clear();
        }
        var c = 0;
        var d = this.dp;
        try {
            for (var _b = __values(fromEnum(a.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                b.add(d.indexOf(e));
            }
        }
        catch (e_9_1) {
            e_9 = { error: e_9_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_9)
                    throw e_9.error;
            }
        }
        return b;
    };
    ScatterBase.prototype.qd = function (a) {
        _super.prototype.qd.call(this, a);
        this.bc.exportTrendlineData(this, a, this.zi.df.g$n);
    };
    ScatterBase.prototype.i5 = function () {
        return Series.i6(this.z3, null);
    };
    ScatterBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kw(c);
        var e = d == null ? NaN : this.i4(d, "XMemberPath");
        var f = d == null ? NaN : this.i4(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 13;
        g.q = "X";
        g.r = this.abe != null ? this.abe : "X";
        g.s = this.aba != null ? this.aba : "X:";
        g.t = this.abc != null ? this.abc : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.q = "Y";
        h.r = this.abm != null ? this.abm : "Y";
        h.s = this.abi != null ? this.abi : "Y:";
        h.t = this.abk != null ? this.abk : "";
        var i = new DataLegendSeriesContext();
        i.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.h = this.mn();
        return i;
    };
    ScatterBase.prototype.acd = function () {
        if (this.z4) {
            this.aaj = 0;
            this.aak = 0;
            for (var a = 0; a < this.z2.count; a++) {
                this.aaj += this.z2.item(a);
                this.aak += this.z3.item(a);
            }
            this.aal = this.aaj / this.z2.count;
            this.aam = this.aak / this.z3.count;
            this.z4 = false;
        }
    };
    ScatterBase.prototype.jg = function (a, b) {
        if (b == null || !b.dq) {
            return NaN;
        }
        if (b != this.xAxis && b != this.yAxis) {
            return NaN;
        }
        var c = this.aq(a);
        if (b.dy) {
            return c[1];
        }
        else {
            return c[0];
        }
    };
    ScatterBase.prototype.aq = function (a) {
        var b = NaN;
        var c = NaN;
        switch (a) {
            case 5:
            case 2:
                b = this.z2.maximum;
                c = this.z3.maximum;
                break;
            case 4:
            case 1:
                b = this.z2.minimum;
                c = this.z3.minimum;
                break;
            case 6:
            case 3:
                if (this.z4) {
                    this.acd();
                }
                b = this.aal;
                c = this.aam;
                break;
        }
        return [b, c];
    };
    ScatterBase.prototype.w0 = function (a) {
        var b = this.getEffectiveViewport1(this.cw);
        var c = new ScalerParams(0, this.cw.ca, this.cw.b9, this.xAxis.dn, b);
        c.c = b;
        var d = isNaN_(a[0]) ? NaN : this.xAxis.f6(a[0], c);
        c = new ScalerParams(0, this.cw.ca, this.cw.b9, this.yAxis.dn, b);
        c.b = this.i5();
        c.c = b;
        var e = isNaN_(a[1]) ? NaN : this.yAxis.f6(a[1], c);
        return { $type: Point_$type, x: d, y: e };
    };
    ScatterBase.prototype.wz = function (a) {
        var b = this.aq(a);
        return this.w0(b);
    };
    ScatterBase.prototype.bd = function () {
        return new ScatterTrendLineManager();
    };
    ScatterBase.prototype.qr = function () {
        _super.prototype.qr.call(this);
        this.zi.df.g$m();
    };
    ScatterBase.$t = markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.ace = DependencyProperty.i("ActualTrendLineBrush", Brush.$, ScatterBase.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    ScatterBase.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterBase, 'raisePropertyChanged', ['ErrorBarSettings:zj:acf', [ScatterErrorBarSettings.$, null], 'HighlightedXMemberPath:aay:acg', [2, null], 'HighlightedYMemberPath:aa0:ach', [2, null], 'IsCustomScatterMarkerStyleAllowed:z9:aci', [0, false], 'IsCustomScatterStyleAllowed:aaa:acj', [0, false], 'ItemSearchMode:zt:ack', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:aat:acl', [1, 10000], 'MarkerCollisionAvoidance:ze:acm', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:aau:acn', [1, 400], 'XAxis::acv', [NumericXAxis.$, null], 'XMemberAsLegendLabel:aba:acw', [2, null], 'XMemberAsLegendUnit:abc:acx', [2, null], 'XMemberPath:abe:acy', [2, null], 'YAxis::acz', [NumericYAxis.$, null], 'YMemberAsLegendLabel:abi:ac0', [2, null], 'YMemberAsLegendUnit:abk:ac1', [2, null], 'YMemberPath:abm:ac2', [2, null], 'TrendLineType::act', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::acs', [1, 1.5], 'TrendLinePeriod::acr', [1, 7], 'TrendLineBrush::aco', [Brush.$, null], 'TrendLineZIndex:aav:acu', [1, 1001], 'TrendLineDashArray:ac4:acp', [DoubleCollection.$], 'TrendLineDashCap:ac5:acq', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return ScatterBase;
}(MarkerSeries));
export { ScatterBase };
/**
 * @hidden
 */
var ScatterSeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterSeriesRenderManager, _super);
    function ScatterSeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.aw = null;
        _this.ax = null;
        return _this;
    }
    ScatterSeriesRenderManager.prototype.c = function () {
        this.aw = new AssigningScatterMarkerStyleEventArgs();
        return this.aw;
    };
    ScatterSeriesRenderManager.prototype.a = function () {
        this.ax = new AssigningScatterStyleEventArgs();
        return this.ax;
    };
    ScatterSeriesRenderManager.prototype.ay = function (a, b, c) {
        this.w(a, b, c);
    };
    ScatterSeriesRenderManager.prototype.az = function (a, b, c) {
        this.x(a, b, c);
    };
    ScatterSeriesRenderManager.prototype.a0 = function (a, b, c, d) {
        if (b == -1) {
            a.e = false;
            a.z = 0;
            a.y = c - 1;
        }
        else {
            if (d) {
                a.z = b;
                a.y = b;
            }
            else {
                a.e = false;
                a.z = b;
                a.y = b;
            }
        }
    };
    ScatterSeriesRenderManager.$t = markType(ScatterSeriesRenderManager, 'ScatterSeriesRenderManager', SeriesRenderManager.$);
    return ScatterSeriesRenderManager;
}(SeriesRenderManager));
export { ScatterSeriesRenderManager };
/**
 * @hidden
 */
var ScatterBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterBaseView, _super);
    function ScatterBaseView(a) {
        var _this = _super.call(this, a) || this;
        _this.dd = null;
        _this.db = null;
        _this.de = null;
        _this.dj = null;
        _this.dv = null;
        _this.dw = null;
        _this.df = null;
        _this.du = null;
        _this.dg = null;
        _this.de = a;
        _this.dg = new HashPool$2(Base.$, Marker.$);
        _this.cz(_this.dg);
        _this.df = new ScatterTrendLineManager();
        return _this;
    }
    ScatterBaseView.prototype.a4 = function () {
        _super.prototype.a4.call(this);
        this.dd = this.dc();
        this.dv = new Path();
        this.dw = new Path();
        if (!this.t) {
            this.de.aau = 2000;
        }
    };
    ScatterBaseView.prototype.dx = function (a) {
        if (this.du == null) {
            this.du = new DataTemplateMeasureInfo();
            this.du.context = this.m.h();
        }
        this.du.width = a.width;
        this.du.height = a.height;
        this.du.data = a.content;
        var b = a.ah;
        if (b.measure != null) {
            b.measure(this.du);
        }
        return new Size(1, this.du.width, this.du.height);
    };
    ScatterBaseView.prototype.dc = function () {
        var _this = this;
        var a = new NumericMarkerManager(1, function (b) { return _this.dg.item(b); }, function (b) { return _this.de.zh.c.item(b); }, runOn(this, this.ds), runOn(this, this.c9), runOn(this, this.dh), function () { return _this.de.ze; });
        a.q = runOn(this, this.dx);
        return a;
    };
    ScatterBaseView.prototype.ds = function (a) {
        this.de.ab7(a, this.dg);
    };
    ScatterBaseView.prototype.di = function () {
        return this.cl;
    };
    ScatterBaseView.prototype.da = function () {
        return this.db;
    };
    ScatterBaseView.prototype.c9 = function () {
        this.db = this.de.y9(this, this.dg, this.db, this.ca, this.b9);
        return this.db;
    };
    ScatterBaseView.prototype.dh = function () {
        this.dj = this.de.aai(this.dg, this.dj);
        return this.dj;
    };
    ScatterBaseView.prototype.dk = function () {
    };
    ScatterBaseView.prototype.dq = function (a) {
    };
    ScatterBaseView.prototype.dl = function () {
    };
    ScatterBaseView.prototype.dr = function (a) {
    };
    ScatterBaseView.prototype.dt = function () {
        if (this.de.trendLineBrush != null) {
            this.de.ac3 = this.de.trendLineBrush;
        }
        else {
            this.de.ac3 = this.de.vt;
        }
    };
    ScatterBaseView.prototype.cw = function (a) {
        this.dg.f(a);
    };
    ScatterBaseView.prototype.dn = function (a) {
        this.dg.g(a);
    };
    ScatterBaseView.prototype.dp = function () {
    };
    ScatterBaseView.prototype.bi = function (a, b) {
        _super.prototype.bi.call(this, a, b);
        if (a.d) {
            if (this.de.trendLineType != 0 && !b) {
                var c = this.df.g$n;
                c.ad = this.de.trendLineThickness;
                c._stroke = this.de.ac3;
                c.ai = this.de.ac4;
                c.aj = this.de.ac5;
                a.v(c);
            }
        }
    };
    ScatterBaseView.prototype.dm = function (a) {
        if (a) {
            this.dp();
            this.dg.clear();
        }
        this.df.g$h();
        this.a2();
    };
    ScatterBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span";
        var b = this.f.ba.a$v(this.f);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.de.title + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.de.abe + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.de.abm + "}</span></div>";
        return a;
    };
    ScatterBaseView.$t = markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
}(MarkerSeriesView));
export { ScatterBaseView };