igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,248 lines (1,247 loc) • 52.8 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Series } from "./Series";
import { UserAnnotationCollection } from "./UserAnnotationCollection";
import { JsonDictionaryParser } from "igniteui-angular-core";
import { JsonDictionaryArray } from "igniteui-angular-core";
import { UserBaseAnnotation } from "./UserBaseAnnotation";
import { JsonDictionaryObject } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { UserAnnotationFlow } from "./UserAnnotationFlow";
import { HashSet$1 } from "igniteui-angular-core";
import { DataAnnotationSliceLayer } from "./DataAnnotationSliceLayer";
import { DataAnnotationStripLayer } from "./DataAnnotationStripLayer";
import { UserAnnotationDataContext } from "./UserAnnotationDataContext";
import { ObservableCollection$1 } from "igniteui-angular-core";
import { CalloutLayer } from "./CalloutLayer";
import { Base, typeCast, runOn, delegateCombine, String_$type, Point_$type, delegateRemove, fromEnum, markType } from "igniteui-angular-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 { PlatformAPIHelper } from "igniteui-angular-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-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
* @hidden
*/
export let UserAnnotationLayer = /*@__PURE__*/ (() => {
class UserAnnotationLayer extends Series {
constructor() {
super();
this.yq = "UserLayer";
this.xl = new UserAnnotationCollection();
this.yh = new List$1(Axis.$, 0);
this.ya = new Dictionary$2(Axis.$, Axis.$, 0);
this.zo = BrushUtil.j(255, 255, 255, 255);
this.zn = BrushUtil.j(255, 0, 0, 0);
this.xi = null;
this.x6 = new Dictionary$2(String_$type, UserAnnotationFlow.$, 0);
this.userAnnotationInformationRequested = null;
this.yi = new List$1(UserAnnotationItems.$, 0);
this.x4 = new Dictionary$2(String_$type, UserBaseAnnotation.$, 0);
this.yg = new HashSet$1(Axis.$, 0);
this.ye = new HashSet$1(Axis.$, 0);
this.x9 = new Dictionary$2(Axis.$, DataAnnotationSliceLayer.$, 0);
this.yd = new Dictionary$2(Axis.$, DataAnnotationStripLayer.$, 0);
this.x8 = new Dictionary$2(Axis.$, HashSet$1.$.specialize(UserAnnotationDataContext.$), 0);
this.x7 = new Dictionary$2(Axis.$, ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), 0);
this.yc = new Dictionary$2(Axis.$, HashSet$1.$.specialize(UserAnnotationDataContext.$), 0);
this.yb = new Dictionary$2(Axis.$, ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), 0);
this.yf = new HashSet$1(UserAnnotationDataContext.$, 0);
this.yk = new ObservableCollection$1(UserAnnotationDataContext.$, 0);
this.x5 = new Dictionary$2(Axis.$, HashSet$1.$.specialize(UserAnnotationDataContext.$), 0);
this.xk = null;
this.stylingAxisAnnotation = null;
this.stylingSliceAnnotation = null;
this.stylingStripAnnotation = null;
this.stylingPointAnnotation = null;
UserAnnotationLayer.yn++;
this.yq = "UserLayer" + UserAnnotationLayer.yn;
let a = this.xl;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.ys));
let b = this.xl;
b.collectionResetting = delegateCombine(b.collectionResetting, runOn(this, this.yt));
}
get annotations() {
return this.xl;
}
get_ev() {
return true;
}
get_f9() {
return true;
}
get_isUsableInLegend() {
return false;
}
y5(a) {
let b = new JsonDictionaryParser();
let c = b.parse(a);
if (typeCast(JsonDictionaryObject.$, c) !== null && c.g("annotations")) {
let d = c.item("annotations");
if (typeCast(JsonDictionaryArray.$, d) !== null) {
let e = d;
if (e.items != null) {
this.annotations.clear();
for (let f = 0; f < e.items.length; f++) {
let g = e.items[f];
if (typeCast(JsonDictionaryObject.$, g) !== null) {
let h = UserBaseAnnotation.l(g);
this.annotations.add(h);
}
}
}
}
}
}
yo() {
let a = new JsonDictionaryObject();
let b = new JsonDictionaryArray();
a.item("annotations", b);
b.items = new Array(this.annotations.count);
for (let c = 0; c < b.items.length; c++) {
let d = this.annotations._inner[c];
let e = d.n();
b.items[c] = e;
}
return a.b();
}
yz(a) {
if (this.da == null) {
return;
}
if (this.da.zq == null) {
return;
}
if (this.da.zq.count < 2) {
return;
}
if (this.ya.containsKey(a)) {
return;
}
let b = this.xj(a);
if (b == null) {
let c = a;
c.co = true;
c.oc = BrushUtil.j(0, 255, 255, 255);
c.oh = BrushUtil.j(0, 255, 255, 255);
c.fl = 0;
this.ya.addItem(a, b);
}
}
y0(a) {
if (this.da == null) {
return;
}
if (this.da.zq == null) {
return;
}
if (this.da.zq.count < 2) {
return;
}
if (this.ya.containsKey(a)) {
this.ya.removeItem(a);
let b = this.xj(a);
a.co = false;
}
}
xj(a) {
for (let b = 0; b < this.da.zq.count; b++) {
let c = this.da.zq._inner[b];
if (c.dh && c.ao == a) {
return c;
}
}
return null;
}
zp(a, b) {
return a != null ? a : b;
}
y4(a, b) {
let c = typeCast(UserAnnotationPointDataContext.$, b.item);
if (c != null) {
let d = c.b;
if (d != null) {
d.ay(this.dc);
b.a = d.targetSeries;
}
}
}
y8(a, b) {
let c = b.o;
let 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;
}
}
y7(a, b) {
let c = b.l;
if (typeCast(UserAnnotationPointDataContext.$, c) !== null) {
let d = c.b;
if (d != null) {
if (d.r) {
b.backgroundCorner = b.height * 0.5;
}
}
}
}
y6(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;
}
}
}
za(a, b) {
let c = b.dataIndex;
let d = typeCast(Series.$, a);
if (d != null) {
let e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
let f = e._inner[c].b;
this.y6(b, f);
}
}
}
zd(a, b) {
let c = b.dataIndex;
let d = typeCast(Series.$, a);
if (d != null) {
let e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
let f = e._inner[c].b;
this.y6(b, f);
}
}
}
zb(a, b) {
let c = (b.dataIndex);
let d = typeCast(Series.$, a);
if (d != null) {
let e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
let 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;
}
}
}
}
}
y9(a, b) {
let c = truncate((b.dataIndex));
let d = typeCast(Series.$, a);
if (d != null) {
let e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
let 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;
}
}
}
}
}
zc(a, b) {
let c = truncate((b.dataIndex));
let d = typeCast(Series.$, a);
if (d != null) {
let e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
let 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;
}
}
}
}
}
}
ze(a, b) {
let c = (b.dataIndex);
let d = typeCast(Series.$, a);
if (d != null) {
let e = typeCast(ObservableCollection$1.$.specialize(UserAnnotationDataContext.$), d.itemsSource);
if (e != null && e.count > c) {
let 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;
}
}
}
}
}
rp(a, b, c, d) {
super.rp(a, b, c, d);
if (b == "SeriesViewer") {
if (c != null) {
this.yy(c);
}
if (d != null) {
this.yu(d);
}
}
else {
this.zf(b);
}
}
yj(a) {
return this.xi.j(this.yq, a);
}
yu(a) {
a.seriesClick = delegateCombine(a.seriesClick, runOn(this, this.zj));
a.axisLabelMouseClick = delegateCombine(a.axisLabelMouseClick, runOn(this, this.zi));
a.viewerManipulationEnding = delegateCombine(a.viewerManipulationEnding, runOn(this, this.zk));
this.xi = this.dc.ao(this.dc);
for (let b = 0; b < this.yi.count; b++) {
this.y2(this.yi._inner[b]);
}
this.userAnnotationInformationRequested = delegateCombine(this.userAnnotationInformationRequested, runOn(this.dc, this.dc.ru));
}
zk(a, b) {
if (b.isDragSelect) {
if (this.dc != null && this.dc.f0) {
let c = b.dragSelectRectangle;
if (!c.isEmpty) {
b.isDragSelectCancelled = true;
let d = null;
for (let e = 0; e < this.da.zq.count; e++) {
let f = this.da.zq._inner[e];
if (f.dh) {
continue;
}
if (!f.dy) {
d = f;
break;
}
}
if (d != null) {
if (d.df && !d.dj) {
let g = this.da.yw(c);
let h = new ScalerParams(1, this.da.yr, this.da.y9, d.dn);
h.c = this.getEffectiveViewport();
let i = d.f8(g.left, h);
let j = d.f8(g.right, h);
if (d.dn) {
let k = i;
i = j;
j = k;
}
i = Math.floor(i);
j = Math.ceil(j);
let l = this.xn();
let m = this.xy(d, i, j);
l.b = m;
this.zl(l);
this.yr(l);
this.zh(l);
this.dc.uc(l.d);
}
}
}
}
}
}
zi(a, b) {
let c = b.h;
let d = b.a;
let e = b.c;
if (this.dc.f0) {
if (d.df && !d.dj) {
let f = typeCast(CategoryAxisBase.$, d);
e = f.categoryMode == 2 ? Math.floor(e) : Math.round(e);
}
let g = this.xn();
let h = this.xx(d, c, e);
g.b = h;
this.zl(g);
this.yr(g);
this.zh(g);
this.dc.uc(g.d);
}
if (this.dc.f1) {
if (d.df && !d.dj) {
let i = typeCast(CategoryAxisBase.$, d);
e = i.categoryMode == 2 ? Math.floor(e) : Math.round(e);
}
let j = this.xz(d, c, e);
}
}
xz(a, b, c) {
for (let d = this.annotations.count - 1; d >= 0; d--) {
let e = this.annotations._inner[d];
if (e.k == 0) {
let 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) {
let 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;
}
xx(a, b, c) {
let d = new UserSliceAnnotation();
d.targetAxisMatcher = a.a9();
d.value = c;
d.aq = " ";
return d;
}
xy(a, b, c) {
let d = new UserStripAnnotation();
d.targetAxisMatcher = a.a9();
d.startValue = b;
d.endValue = c;
d.aq = " ";
return d;
}
zj(a, b) {
if (!this.dc.y9.containsPoint(b.chartPosition)) {
return;
}
let c = b.series;
let d = b.item;
let e = b.worldPosition;
if (this.dc.f0) {
b.cancelSelection = true;
let f = this.xn();
f.b = this.x0(c, d, e);
if (f.b == null) {
return;
}
this.zl(f);
this.yr(f);
this.zh(f);
this.dc.uc(f.d);
}
if (this.dc.f1) {
b.cancelSelection = true;
this.yx(c, d, e);
this.dc.pa();
}
}
zl(a) {
if (!this.x6.containsKey(a.d)) {
this.x6.addItem(a.d, a);
}
if (a.b != null) {
a.b.an = a.d;
}
}
zh(a) {
if (this.userAnnotationInformationRequested != null) {
this.userAnnotationInformationRequested(this, ((() => {
let $ret = new UserAnnotationInformationEventArgs();
$ret.annotationInfo = this.xp(a);
return $ret;
})()));
}
}
xp(a) {
return a.a;
}
yv(a) {
if (this.x6.containsKey(a)) {
let b = this.x6.item(a);
let c = b.b;
if (this.annotations.contains(c)) {
this.annotations.remove(c);
}
this.x6.removeItem(a);
}
}
y3(a) {
if (a.d != null) {
if (this.x6.containsKey(a.d)) {
let b = this.x6.item(a.d);
this.yw(b, a);
this.zm(b);
this.x6.removeItem(a.d);
}
}
}
zm(a) {
let b = a.a;
let 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:
let 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:
let e = c;
e.shapeOutline = b.i;
e.bm = b.i;
e.bn = b.i;
break;
case 2:
let f = c;
f.bm = b.i;
f.bk = b.h;
f.bn = b.i;
break;
}
}
}
yw(a, b) {
let c = a.a;
c.g(b);
}
yr(a) {
this.annotations.add(a.b);
}
x0(a, b, c) {
let d = new UserPointAnnotation();
d.targetSeriesMatcher = a.cg();
let e = a.wv(c, false, false);
let f = a.w0(e);
if (isNaN_(f.x) || isNaN_(f.y)) {
return null;
}
d.xValue = f.x;
d.yValue = f.y;
d.aq = " ";
return d;
}
yx(a, b, c) {
let d = a.wv(c, false, false);
let e = a.w0(d);
if (isNaN_(e.x) || isNaN_(e.y)) {
return;
}
for (let f = this.annotations.count - 1; f >= 0; f--) {
let g = this.annotations._inner[f];
if (g.k == 2) {
let h = g;
if (h.xValue == e.x && h.yValue == e.y) {
this.annotations.removeAt(f);
}
}
}
}
xn() {
let a = new UserAnnotationFlow();
a.a = this.xo(a.d);
return a;
}
xo(a) {
let 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);
}
let c = this.zq({ $type: Point_$type, x: b.a, y: b.b });
b.a = c.x;
b.b = c.y;
return b;
}
zq(a) {
let b = 0;
let c = 0;
if (this.dc != null) {
let d = this.dc.yk();
b += d.x;
c += d.y;
}
return { $type: Point_$type, x: b + a.x, y: c + a.y };
}
yy(a) {
a.seriesClick = delegateRemove(a.seriesClick, runOn(this, this.zj));
a.axisLabelMouseClick = delegateRemove(a.axisLabelMouseClick, runOn(this, this.zi));
for (let b = 0; b < this.yi.count; b++) {
this.y2(this.yi._inner[b]);
}
this.userAnnotationInformationRequested = delegateRemove(this.userAnnotationInformationRequested, runOn(a, a.ru));
}
zf(a) {
if (this.xi == null) {
return;
}
let b = new List$1(Series.$, 0);
b.o(this.yj(12));
b.o(this.yj(13));
b.o(this.yj(14));
for (let c of fromEnum(b)) {
if (a == "Brush") {
c.vy = this.vy;
}
else if (a == "Outline") {
c.we = this.we;
}
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.wl = this.wl;
}
else if (a == "DashCap") {
c.wm = this.wm;
}
else if (a == "AreaFillOpacity") {
c.ir = this.ir;
}
}
}
yt(a, b) {
}
ys(a, b) {
switch (b.action) {
case 0:
if (b.newItems != null) {
for (let c = 0; c < b.newItems.count; c++) {
let d = b.newItems.item(c);
let e = this.xr(d);
if (d != null) {
this.x4.item(d.an, d);
}
this.yi.insert(c + b.newStartingIndex, e);
this.y1(e);
}
}
break;
case 1:
if (b.oldItems != null) {
for (let f = 0; f < b.oldItems.count; f++) {
let g = b.oldItems.item(f);
if (g != null) {
if (this.x4.containsKey(g.an)) {
this.x4.removeItem(g.an);
}
}
let h = this.yi._inner[b.oldStartingIndex];
this.yi.removeAt(b.oldStartingIndex);
this.y2(h);
}
}
break;
case 2:
if (b.oldItems != null) {
for (let i = 0; i < b.oldItems.count; i++) {
let j = b.oldItems.item(i);
if (j != null) {
if (this.x4.containsKey(j.an)) {
this.x4.removeItem(j.an);
}
}
let k = this.yi._inner[b.oldStartingIndex];
this.yi.removeAt(b.oldStartingIndex);
this.y2(k);
}
}
if (b.newItems != null) {
for (let l = 0; l < b.newItems.count; l++) {
let m = b.newItems.item(l);
let n = this.xr(m);
if (m != null) {
this.x4.item(m.an, m);
}
this.y1(n);
this.yi.insert(l + b.newStartingIndex, n);
}
}
break;
case 4:
for (let o = this.yi.count - 1; o >= 0; o--) {
let p = this.yi._inner[o];
if (p.k != null) {
if (this.x4.containsKey(p.k.an)) {
this.x4.removeItem(p.k.an);
}
}
this.yi.removeAt(o);
this.y2(p);
}
this.yi.clear();
break;
}
}
yp(a) {
return PlatformAPIHelper.r(a);
}
y1(a) {
if (a == null) {
return;
}
if (a.k == null || this.dc == null) {
return;
}
let b = a.k;
b.ay(this.dc);
if (a.l) {
let c = a.k.targetAxis;
if (c != null) {
if (a.h != null) {
if (this.x9.containsKey(c)) {
a.c = this.x9.item(c);
}
if (!this.x8.containsKey(c)) {
this.x8.addItem(c, new HashSet$1(UserAnnotationDataContext.$, 0));
}
if (!this.x7.containsKey(c)) {
this.x7.addItem(c, new ObservableCollection$1(UserAnnotationDataContext.$, 0));
}
let d = this.x8.item(c);
let e = this.x7.item(c);
if (!d.contains(a.h)) {
d.add_1(a.h);
e.add(a.h);
if (this.x9.containsKey(c)) {
this.x9.item(c).qv(e.count - 1, a.h);
}
}
}
if (a.h != null && !this.x9.containsKey(c)) {
let f = new DataAnnotationSliceLayer();
f.pz(this.dc);
this.x9.item(c, f);
a.c = f;
f.vy = this.vy;
f.we = this.we;
f.jy = this.jy;
f.wl = this.wl;
f.wm = this.wm;
let g = this.x8.item(c);
let h = this.x7.item(c);
f.mb = this.yq;
f.name = this.yq + "_SliceAnnotation" + (UserAnnotationLayer.yl++);
f.aff = this.yp("OverlayText");
f.aaw = 3;
f.ahl = this.yp("Label");
f.aho = this.yp("Value");
f.stylingAxisAnnotation = delegateCombine(f.stylingAxisAnnotation, runOn(this, this.y9));
f.stylingShapeAnnotation = delegateCombine(f.stylingShapeAnnotation, runOn(this, this.zb));
f.stylingOverlayText = delegateCombine(f.stylingOverlayText, runOn(this, this.za));
f.aav = c;
f.itemsSource = h;
f.adn = a.k;
let i = new AutomaticSeriesRequest();
i.d = f;
i.a = 12;
i.g = true;
this.xi.b.add(i);
}
if (a.i != null) {
if (this.yd.containsKey(c)) {
a.d = this.yd.item(c);
}
if (!this.yc.containsKey(c)) {
this.yc.addItem(c, new HashSet$1(UserAnnotationDataContext.$, 0));
}
if (!this.yb.containsKey(c)) {
this.yb.addItem(c, new ObservableCollection$1(UserAnnotationDataContext.$, 0));
}
let j = this.yc.item(c);
let k = this.yb.item(c);
if (!j.contains(a.i)) {
j.add_1(a.i);
k.add(a.i);
if (this.yd.containsKey(c)) {
this.yd.item(c).qv(k.count - 1, a.i);
}
}
}
if (a.i != null && !this.yd.containsKey(c)) {
let l = this.yc.item(c);
let m = this.yb.item(c);
let n = new DataAnnotationStripLayer();
n.pz(this.dc);
this.yd.item(c, n);
a.d = n;
n.vy = this.vy;
n.we = this.we;
n.cj = this.cj;
n.jy = this.jy;
n.jr = this.jr;
n.wl = this.wl;
n.wm = this.wm;
n.mb = this.yq;
n.name = this.yq + "_StripAnnotation" + (UserAnnotationLayer.yl++);
n.aff = this.yp("OverlayText");
n.ahp = 3;
n.aix = this.yp("StartLabel");
n.ai0 = this.yp("StartValue");
n.aho = 3;
n.aiq = this.yp("EndLabel");
n.ait = this.yp("EndValue");
n.aim = this.yp("Label");
n.ahn = 6;
n.stylingAxisAnnotation = delegateCombine(n.stylingAxisAnnotation, runOn(this, this.zc));
n.stylingShapeAnnotation = delegateCombine(n.stylingShapeAnnotation, runOn(this, this.ze));
n.stylingOverlayText = delegateCombine(n.stylingOverlayText, runOn(this, this.zd));
n.aav = c;
n.itemsSource = m;
n.adn = a.k;
let o = new AutomaticSeriesRequest();
o.d = n;
o.a = 13;
o.g = true;
this.xi.b.add(o);
}
if (a.e != null) {
if (!this.x5.containsKey(c)) {
this.x5.addItem(c, new HashSet$1(UserAnnotationDataContext.$, 0));
}
let p = this.x5.item(c);
}
if (a.e != null) {
this.ye.add_1(c);
this.yz(c);
let q = this.x5.item(c);
if (!q.contains(a.e)) {
q.add_1(a.e);
let r = this.xj(c);
let s = new AxisAnnotation();
a.a = s;
a.o();
if (r.df && !r.dj) {
let t = typeCast(CategoryAxisBase.$, r);
if (t.categoryMode != 0) {
s.m = true;
}
}
r.at.add(s);
}
}
}
}
if (a.g != null) {
if (this.xk != null) {
a.b = this.xk;
}
if (!this.yf.contains(a.g)) {
this.yf.add_1(a.g);
this.yk.add(a.g);
if (this.xk != null) {
this.xk.qv(this.yk.count - 1, a.g);
}
}
}
if (a.g != null && this.xk == null) {
let u = new CalloutLayer();
u.pz(this.dc);
this.xk = u;
a.b = u;
u.vy = this.vy;
u.we = this.we;
u.cj = this.cj;
u.jy = this.jy;
u.jr = this.jr;
u.wl = this.wl;
u.wm = this.wm;
u.calloutSeriesSelecting = delegateCombine(u.calloutSeriesSelecting, runOn(this, this.y4));
u.mb = this.yq;
u.name = this.yq + "_CalloutAnnotation" + (UserAnnotationLayer.yl++);
u.afq = this.yp("XValue");
u.aft = this.yp("YValue");
u.aev = this.yp("Label");
u.afa = this.yp("Label");
u.ace = false;
u.aco = false;
u.ach = true;
u.acg = true;
u.calloutStyleUpdating = delegateCombine(u.calloutStyleUpdating, runOn(this, this.y8));
u.calloutRenderStyleUpdating = delegateCombine(u.calloutRenderStyleUpdating, runOn(this, this.y7));
u.itemsSource = this.yk;
let v = new AutomaticSeriesRequest();
v.d = u;
v.a = 14;
v.g = true;
this.xi.b.add(v);
}
}
y2(a) {
let b = a.k;
if (b == null) {
return;
}
if (a.l) {
let c = b.targetAxis;
if (c == null) {
return;
}
if (a.h != null) {
a.c = null;
if (this.x8.containsKey(c)) {
let d = this.x8.item(c);
let e = this.x7.item(c);
if (d.contains(a.h)) {
d.remove(a.h);
let f = e.indexOf(a.h);
e.remove(a.h);
this.x9.item(c).qw(f, a.h);
if (e.count == 0) {
this.x7.removeItem(c);
this.x8.removeItem(c);
let g = this.x9.item(c);
this.x9.removeItem(c);
this.zg(g);
}
}
}
}
if (a.i != null) {
a.d = null;
if (this.yc.containsKey(c)) {
let h = this.yc.item(c);
let i = this.yb.item(c);
if (h.contains(a.i)) {
h.remove(a.i);
let j = i.indexOf(a.i);
i.remove(a.i);
this.yd.item(c).qw(j, a.i);
if (i.count == 0) {
this.yb.removeItem(c);
this.yc.removeItem(c);
let k = this.yd.item(c);
this.yd.removeItem(c);
this.zg(k);
}
}
}
}
if (a.e != null) {
if (this.x5.containsKey(c)) {
let l = this.x5.item(c);
if (l.contains(a.e)) {
l.remove(a.e);
let m = this.xj(c);
if (m != null) {
if (m.at.contains(a.a)) {
m.at.remove(a.a);
a.a = null;
}
}
if (l.count == 0) {
this.y0(c);
}
}
}
}
}
if (a.g != null) {
if (this.yf.contains(a.g)) {
this.yf.remove(a.g);
let n = this.yk.indexOf(a.g);
this.yk.remove(a.g);
this.xk.qw(n, a.g);
}
if (this.yf.count == 0) {
this.zg(this.xk);
this.xk = null;
}
}
}
zg(a) {
this.xi.t(a);
}
xr(a) {
switch (a.k) {
case 3: return this.xs(a);
case 0: return this.xu(a);
case 2: return this.xt(a);
case 1: return this.xv(a);
}
return null;
}
xv(a) {
let b = new UserAnnotationItems(this);
b.k = a;
b.i = new UserAnnotationStripDataContext(a);
b.e = new UserAnnotationAxisDataContext(a);
return b;
}
xt(a) {
let b = new UserAnnotationItems(this);
b.k = a;
b.g = new UserAnnotationPointDataContext(a);
return b;
}
xu(a) {
let b = new UserAnnotationItems(this);
b.k = a;
b.h = new UserAnnotationSliceDataContext(a);
b.e = new UserAnnotationAxisDataContext(a);
return b;
}
xs(a) {
let b = new UserAnnotationItems(this);
b.k = a;
b.e = new UserAnnotationAxisDataContext(a);
return b;
}
}
UserAnnotationLayer.$t = markType(UserAnnotationLayer, 'UserAnnotationLayer', Series.$);
UserAnnotationLayer.ym = 0;
UserAnnotationLayer.yn = 0;
UserAnnotationLayer.yl = 0;
return UserAnnotationLayer;
})();
/**
* @hidden
*/
export let UserAnnotationItems = /*@__PURE__*/ (() => {
class UserAnnotationItems extends Base {
constructor(a) {
super();
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;
}
get k() {
return this.j;
}
set k(a) {
let b = this.j;
this.j = a;
if (this.j != b) {
this.m(b, a);
}
}
o() {
if (this.a == null) {
return;
}
let a = this.a;