igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,354 lines (1,353 loc) • 51.2 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends, __values } from "tslib";
import { Series } from "./Series";
import { UserAnnotationCollection } from "./UserAnnotationCollection";
import { JsonDictionaryParser } from "igniteui-react-core";
import { JsonDictionaryArray } from "igniteui-react-core";
import { UserBaseAnnotation } from "./UserBaseAnnotation";
import { JsonDictionaryObject } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-react-core";
import { BrushUtil } from "igniteui-react-core";
import { UserAnnotationFlow } from "./UserAnnotationFlow";
import { HashSet$1 } from "igniteui-react-core";
import { DataAnnotationSliceLayer } from "./DataAnnotationSliceLayer";
import { DataAnnotationStripLayer } from "./DataAnnotationStripLayer";
import { UserAnnotationDataContext } from "./UserAnnotationDataContext";
import { ObservableCollection$1 } from "igniteui-react-core";
import { CalloutLayer } from "./CalloutLayer";
import { Base, typeCast, runOn, delegateCombine, String_$type, Point_$type, delegateRemove, fromEnum, markType } from "igniteui-react-core";
import { UserAnnotationPointDataContext } from "./UserAnnotationPointDataContext";
import { UserPointAnnotation } from "./UserPointAnnotation";
import { UserSliceAnnotation } from "./UserSliceAnnotation";
import { UserStripAnnotation } from "./UserStripAnnotation";
import { UserAnnotationInformationEventArgs } from "./UserAnnotationInformationEventArgs";
import { ScalerParams } from "./ScalerParams";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { UserAnnotationInformation } from "./UserAnnotationInformation";
import { Tuple$2 } from "igniteui-react-core";
import { CalloutAnnotationWrapper } from "./CalloutAnnotationWrapper";
import { CalloutView } from "./CalloutView";
import { PlatformAPIHelper } from "igniteui-react-core";
import { AutomaticSeriesRequest } from "./AutomaticSeriesRequest";
import { AxisAnnotation } from "./AxisAnnotation";
import { UserAnnotationStripDataContext } from "./UserAnnotationStripDataContext";
import { UserAnnotationAxisDataContext } from "./UserAnnotationAxisDataContext";
import { UserAnnotationSliceDataContext } from "./UserAnnotationSliceDataContext";
import { truncate, isNaN_ } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
* @hidden
*/
var UserAnnotationLayer = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(UserAnnotationLayer, _super);
function UserAnnotationLayer() {
var _this = _super.call(this) || this;
_this.yr = "UserLayer";
_this.xm = new UserAnnotationCollection();
_this.yi = new List$1(Axis.$, 0);
_this.yb = new Dictionary$2(Axis.$, Axis.$, 0);
_this.zp = BrushUtil.j(255, 255, 255, 255);
_this.zo = BrushUtil.j(255, 0, 0, 0);
_this.xj = null;
_this.x7 = new Dictionary$2(String_$type, UserAnnotationFlow.$, 0);
_this.userAnnotationInformationRequested = null;
_this.yj = new List$1(UserAnnotationItems.$, 0);
_this.x5 = new Dictionary$2(String_$type, UserBaseAnnotation.$, 0);
_this.yh = new HashSet$1(Axis.$, 0);
_this.yf = new HashSet$1(Axis.$, 0);
_this.ya = new Dictionary$2(Axis.$, DataAnnotationSliceLayer.$, 0);
_this.ye = new Dictionary$2(Axis.$, DataAnnotationStripLayer.$, 0);
_this.x9 = new Dictionary$2(Axis.$, HashSet$1.$.specialize(UserAnnotationDataContext.$), 0);
_this.x8 = new Dictionary$2(Axis.$, ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), 0);
_this.yd = new Dictionary$2(Axis.$, HashSet$1.$.specialize(UserAnnotationDataContext.$), 0);
_this.yc = new Dictionary$2(Axis.$, ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), 0);
_this.yg = new HashSet$1(UserAnnotationDataContext.$, 0);
_this.yl = new ObservableCollection$1(UserAnnotationDataContext.$, 0);
_this.x6 = new Dictionary$2(Axis.$, HashSet$1.$.specialize(UserAnnotationDataContext.$), 0);
_this.xl = null;
_this.stylingAxisAnnotation = null;
_this.stylingSliceAnnotation = null;
_this.stylingStripAnnotation = null;
_this.stylingPointAnnotation = null;
UserAnnotationLayer.yo++;
_this.yr = "UserLayer" + UserAnnotationLayer.yo;
var a = _this.xm;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.yt));
var b = _this.xm;
b.collectionResetting = delegateCombine(b.collectionResetting, runOn(_this, _this.yu));
return _this;
}
Object.defineProperty(UserAnnotationLayer.prototype, "annotations", {
get: function () {
return this.xm;
},
enumerable: false,
configurable: true
});
UserAnnotationLayer.prototype.get_ev = function () {
return true;
};
UserAnnotationLayer.prototype.get_f9 = function () {
return true;
};
UserAnnotationLayer.prototype.get_isUsableInLegend = function () {
return false;
};
UserAnnotationLayer.prototype.y6 = function (a) {
var b = new JsonDictionaryParser();
var c = b.parse(a);
if (typeCast(JsonDictionaryObject.$, c) !== null && c.g("annotations")) {
var d = c.item("annotations");
if (typeCast(JsonDictionaryArray.$, d) !== null) {
var e = d;
if (e.items != null) {
this.annotations.clear();
for (var f = 0; f < e.items.length; f++) {
var g = e.items[f];
if (typeCast(JsonDictionaryObject.$, g) !== null) {
var h = UserBaseAnnotation.l(g);
this.annotations.add(h);
}
}
}
}
}
};
UserAnnotationLayer.prototype.yp = function () {
var a = new JsonDictionaryObject();
var b = new JsonDictionaryArray();
a.item("annotations", b);
b.items = new Array(this.annotations.count);
for (var c = 0; c < b.items.length; c++) {
var d = this.annotations._inner[c];
var e = d.n();
b.items[c] = e;
}
return a.b();
};
UserAnnotationLayer.prototype.y0 = function (a) {
if (this.da == null) {
return;
}
if (this.da.zq == null) {
return;
}
if (this.da.zq.count < 2) {
return;
}
if (this.yb.containsKey(a)) {
return;
}
var b = this.xk(a);
if (b == null) {
var c = a;
c.ct = true;
c.of = BrushUtil.j(0, 255, 255, 255);
c.ok = BrushUtil.j(0, 255, 255, 255);
c.fm = 0;
this.yb.addItem(a, b);
}
};
UserAnnotationLayer.prototype.y1 = function (a) {
if (this.da == null) {
return;
}
if (this.da.zq == null) {
return;
}
if (this.da.zq.count < 2) {
return;
}
if (this.yb.containsKey(a)) {
this.yb.removeItem(a);
var b = this.xk(a);
a.ct = false;
}
};
UserAnnotationLayer.prototype.xk = function (a) {
for (var b = 0; b < this.da.zq.count; b++) {
var c = this.da.zq._inner[b];
if (c.dh && c.ao == a) {
return c;
}
}
return null;
};
UserAnnotationLayer.prototype.zq = function (a, b) {
return a != null ? a : b;
};
UserAnnotationLayer.prototype.y5 = function (a, b) {
var c = typeCast(UserAnnotationPointDataContext.$, b.item);
if (c != null) {
var d = c.b;
if (d != null) {
d.ay(this.dc);
b.a = d.targetSeries;
}
}
};
UserAnnotationLayer.prototype.y9 = function (a, b) {
var c = b.o;
var d = c.b;
if (d != null) {
if (d.bo != null) {
b.textColor = d.bo;
}
if (d.bm != null) {
b.background = d.bm;
}
if (d.bn != null) {
b.outline = d.bn;
b.leaderBrush = d.bn;
}
if (!isNaN_(d.y)) {
b.strokeThickness = d.y;
}
if (!isNaN_(d.x)) {
b.backgroundCorner = d.x;
}
if (!isNaN_(d.z)) {
b.bacgkroundPaddingLeft = d.z;
b.bacgkroundPaddingBottom = d.z;
b.bacgkroundPaddingTop = d.z;
b.bacgkroundPaddingRight = d.z;
}
if (!stringIsNullOrEmpty(d.ag)) {
b.badgeImage = d.ag;
}
if (d.bk != null) {
b.badgeBackground = d.bk;
}
if (d.bl != null) {
b.badgeOutline = d.bl;
}
if (d.w >= 0) {
b.badgeThickness = d.w;
}
if (d.t >= 0) {
b.badgeCorner = d.t;
}
if (d.u >= 0) {
b.badgeGap = d.u;
}
if (d.v > 0) {
b.badgeWidth = d.v;
b.badgeHeight = d.v;
}
b.badgeVisible = d.p;
}
};
UserAnnotationLayer.prototype.y8 = function (a, b) {
var c = b.l;
if (typeCast(UserAnnotationPointDataContext.$, c) !== null) {
var d = c.b;
if (d != null) {
if (d.r) {
b.backgroundCorner = b.height * 0.5;
}
}
}
};
UserAnnotationLayer.prototype.y7 = function (a, b) {
if (b != null) {
a.textContent = b.overlayText;
a.textVisible = b.overlayTextVisible;
a.textLocation = b.overlayTextLocation;
a.borderMode = b.overlayTextBorderMode;
a.backgroundMode = b.overlayTextBackgroundMode;
a.textColorMode = b.overlayTextColorMode;
if (b.overlayTextBackground != null) {
a.background = b.overlayTextBackground;
}
if (b.overlayTextBorderColor != null) {
a.borderStroke = b.overlayTextBorderColor;
}
if (b.overlayTextColor != null) {
a.textColor = b.overlayTextColor;
}
if (!isNaN_(b.overlayTextBorderShift)) {
a.borderShift = b.overlayTextBorderShift;
}
if (!isNaN_(b.overlayTextBorderRadius)) {
a.borderRadius = b.overlayTextBorderRadius;
}
if (!isNaN_(b.overlayTextBackgroundShift)) {
a.backgroundShift = b.overlayTextBackgroundShift;
}
if (!isNaN_(b.overlayTextColorShift)) {
a.textColorShift = b.overlayTextColorShift;
}
if (!isNaN_(b.overlayTextAngle)) {
a.textAngle = b.overlayTextAngle;
}
if (!isNaN_(b.overlayTextBorderThickness)) {
a.borderThickness = b.overlayTextBorderThickness;
}
}
};
UserAnnotationLayer.prototype.zb = function (a, b) {
var c = b.dataIndex;
var d = typeCast(Series.$, a);
if (d != null) {
var e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
var f = e._inner[c].b;
this.y7(b, f);
}
}
};
UserAnnotationLayer.prototype.ze = function (a, b) {
var c = b.dataIndex;
var d = typeCast(Series.$, a);
if (d != null) {
var e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
var f = e._inner[c].b;
this.y7(b, f);
}
}
};
UserAnnotationLayer.prototype.zc = function (a, b) {
var c = (b.dataIndex);
var d = typeCast(Series.$, a);
if (d != null) {
var e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
var f = e._inner[c].b;
if (f != null) {
if (f.shapeBackground != null) {
b.shapeBrush = f.shapeBackground;
}
if (f.shapeOutline != null) {
b.shapeOutline = f.shapeOutline;
}
if (!isNaN_(f.shapeThickness)) {
b.shapeThickness = f.shapeThickness;
}
}
}
}
};
UserAnnotationLayer.prototype.za = function (a, b) {
var c = truncate((b.dataIndex));
var d = typeCast(Series.$, a);
if (d != null) {
var e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
var f = e._inner[c].b;
if (f != null) {
if (b.j) {
if (f.valueDisplayMode != 0) {
b.a = f.valueDisplayMode;
}
}
if (b.k) {
if (f.valueDisplayMode != 0) {
b.b = f.valueDisplayMode;
}
}
if (!isNaN_(f.x)) {
b.borderRadius = f.x;
}
if (!isNaN_(f.y)) {
b.borderThickness = f.y;
}
if (f.bo != null) {
b.textColor = f.bo;
}
if (f.bm != null) {
b.background = f.bm;
}
if (f.bn != null) {
b.borderColor = f.bn;
}
}
}
}
};
UserAnnotationLayer.prototype.zd = function (a, b) {
var c = truncate((b.dataIndex));
var d = typeCast(Series.$, a);
if (d != null) {
var e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
var f = e._inner[c].b;
if (f != null) {
if (b.j) {
if (f.valueDisplayMode != 0) {
b.a = f.valueDisplayMode;
}
if (b.isStartLabel) {
if (f.valueDisplayMode != 0) {
b.a = f.valueDisplayMode;
}
if (f.startValueDisplayMode != 0) {
b.a = f.startValueDisplayMode;
}
}
if (b.isEndLabel) {
if (f.valueDisplayMode != 0) {
b.a = f.valueDisplayMode;
}
if (f.endValueDisplayMode != 0) {
b.a = f.endValueDisplayMode;
}
}
}
if (b.k) {
if (f.valueDisplayMode != 0) {
b.b = f.valueDisplayMode;
}
if (b.isStartLabel) {
if (f.valueDisplayMode != 0) {
b.b = f.valueDisplayMode;
}
if (f.startValueDisplayMode != 0) {
b.b = f.startValueDisplayMode;
}
}
if (b.isEndLabel) {
if (f.valueDisplayMode != 0) {
b.b = f.valueDisplayMode;
}
if (f.endValueDisplayMode != 0) {
b.b = f.endValueDisplayMode;
}
}
}
if (!isNaN_(f.x)) {
b.borderRadius = f.x;
}
if (!isNaN_(f.y)) {
b.borderThickness = f.y;
}
if (f.bo != null) {
b.textColor = f.bo;
}
if (f.bm != null) {
b.background = f.bm;
}
if (f.bn != null) {
b.borderColor = f.bn;
}
if (b.isStartLabel) {
if (f.startLabelColor != null) {
b.textColor = f.startLabelColor;
}
if (f.startLabelBackground != null) {
b.background = f.startLabelBackground;
}
if (f.startLabelBorderColor != null) {
b.borderColor = f.startLabelBorderColor;
}
}
if (b.isEndLabel) {
if (f.endLabelColor != null) {
b.textColor = f.endLabelColor;
}
if (f.endLabelBackground != null) {
b.background = f.endLabelBackground;
}
if (f.endLabelBorderColor != null) {
b.borderColor = f.endLabelBorderColor;
}
}
}
}
}
};
UserAnnotationLayer.prototype.zf = function (a, b) {
var c = (b.dataIndex);
var d = typeCast(Series.$, a);
if (d != null) {
var e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
var f = e._inner[c].b;
if (f != null) {
if (f.shapeBackground != null) {
b.shapeBrush = f.shapeBackground;
}
if (f.shapeOutline != null) {
b.shapeOutline = f.shapeOutline;
}
if (!isNaN_(f.shapeThickness)) {
b.shapeThickness = f.shapeThickness;
}
}
}
}
};
UserAnnotationLayer.prototype.rq = function (a, b, c, d) {
_super.prototype.rq.call(this, a, b, c, d);
if (b == "SeriesViewer") {
if (c != null) {
this.yz(c);
}
if (d != null) {
this.yv(d);
}
}
else {
this.zg(b);
}
};
UserAnnotationLayer.prototype.yk = function (a) {
return this.xj.j(this.yr, a);
};
UserAnnotationLayer.prototype.yv = function (a) {
a.seriesClick = delegateCombine(a.seriesClick, runOn(this, this.zk));
a.axisLabelMouseClick = delegateCombine(a.axisLabelMouseClick, runOn(this, this.zj));
a.viewerManipulationEnding = delegateCombine(a.viewerManipulationEnding, runOn(this, this.zl));
this.xj = this.dc.ao(this.dc);
for (var b = 0; b < this.yj.count; b++) {
this.y3(this.yj._inner[b]);
}
this.userAnnotationInformationRequested = delegateCombine(this.userAnnotationInformationRequested, runOn(this.dc, this.dc.ru));
};
UserAnnotationLayer.prototype.zl = function (a, b) {
if (b.isDragSelect) {
if (this.dc != null && this.dc.f0) {
var c = b.dragSelectRectangle;
if (!c.isEmpty) {
b.isDragSelectCancelled = true;
var d = null;
for (var e = 0; e < this.da.zq.count; e++) {
var f = this.da.zq._inner[e];
if (f.dh) {
continue;
}
if (!f.dy) {
d = f;
break;
}
}
if (d != null) {
if (d.df && !d.dj) {
var g = this.da.yw(c);
var h = new ScalerParams(1, this.da.yr, this.da.y9, d.dn);
h.c = this.getEffectiveViewport();
var i = d.f9(g.left, h);
var j = d.f9(g.right, h);
if (d.dn) {
var k = i;
i = j;
j = k;
}
i = Math.floor(i);
j = Math.ceil(j);
var l = this.xo();
var m = this.xz(d, i, j);
l.b = m;
this.zm(l);
this.ys(l);
this.zi(l);
this.dc.uc(l.d);
}
}
}
}
}
};
UserAnnotationLayer.prototype.zj = function (a, b) {
var c = b.h;
var d = b.a;
var e = b.c;
if (this.dc.f0) {
if (d.df && !d.dj) {
var f = typeCast(CategoryAxisBase.$, d);
e = f.categoryMode == 2 ? Math.floor(e) : Math.round(e);
}
var g = this.xo();
var h = this.xy(d, c, e);
g.b = h;
this.zm(g);
this.ys(g);
this.zi(g);
this.dc.uc(g.d);
}
if (this.dc.f1) {
if (d.df && !d.dj) {
var i = typeCast(CategoryAxisBase.$, d);
e = i.categoryMode == 2 ? Math.floor(e) : Math.round(e);
}
var j = this.x0(d, c, e);
}
};
UserAnnotationLayer.prototype.x0 = function (a, b, c) {
for (var d = this.annotations.count - 1; d >= 0; d--) {
var e = this.annotations._inner[d];
if (e.k == 0) {
var f = typeCast(UserSliceAnnotation.$, this.annotations._inner[d]);
if (f != null && f.value == c) {
this.annotations.removeAt(d);
this.dc.pa();
return e;
}
}
if (e.k == 1) {
var g = typeCast(UserStripAnnotation.$, this.annotations._inner[d]);
if (g != null && (g.startValue <= c || g.endValue >= c)) {
this.annotations.removeAt(d);
this.dc.pa();
return e;
}
}
}
return null;
};
UserAnnotationLayer.prototype.xy = function (a, b, c) {
var d = new UserSliceAnnotation();
d.targetAxisMatcher = a.a9();
d.value = c;
d.aq = " ";
return d;
};
UserAnnotationLayer.prototype.xz = function (a, b, c) {
var d = new UserStripAnnotation();
d.targetAxisMatcher = a.a9();
d.startValue = b;
d.endValue = c;
d.aq = " ";
return d;
};
UserAnnotationLayer.prototype.zk = function (a, b) {
if (!this.dc.y9.containsPoint(b.chartPosition)) {
return;
}
var c = b.series;
var d = b.item;
var e = b.worldPosition;
if (this.dc.f0) {
b.cancelSelection = true;
var f = this.xo();
f.b = this.x1(c, d, e);
if (f.b == null) {
return;
}
this.zm(f);
this.ys(f);
this.zi(f);
this.dc.uc(f.d);
}
if (this.dc.f1) {
b.cancelSelection = true;
this.yy(c, d, e);
this.dc.pa();
}
};
UserAnnotationLayer.prototype.zm = function (a) {
if (!this.x7.containsKey(a.d)) {
this.x7.addItem(a.d, a);
}
if (a.b != null) {
a.b.an = a.d;
}
};
UserAnnotationLayer.prototype.zi = function (a) {
var _this = this;
if (this.userAnnotationInformationRequested != null) {
this.userAnnotationInformationRequested(this, ((function () {
var $ret = new UserAnnotationInformationEventArgs();
$ret.annotationInfo = _this.xq(a);
return $ret;
})()));
}
};
UserAnnotationLayer.prototype.xq = function (a) {
return a.a;
};
UserAnnotationLayer.prototype.yw = function (a) {
if (this.x7.containsKey(a)) {
var b = this.x7.item(a);
var c = b.b;
if (this.annotations.contains(c)) {
this.annotations.remove(c);
}
this.x7.removeItem(a);
}
};
UserAnnotationLayer.prototype.y4 = function (a) {
if (a.d != null) {
if (this.x7.containsKey(a.d)) {
var b = this.x7.item(a.d);
this.yx(b, a);
this.zn(b);
this.x7.removeItem(a.d);
}
}
};
UserAnnotationLayer.prototype.zn = function (a) {
var b = a.a;
var c = a.b;
if (b != null && c != null) {
c.aq = b.f;
c.ac = b.c;
c.bk = b.h;
c.bm = b.i;
c.bn = b.i;
c.ag = b.e;
switch (c.k) {
case 3: break;
case 1:
var d = c;
d.shapeBackground = BrushUtil.s(b.i, 0.3);
d.startLabelBackground = b.i;
d.endLabelBackground = b.i;
d.startLabelBorderColor = b.i;
d.endLabelBorderColor = b.i;
break;
case 0:
var e = c;
e.shapeOutline = b.i;
e.bm = b.i;
e.bn = b.i;
break;
case 2:
var f = c;
f.bm = b.i;
f.bk = b.h;
f.bn = b.i;
break;
}
}
};
UserAnnotationLayer.prototype.yx = function (a, b) {
var c = a.a;
c.g(b);
};
UserAnnotationLayer.prototype.ys = function (a) {
this.annotations.add(a.b);
};
UserAnnotationLayer.prototype.x1 = function (a, b, c) {
var d = new UserPointAnnotation();
d.targetSeriesMatcher = a.cg();
var e = a.ww(c, false, false);
var f = a.w1(e);
if (isNaN_(f.x) || isNaN_(f.y)) {
return null;
}
d.xValue = f.x;
d.yValue = f.y;
d.aq = " ";
return d;
};
UserAnnotationLayer.prototype.yy = function (a, b, c) {
if (a.eq) {
var d = this.oz(a, c);
var e = typeCast(Tuple$2.$.specialize(CalloutAnnotationWrapper.$, CalloutView.$), a.kw(d.d));
if (e == null || e.c == null || e.c.b == null || e.c.b.n == null) {
return;
}
var f = e.c.b.n.b;
for (var g = this.annotations.count - 1; g >= 0; g--) {
var h = this.annotations._inner[g];
if (h.k == 2) {
var i = h;
if (i == f) {
this.annotations.removeAt(g);
break;
}
}
}
return;
}
var j = a.ww(c, false, false);
var k = a.w1(j);
if (isNaN_(k.x) || isNaN_(k.y)) {
return;
}
for (var l = this.annotations.count - 1; l >= 0; l--) {
var m = this.annotations._inner[l];
if (m.k == 2) {
var n = m;
if (n.xValue == k.x && n.yValue == k.y) {
this.annotations.removeAt(l);
}
}
}
};
UserAnnotationLayer.prototype.xo = function () {
var a = new UserAnnotationFlow();
a.a = this.xp(a.d);
return a;
};
UserAnnotationLayer.prototype.xp = function (a) {
var b = new UserAnnotationInformation();
b.h = BrushUtil.j(255, 255, 255, 255);
b.f = " ";
b.i = BrushUtil.j(255, 0, 0, 0);
b.d = a;
if (this.dc != null) {
b.a = this.dc.y9.left + (this.dc.y9.width / 2);
b.b = this.dc.y9.top + (this.dc.y9.height / 2);
}
var c = this.zr({ $type: Point_$type, x: b.a, y: b.b });
b.a = c.x;
b.b = c.y;
return b;
};
UserAnnotationLayer.prototype.zr = function (a) {
var b = 0;
var c = 0;
if (this.dc != null) {
var d = this.dc.yk();
b += d.x;
c += d.y;
}
return { $type: Point_$type, x: b + a.x, y: c + a.y };
};
UserAnnotationLayer.prototype.yz = function (a) {
a.seriesClick = delegateRemove(a.seriesClick, runOn(this, this.zk));
a.axisLabelMouseClick = delegateRemove(a.axisLabelMouseClick, runOn(this, this.zj));
for (var b = 0; b < this.yj.count; b++) {
this.y3(this.yj._inner[b]);
}
this.userAnnotationInformationRequested = delegateRemove(this.userAnnotationInformationRequested, runOn(a, a.ru));
};
UserAnnotationLayer.prototype.zg = function (a) {
var e_1, _a;
if (this.xj == null) {
return;
}
var b = new List$1(Series.$, 0);
b.o(this.yk(12));
b.o(this.yk(13));
b.o(this.yk(14));
try {
for (var _b = __values(fromEnum(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
if (a == "Brush") {
c.vz = this.vz;
}
else if (a == "Outline") {
c.wf = this.wf;
}
else if (a == "OutlineMode") {
c.cj = this.cj;
}
else if (a == "Thickness") {
c.jy = this.jy;
}
else if (a == "Resolution") {
c.jr = this.jr;
}
else if (a == "DashArray") {
c.wm = this.wm;
}
else if (a == "DashCap") {
c.wn = this.wn;
}
else if (a == "AreaFillOpacity") {
c.ir = this.ir;
}
}
}
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;
}
}
};
UserAnnotationLayer.prototype.yu = function (a, b) {
};
UserAnnotationLayer.prototype.yt = function (a, b) {
switch (b.action) {
case 0:
if (b.newItems != null) {
for (var c = 0; c < b.newItems.count; c++) {
var d = b.newItems.item(c);
var e = this.xs(d);
if (d != null) {
this.x5.item(d.an, d);
}
this.yj.insert(c + b.newStartingIndex, e);
this.y2(e);
}
}
break;
case 1:
if (b.oldItems != null) {
for (var f = 0; f < b.oldItems.count; f++) {
var g = b.oldItems.item(f);
if (g != null) {
if (this.x5.containsKey(g.an)) {
this.x5.removeItem(g.an);
}
}
var h = this.yj._inner[b.oldStartingIndex];
this.yj.removeAt(b.oldStartingIndex);
this.y3(h);
}
}
break;
case 2:
if (b.oldItems != null) {
for (var i = 0; i < b.oldItems.count; i++) {
var j = b.oldItems.item(i);
if (j != null) {
if (this.x5.containsKey(j.an)) {
this.x5.removeItem(j.an);
}
}
var k = this.yj._inner[b.oldStartingIndex];
this.yj.removeAt(b.oldStartingIndex);
this.y3(k);
}
}
if (b.newItems != null) {
for (var l = 0; l < b.newItems.count; l++) {
var m = b.newItems.item(l);
var n = this.xs(m);
if (m != null) {
this.x5.item(m.an, m);
}
this.y2(n);
this.yj.insert(l + b.newStartingIndex, n);
}
}
break;
case 4:
for (var o = this.yj.count - 1; o >= 0; o--) {
var p = this.yj._inner[o];
if (p.k != null) {
if (this.x5.containsKey(p.k.an)) {
this.x5.removeItem(p.k.an);
}
}
this.yj.removeAt(o);
this.y3(p);
}
this.yj.clear();
break;
}
};
UserAnnotationLayer.prototype.yq = function (a) {
return PlatformAPIHelper.r(a);
};
UserAnnotationLayer.prototype.y2 = function (a) {
if (a == null) {
return;
}
if (a.k == null || this.dc == null) {
return;
}
var b = a.k;
b.ay(this.dc);
if (a.l) {
var c = a.k.targetAxis;
if (c != null) {
if (a.h != null) {
if (this.ya.containsKey(c)) {
a.c = this.ya.item(c);
}
if (!this.x9.containsKey(c)) {
this.x9.addItem(c, new HashSet$1(UserAnnotationDataContext.$, 0));
}
if (!this.x8.containsKey(c)) {
this.x8.addItem(c, new ObservableCollection$1(UserAnnotationDataContext.$, 0));
}
var d = this.x9.item(c);
var e = this.x8.item(c);
if (!d.contains(a.h)) {
d.add_1(a.h);
e.add(a.h);
if (this.ya.containsKey(c)) {
this.ya.item(c).qw(e.count - 1, a.h);
}
}
}
if (a.h != null && !this.ya.containsKey(c)) {
var f = new DataAnnotationSliceLayer();
f.p0(this.dc);
this.ya.item(c, f);
a.c = f;
f.vz = this.vz;
f.wf = this.wf;
f.jy = this.jy;
f.wm = this.wm;
f.wn = this.wn;
var g = this.x9.item(c);
var h = this.x8.item(c);
f.mb = this.yr;
f.name = this.yr + "_SliceAnnotation" + (UserAnnotationLayer.ym++);
f.aff = this.yq("OverlayText");
f.aaw = 3;
f.ahl = this.yq("Label");
f.aho = this.yq("Value");
f.stylingAxisAnnotation = delegateCombine(f.stylingAxisAnnotation, runOn(this, this.za));
f.stylingShapeAnnotation = delegateCombine(f.stylingShapeAnnotation, runOn(this, this.zc));
f.stylingOverlayText = delegateCombine(f.stylingOverlayText, runOn(this, this.zb));
f.aav = c;
f.itemsSource = h;
f.adn = a.k;
var i = new AutomaticSeriesRequest();
i.d = f;
i.a = 12;
i.g = true;
this.xj.b.add(i);
}
if (a.i != null) {
if (this.ye.containsKey(c)) {
a.d = this.ye.item(c);
}
if (!this.yd.containsKey(c)) {
this.yd.addItem(c, new HashSet$1(UserAnnotationDataContext.$, 0));
}
if (!this.yc.containsKey(c)) {
this.yc.addItem(c, new ObservableCollection$1(UserAnnotationDataContext.$, 0));
}
var j = this.yd.item(c);
var k = this.yc.item(c);
if (!j.contains(a.i)) {
j.add_1(a.i);
k.add(a.i);
if (this.ye.containsKey(c)) {
this.ye.item(c).qw(k.count - 1, a.i);
}
}
}
if (a.i != null && !this.ye.containsKey(c)) {
var l = this.yd.item(c);
var m = this.yc.item(c);
var n = new DataAnnotationStripLayer();
n.p0(this.dc);
this.ye.item(c, n);
a.d = n;
n.vz = this.vz;
n.wf = this.wf;
n.cj = this.cj;
n.jy = this.jy;
n.jr = this.jr;
n.wm = this.wm;
n.wn = this.wn;
n.mb = this.yr;
n.name = this.yr + "_StripAnnotation" + (UserAnnotationLayer.ym++);
n.aff = this.yq("OverlayText");
n.ahp = 3;
n.aix = this.yq("StartLabel");
n.ai0 = this.yq("StartValue");
n.aho = 3;
n.aiq = this.yq("EndLabel");
n.ait = this.yq("EndValue");
n.aim = this.yq("Label");
n.ahn = 6;
n.stylingAxisAnnotation = delegateCombine(n.stylingAxisAnnotation, runOn(this, this.zd));
n.stylingShapeAnnotation = delegateCombine(n.stylingShapeAnnotation, runOn(this, this.zf));
n.stylingOverlayText = delegateCombine(n.stylingOverlayText, runOn(this, this.ze));
n.aav = c;
n.itemsSource = m;
n.adn = a.k;
var o = new AutomaticSeriesRequest();
o.d = n;
o.a = 13;
o.g = true;
this.xj.b.add(o);
}
if (a.e != null) {
if (!this.x6.containsKey(c)) {
this.x6.addItem(c, new HashSet$1(UserAnnotationDataContext.$, 0));
}
var p = this.x6.item(c);
}
if (a.e != null) {
this.yf.add_1(c);
this.y0(c);
var q = this.x6.item(c);
if (!q.contains(a.e)) {
q.add_1(a.e);
var r = this.xk(c);
var s = new AxisAnnotation();
a.a = s;
a.o();
if (r.df && !r.dj) {
var t = typeCast(CategoryAxisBase.$, r);
if (t.categoryMode != 0) {
s.m = true;
}
}
r.at.add(s);
}
}
}
}
if (a.g != null) {
if (this.xl != null) {
a.b = this.xl;
}
if (!this.yg.contains(a.g)) {
this.yg.add_1(a.g);
this.yl.add(a.g);
if (this.xl != null) {
this.xl.qw(this.yl.count - 1, a.g);
}
}
}
if (a.g != null && this.xl == null) {
var u = new CalloutLayer();
u.p0(this.dc);
this.xl = u;
a.b = u;
u.vz = this.vz;
u.wf = this.wf;
u.cj = this.cj;
u.jy = this.jy;
u.jr = this.jr;
u.wm = this.wm;
u.wn = this.wn;
u.calloutSeriesSelecting = delegateCombine(u.calloutSeriesSelecting, runOn(this, this.y5));
u.mb = this.yr;
u.name = this.yr + "_CalloutAnnotation" + (UserAnnotationLayer.ym++);
u.afq = this.yq("XValue");
u.aft = this.yq("YValue");
u.aev = this.yq("Label");
u.afa = this.yq("Label");
u.ace = false;
u.aco = false;
u.ach = true;
u.acg = true;
u.calloutStyleUpdating = delegateCombine(u.calloutStyleUpdating, runOn(this, this.y9));
u.calloutRenderStyleUpdating = delegateCombine(u.calloutRenderStyleUpdating, runOn(this, this.y8));
u.itemsSource = this.yl;
var v = new AutomaticSeriesRequest();
v.d = u;
v.a = 14;
v.g = true;
this.xj.b.add(v);
}
};
UserAnnotationLayer.prototype.y3 = function (a) {
var b = a.k;
if (b == null) {
return;
}
if (a.l) {
var c = b.targetAxis;
if (c == null) {
return;
}
if (a.h != null) {
a.c = null;
if (this.x9.containsKey(c)) {
var d = this.x9.item(c);
var e = this.x8.item(c);
if (d.contains(a.h)) {
d.remove(a.h);
var f = e.indexOf(a.h);
e.remove(a.h);
this.ya.item(c).qx(f, a.h);
if (e.count == 0) {
this.x8.removeItem(c);
this.x9.removeItem(c);
var g = this.ya.item(c);
this.ya.removeItem(c);
this.zh(g);
}
}
}
}
if (a.i != null) {
a.d = null;
if (this.yd.containsKey(c)) {
var h = this.yd.item(c);
var i = this.yc.item(c);
if (h.contains(a.i)) {
h.remove(a.i);
var j = i.indexOf(a.i);
i.remove(a.i);
this.ye.item(c).qx(j, a.i);
if (i.count == 0) {
this.yc.removeItem(c);
this.yd.removeItem(c);
var k = this.ye.item(c);
this.ye.removeItem(c);
this.zh(k);
}
}
}
}
if (a.e != null) {
if (this.x6.containsKey(c)) {
var l = this.x6.item(c);
if (l.contains(a.e)) {
l.remove(a.e);
var m = this.xk(c);
if (m != null) {
if (m.at.contains(a.a)) {
m.at.remove(a.a);
a.a = null;
}
}
if (l.count == 0) {
this.y1(c);
}
}
}
}
}
if (a.g != null) {
if (this.yg.contains(a.g)) {
this.yg.remove(a.g);
var n = this.yl.indexOf(a.g);
this.yl.remove(a.g);
this.xl.qx(n, a.g);
}
if (this.yg.count == 0) {
this.zh(this.xl);
this.xl = null;
}
}
};
UserAnnotationLayer.prototype.zh = function (a) {
this.xj.t(a);
};
UserAnnotationLayer.prototype.xs = function (a) {
switch (a.k) {
case 3: return this.xt(a);
case 0: return this.xv(a);
case 2: return this.xu(a);
case 1: return this.xw(a);
}
return null;
};
UserAnnotationLayer.prototype.xw = function (a) {
var b = new UserAnnotationItems(this);
b.k = a;
b.i = new UserAnnotationStripDataContext(a);
b.e = new UserAnnotationAxisDataContext(a);
return b;
};
UserAnnotationLayer.prototype.xu = function (a) {
var b = new UserAnnotationItems(this);
b.k = a;
b.g = new UserAnnotationPointDataContext(a);
return b;
};
UserAnnotationLayer.prototype.xv = function (a) {
var b = new UserAnnotationItems(this);
b.k = a;
b.h = new UserAnnotationSliceDataContext(a);
b.e = new UserAnnotationAxisDataContext(a);
return b;
};
UserAnnotationLayer.prototype.xt = function (a) {
var b = new UserAnnotationItems(this);
b.k = a;
b.e = new UserAnnotationAxisDataContext(a);
return b;
};
UserAnnotationLayer.prototype.b3 = function () {
return 1;
};
UserAnnotationLayer.$t = markType(UserAnnotationLayer, 'UserAnnotationLayer', Series.$);
UserAnnotationLayer.yn = 0;
UserAnnotationLayer.yo = 0;
UserAnnotationLayer.ym = 0;
return UserAnnotationLayer;
}(Series));
export { UserAnnotationLayer };
/**
* @hidden
*/
var UserAnnotationItems = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(UserAnnotationItems, _super);
function UserAnnotationItems(a) {
var _this = _super.call(this) || this;
_this.f = null;
_this.j = null;
_this.c = null;
_this.h = null;
_this.d = null;
_this.i = null;
_this.b = null;
_this.g = null;
_this.e = null;
_this.a = null;
_this.f = a;
return _this;
}
Object.defineProperty(UserAnnotationItems.prototype, "k", {
get: function () {
return this.j;
},
set: function (a) {
var b = this.j;
this.j = a;
if (this.j != b) {
this.m(b, a);
}
},
enumerable: false,
configurable: true
});
UserAnnotationItems.prototype.o = function () {
if (this.a == null) {
return;
}
var a = this.a;
var b = this.k;
a.k = this.k;
a.o = true;
a.ag = this.f.yr;
a.value = b.value;
if (b.k == 1) {
var c = b;
a.value = (c.startValue + c.endValue) / 2;
}
a.text = b.aq;
a.textColor = this.f.zq(b.bo, this.f.zp);
a.background = this.f.zq(b.bm, this.f.zo);
a.outline = this.f.zq(b.bn, a.background);
a.isBadgeEnabled = b.p;
a.badgeOutline = this.f.zq(b.bl, a.textColor);
a.badgeBackground = this.f.zq(b.bk, a.textColor);
a.isPillShaped = b.r;
if (!stringIsNullOrEmpty(b.ag)) {
a.badgeImagePath = b.ag;
}
if (b.w >= 0) {
a.badgeOutlineThickness = b.w;
}
if (b.t >= 0) {
a.badgeCornerRadius = b.t;
}
if (b.u >= 0) {
a.badgeMargin = b.u;
}
if (b.v > 0) {
a.badgeSize = b.v;
}
if (!isNaN_(b.x)) {
a.backgroundCornerRadius = b.x;
}
if (!isNaN_(b.y)) {
a.strokeThickness = b.y;
}
if (!isNaN_(b.z)) {
a.backgroundPaddingTop = b.z;
}
if (!isNaN_(b.z)) {
a.backgroundPaddingLeft = b.z;
}
if (!isNaN_(b.z)) {
a.backgroundPaddingRight = b.z;
}
if (!isNaN_(b.z)) {
a.backgroundPaddingBottom = b.z;
}
};
UserAnnotationItems.prototype.m = function (a, b) {