igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
4,789 lines • 165 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 { Base, Point_$type, runOn, delegateCombine, markType, PointUtil, EventArgs, typeCast, INotifyPropertyChanged_$type, IEnumerable_$type, IList_$type, PropertyChangedEventArgs, Number_$type, enumGetBox, EnumUtil, Boolean_$type, delegateRemove, Array_$type, Delegate_$type, fromEnum, fromEn, markDep } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { RenderingContext } from "igniteui-angular-core";
import { PieChartStyleInfo } from "./PieChartStyleInfo";
import { BrushCollection } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { CanvasViewRenderer } from "igniteui-angular-core";
import { DOMEventProxy } from "igniteui-angular-core";
import { PieChartVisualData } from "./PieChartVisualData";
import { Style } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Control } from "igniteui-angular-core";
import { Line } from "igniteui-angular-core";
import { LabelsPosition_$type } from "./LabelsPosition";
import { TextBlock } from "igniteui-angular-core";
import { GeometryUtil } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { BezierSegment } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { LeaderLineType_$type } from "./LeaderLineType";
import { stringEmpty, stringIsNullOrWhiteSpace } from "igniteui-angular-core";
import { ILegendOwner_$type } from "igniteui-angular-core";
import { ILegendSeries_$type } from "igniteui-angular-core";
import { ILegendTemplateProvider_$type } from "igniteui-angular-core";
import { FastItemsSource } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { UIElement } from "igniteui-angular-core";
import { SRProvider } from "igniteui-angular-core";
import { OthersCategoryType_$type } from "igniteui-angular-core";
import { IndexCollection } from "./IndexCollection";
import { NotifyCollectionChangedEventArgs } from "igniteui-angular-core";
import { IChartLegend_$type } from "igniteui-angular-core";
import { SweepDirection_$type } from "igniteui-angular-core";
import { DataTemplate } from "igniteui-angular-core";
import { LegendEmptyValuesMode_$type } from "igniteui-angular-core";
import { SliceSelectionMode_$type } from "./SliceSelectionMode";
import { ObjectCollection } from "igniteui-angular-core";
import { BindingFormatter } from "igniteui-angular-core";
import { PropertyUpdatedEventArgs } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { SelectedItemChangingEventArgs } from "./SelectedItemChangingEventArgs";
import { SelectedItemsChangingEventArgs } from "./SelectedItemsChangingEventArgs";
import { SelectedItemChangedEventArgs } from "./SelectedItemChangedEventArgs";
import { SelectedItemsChangedEventArgs } from "./SelectedItemsChangedEventArgs";
import { MathUtil } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { ContentControl } from "igniteui-angular-core";
import { PieSliceVisualData } from "./PieSliceVisualData";
import { RectData } from "igniteui-angular-core";
import { PieChartMockDataGenerator } from "./PieChartMockDataGenerator";
import { MouseEventArgs } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { FastItemObjectColumn } from "igniteui-angular-core";
import { ArcSegment } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { EllipseGeometry } from "igniteui-angular-core";
import { PathSegmentCollection } from "igniteui-angular-core";
import { PathFigureCollection } from "igniteui-angular-core";
import { GeometryGroup } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { PrimitiveAppearanceData } from "igniteui-angular-core";
import { LabelAppearanceData } from "igniteui-angular-core";
import { PointData } from "igniteui-angular-core";
import { AppearanceHelper } from "igniteui-angular-core";
import { PathVisualData } from "igniteui-angular-core";
import { PieLegendTemplates } from "./PieLegendTemplates";
import { MouseButtonEventArgs } from "igniteui-angular-core";
import { TranslateTransform } from "igniteui-angular-core";
/**
* @hidden
*/
var PieChartViewManager = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieChartViewManager, _super);
function PieChartViewManager(a) {
var _this = _super.call(this) || this;
_this.n = null;
_this.p = null;
_this.s = null;
_this.r = null;
_this.q = null;
_this.k = 0;
_this.j = 0;
_this.l = 1;
_this.as = null;
_this.e = null;
_this.g = null;
_this.f = null;
_this.h = null;
_this.a = null;
_this.u = -1;
_this.t = -1;
_this.c = null;
_this._toolTipObject = null;
_this.w = null;
_this.i = true;
_this.a = a;
return _this;
}
PieChartViewManager.prototype.ac = function () {
var a = this.n.rootWrapper.width();
var b = this.n.rootWrapper.height();
this.af(a, b);
};
PieChartViewManager.prototype.af = function (a, b) {
this.ab();
this.c.bl = new Rect(0, 0, 0, a, b);
var c = this.a.a.c2;
if (c == this.l && a == this.k && b == this.j) {
return;
}
this.k = a;
this.j = b;
this.l = c;
this.a.bb();
};
PieChartViewManager.prototype.ag = function () {
if (this.c != null) {
this.c.bh(this.s, "");
}
};
PieChartViewManager.prototype.ad = function () {
this.ab();
if (this.c != null) {
this.c.at(this.s, "");
}
};
PieChartViewManager.prototype.ab = function () {
var a = this.a.a.df;
var b = this.a.a.c2;
if (!isNaN_(a) && a != 0) {
return;
}
if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
this.a.a.c2 = window.devicePixelRatio;
}
};
PieChartViewManager.prototype.y = function (a, b) {
var c = this.k;
var d = this.j;
var e = this.l;
if (e != 1) {
c = Math.round(a * e);
d = Math.round(b * e);
}
var f = this.a.a.c2;
if (a != this.k || b != this.j || f != this.l || c != this.u || d != this.t) {
this.k = a;
this.j = b;
this.l = this.a.a.c2;
this.ar();
this.ak(false);
}
};
PieChartViewManager.prototype.ar = function () {
this.as = new Rect(0, 0, 0, this.k, this.j);
return this.as;
};
PieChartViewManager.prototype.ak = function (a) {
var b = this.k;
var c = this.j;
var d = this.l;
if (d != 1) {
b = Math.round(this.k * d);
c = Math.round(this.j * d);
}
if (this.u != b || this.t != c || a) {
this.p.setAttribute("width", b.toString());
this.p.setAttribute("height", c.toString());
this.p.setStyleProperty("width", this.k.toString() + "px");
this.p.setStyleProperty("height", this.j.toString() + "px");
this.r.setAttribute("width", b.toString());
this.r.setAttribute("height", c.toString());
this.r.setStyleProperty("width", this.k.toString() + "px");
this.r.setStyleProperty("height", this.j.toString() + "px");
this.q.setAttribute("width", b.toString());
this.q.setAttribute("height", c.toString());
this.q.setStyleProperty("width", this.k.toString() + "px");
this.q.setStyleProperty("height", this.j.toString() + "px");
this.s.setAttribute("width", b.toString());
this.s.setAttribute("height", c.toString());
this.s.setStyleProperty("width", this.k.toString() + "px");
this.s.setStyleProperty("height", this.j.toString() + "px");
this.u = truncate(Math.round(b));
this.t = truncate(Math.round(c));
}
};
PieChartViewManager.prototype.d = function () {
return this.a.b.c;
};
PieChartViewManager.prototype.aq = function () {
var a = DOMEventProxy.c4(this.n.rootWrapper);
return { $type: Point_$type, x: a.left, y: a.top };
};
PieChartViewManager.prototype.aj = function (a) {
if (this.n != null) {
this.n.setTimeout(a, 0);
}
else {
window.setTimeout(a, 0);
}
};
PieChartViewManager.prototype.b = function () {
var _this = this;
var a = new PieChartStyleInfo();
var b;
var c;
var d = BrushUtil.f("chart", this.n, b, c);
b = d.p2;
c = d.p3;
a.a = b;
a.b = c;
this.n.startCSSQuery();
a.f = ((function () {
var $ret = new Brush();
$ret.fill = _this.n.getCssDefaultPropertyValue("ui-chart-innerlabels", "color");
return $ret;
})());
a.g = ((function () {
var $ret = new Brush();
$ret.fill = _this.n.getCssDefaultPropertyValue("ui-chart-outerlabels", "color");
return $ret;
})());
this.n.endCSSQuery();
a.c = FontUtil.getFont(this.n);
a.e = DeviceUtils.g(6);
a.i = ((function () {
var $ret = new Brush();
$ret.fill = "#00000033";
return $ret;
})());
a.d = 1;
return a;
};
PieChartViewManager.prototype.al = function (a) {
a._stroke = ((function () {
var $ret = new Brush();
$ret.fill = "#000000";
return $ret;
})());
a._fill = ((function () {
var $ret = new Brush();
$ret.fill = "#222222";
return $ret;
})());
};
PieChartViewManager.prototype.ae = function (a) {
if (a == null) {
if (this.c != null) {
this.c.av();
}
this.n = null;
this.p = null;
this.r = null;
this.q = null;
this.s = null;
this.e = null;
this.g = null;
this.f = null;
this.h = null;
this.c = null;
return;
}
var b = a;
this.n = b;
this.a.bc();
this.a.bl();
this.n.rootWrapper.setStyleProperty("position", "relative");
this.n.rootWrapper.addClass("ui-corner-all");
this.n.rootWrapper.addClass("ui-widget-content");
this.p = this.n.createElement("canvas");
this.p.setStyleProperty("position", "absolute");
this.p.setStyleProperty("top", "0px");
this.p.setStyleProperty("left", "0px");
this.r = this.n.createElement("canvas");
this.r.setStyleProperty("position", "absolute");
this.r.setStyleProperty("top", "0px");
this.r.setStyleProperty("left", "0px");
this.q = this.n.createElement("canvas");
this.q.setStyleProperty("position", "absolute");
this.q.setStyleProperty("top", "0px");
this.q.setStyleProperty("left", "0px");
this.s = this.n.createElement("canvas");
this.s.setStyleProperty("position", "absolute");
this.s.setStyleProperty("top", "0px");
this.s.setStyleProperty("left", "0px");
this.n.append(this.p);
this.n.append(this.r);
this.n.append(this.q);
this.n.append(this.s);
this.ak(true);
this.e = new RenderingContext(new CanvasViewRenderer(), this.n.get2DCanvasContext(this.p));
this.g = new RenderingContext(new CanvasViewRenderer(), this.n.get2DCanvasContext(this.r));
this.f = new RenderingContext(new CanvasViewRenderer(), this.n.get2DCanvasContext(this.q));
this.h = new RenderingContext(new CanvasViewRenderer(), this.n.get2DCanvasContext(this.s));
this.c = new DOMEventProxy(this.s, this.n, false);
var c = this.c;
c.onMouseOver = delegateCombine(c.onMouseOver, runOn(this.a, this.a.ak));
var d = this.c;
d.onMouseLeave = delegateCombine(d.onMouseLeave, runOn(this.a, this.a.aj));
var e = this.c;
e.onMouseDown = delegateCombine(e.onMouseDown, runOn(this.a, this.a.ai));
var f = this.c;
f.onMouseUp = delegateCombine(f.onMouseUp, runOn(this.a, this.a.al));
this.c.ae = this.a.a.cf;
this.af(this.n.rootWrapper.width(), this.n.rootWrapper.height());
};
PieChartViewManager.prototype.x = function (a) {
this.n.append(a);
};
PieChartViewManager.prototype.ah = function (a) {
if (this.c == null) {
return;
}
this.c.ae = a;
};
PieChartViewManager.prototype.v = function () {
return this.n;
};
PieChartViewManager.prototype.z = function (a) {
a.width = this.k;
a.height = this.j;
};
PieChartViewManager.prototype.an = function (a) {
this.w = null;
this._toolTipObject = null;
if (typeof a === 'string') {
this.w = a;
}
else {
this._toolTipObject = a;
if (this._toolTipObject != null) {
this._toolTipObject.setStyleProperty("position", "absolute");
this._toolTipObject.setStyleProperty("white-space", "nowrap");
this._toolTipObject.setStyleProperty("top", "0");
this._toolTipObject.setStyleProperty("left", "0");
this._toolTipObject.setStyleProperty("z-index", "10000");
}
}
};
PieChartViewManager.prototype.am = function (pos_, context_) {
if (this._toolTipObject != null) {
if (this.i) {
this.x(this._toolTipObject);
this.i = false;
}
context_.hideOthers = true;
if (this._toolTipObject.updateToolTip) {
this._toolTipObject.updateToolTip(context_);
}
;
this._toolTipObject.setOffset(pos_.x, pos_.y);
}
};
PieChartViewManager.prototype.aa = function (a) {
if (this._toolTipObject != null) {
var context_ = a;
if (this._toolTipObject.hideToolTip) {
this._toolTipObject.hideToolTip(context_);
}
;
}
};
PieChartViewManager.prototype.ao = function (style_) {
var a = null;
var fillColor_ = null;
if (style_ != null) {
if (style_.fill) {
fillColor_ = style_.fill;
}
;
if (fillColor_ != null) {
a = Brush.create(fillColor_);
}
}
return a;
};
PieChartViewManager.prototype.ap = function (style_) {
var a = null;
var outlineColor_ = null;
if (style_ != null) {
if (style_.stroke) {
outlineColor_ = style_.stroke;
}
;
if (outlineColor_ != null) {
a = Brush.create(outlineColor_);
}
}
return a;
};
PieChartViewManager.prototype.m = function (style_) {
var actualOutlineThickness_ = NaN;
if (style_ != null) {
if (style_.strokeThickness) {
actualOutlineThickness_ = style_.strokeThickness;
}
;
}
return actualOutlineThickness_;
};
PieChartViewManager.prototype.ai = function () {
};
PieChartViewManager.$t = markType(PieChartViewManager, 'PieChartViewManager');
return PieChartViewManager;
}(Base));
export { PieChartViewManager };
/**
* @hidden
*/
var LabelClickEventArgs = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(LabelClickEventArgs, _super);
function LabelClickEventArgs(a, b) {
var _this = _super.call(this) || this;
_this._slice = null;
_this.c = true;
_this.slice = a;
return _this;
}
Object.defineProperty(LabelClickEventArgs.prototype, "slice", {
get: function () {
return this._slice;
},
set: function (a) {
this._slice = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(LabelClickEventArgs.prototype, "item", {
get: function () {
if (this.slice != null) {
return this.slice.dataContext;
}
else {
return null;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(LabelClickEventArgs.prototype, "allowSliceClick", {
get: function () {
return this.c;
},
set: function (a) {
this.c = a;
},
enumerable: false,
configurable: true
});
LabelClickEventArgs.$t = markType(LabelClickEventArgs, 'LabelClickEventArgs', EventArgs.$);
return LabelClickEventArgs;
}(EventArgs));
export { LabelClickEventArgs };
/**
* @hidden
*/
var SliceClickEventArgs = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SliceClickEventArgs, _super);
function SliceClickEventArgs(a, b) {
var _this = _super.call(this) || this;
_this._slice = null;
_this.d = false;
_this.c = false;
_this._originalEvent = null;
_this.slice = a;
_this.originalEvent = b;
if (a == null) {
return _this;
}
_this.d = a.isSelected;
_this.c = a.isExploded;
return _this;
}
Object.defineProperty(SliceClickEventArgs.prototype, "slice", {
get: function () {
return this._slice;
},
set: function (a) {
this._slice = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "isSelected", {
get: function () {
return this.d;
},
set: function (a) {
this.d = a;
this.slice.ai.g2(this.slice, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "isExploded", {
get: function () {
return this.c;
},
set: function (a) {
this.c = a;
this.slice.isExploded = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "isOthersSlice", {
get: function () {
return this.slice.isOthersSlice;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "index", {
get: function () {
return this.slice.a5;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "dataContext", {
get: function () {
if (this.slice != null) {
return this.slice.dataContext;
}
return null;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "originalEvent", {
get: function () {
return this._originalEvent;
},
set: function (a) {
this._originalEvent = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "origin", {
get: function () {
return this.slice.isExploded ? this.slice.b3 : this.slice.b7;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "radius", {
get: function () {
return this.slice.isExploded ? this.slice.ay : this.slice.a2;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "bounds", {
get: function () {
return this.slice.isExploded ? this.slice.b9 : this.slice.cc;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "startAngle", {
get: function () {
return this.slice.a3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "endAngle", {
get: function () {
return this.slice.ax;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "fill", {
get: function () {
return this.slice.b0;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceClickEventArgs.prototype, "outline", {
get: function () {
return this.slice.b1;
},
enumerable: false,
configurable: true
});
SliceClickEventArgs.$t = markType(SliceClickEventArgs, 'SliceClickEventArgs', EventArgs.$);
return SliceClickEventArgs;
}(EventArgs));
export { SliceClickEventArgs };
/**
* @hidden
*/
var SliceEventArgs = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SliceEventArgs, _super);
function SliceEventArgs(a, b) {
var _this = _super.call(this) || this;
_this._slice = null;
_this.d = false;
_this.c = false;
_this._position = null;
_this._originalEvent = null;
_this.slice = a;
_this.originalEvent = b;
if (a == null) {
return _this;
}
_this.d = a.isSelected;
_this.c = a.isExploded;
return _this;
}
Object.defineProperty(SliceEventArgs.prototype, "slice", {
get: function () {
return this._slice;
},
set: function (a) {
this._slice = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "isSelected", {
get: function () {
return this.d;
},
set: function (a) {
this.d = a;
this.slice.ai.g2(this.slice, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "isExploded", {
get: function () {
return this.c;
},
set: function (a) {
this.c = a;
this.slice.isExploded = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "isOthersSlice", {
get: function () {
return this.slice.isOthersSlice;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "index", {
get: function () {
return this.slice.a5;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "origin", {
get: function () {
return this.slice.isExploded ? this.slice.b3 : this.slice.b7;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "radius", {
get: function () {
return this.slice.isExploded ? this.slice.ay : this.slice.a2;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "bounds", {
get: function () {
return this.slice.isExploded ? this.slice.b9 : this.slice.cc;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "startAngle", {
get: function () {
return this.slice.a3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "endAngle", {
get: function () {
return this.slice.ax;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "fill", {
get: function () {
return this.slice.b0;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "outline", {
get: function () {
return this.slice.b1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "dataContext", {
get: function () {
if (this.slice != null) {
if (this.slice.isOthersSlice) {
return this.slice.dataContext.toArray();
}
return this.slice.dataContext;
}
return null;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "position", {
get: function () {
return this._position;
},
set: function (a) {
this._position = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SliceEventArgs.prototype, "originalEvent", {
get: function () {
return this._originalEvent;
},
set: function (a) {
this._originalEvent = a;
},
enumerable: false,
configurable: true
});
SliceEventArgs.$t = markType(SliceEventArgs, 'SliceEventArgs', EventArgs.$);
return SliceEventArgs;
}(EventArgs));
export { SliceEventArgs };
/**
* @hidden
*/
var PieLabel = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieLabel, _super);
function PieLabel() {
var _this = _super.call(this) || this;
_this.ah = null;
_this.ao = null;
_this.ai = 0;
_this.aj = null;
_this.ap = null;
_this.aq = null;
_this.ag = 0;
return _this;
}
PieLabel.prototype.ak = function (a) {
if (a.a.az == 3) {
this.ao = a.b3(this);
var b = typeCast(TextBlock.$, this.aj);
var c = b.al;
a.a.gz();
var d = this.ah.isExploded ? this.ah.b5 : this.ah.b7;
var e = GeometryUtil.u(d, this.ai, this.ah.a2 + a.a.db);
var f = a.b4.width;
if (a.z(b) + e.x > f && e.x < f) {
while (c.length > 0 && a.z(b) + e.x > f) {
c = c.substr(0, c.length - 1);
b.al = c;
}
if (c.length > 3) {
c = c.substr(0, c.length - 3);
c = c + "...";
}
else {
if (a.z("...") < this.ao.width) {
c = "...";
}
else {
c = stringEmpty();
}
}
}
var g = new TextBlock();
g.al = c;
this.aj = g;
}
};
PieLabel.prototype.al = function () {
};
PieLabel.prototype.am = function () {
this.ap._visibility = this.ah.ai.je != 0 ? this.ah.ai.je : this.ah.aj._visibility;
var a;
var b = this.ah.ai.dc;
var c = GeometryUtil.u(this.ah.b6(), this.ai, this.ah.a2);
this.ap.an = c.x;
this.ap.ap = c.y;
if (this.ai < 90 || this.ai >= 270) {
a = { $type: Point_$type, x: this.ao.left, y: (this.ao.top + this.ao.bottom) / 2 };
}
else {
a = { $type: Point_$type, x: this.ao.right, y: (this.ao.top + this.ao.bottom) / 2 };
}
if (b > 0) {
var d = GeometryUtil.k(c, a);
if (b < d) {
a = GeometryUtil.w(a, c, b);
}
else {
a = c;
}
}
this.ap.ao = a.x;
this.ap.aq = a.y;
};
PieLabel.prototype.an = function () {
this.aq._visibility = this.ah.ai.je != 0 ? this.ah.ai.je : this.ah.aj._visibility;
var a = this.ah.b6();
var b = this.aq.an.c._inner[0];
var c = b._segments._inner[0];
var d = this.ah.ai.dc;
var e = (this.ao.top + this.ao.bottom) / 2;
var f = GeometryUtil.u(a, this.ai, this.ah.a2);
var g = GeometryUtil.u(a, this.ai, this.ah.a2 + this.ah.ai.db / 2);
var h;
var i;
var j;
var k = e;
if (this.ai < 90 && this.ai >= 0) {
h = { $type: Point_$type, x: this.ao.left - 30, y: k };
j = { $type: Point_$type, x: this.ao.left, y: e };
}
else if (this.ai < 180 && this.ai >= 90) {
h = { $type: Point_$type, x: this.ao.right + 30, y: k };
j = { $type: Point_$type, x: this.ao.right, y: e };
}
else if (this.ai < 270 && this.ai >= 180) {
h = { $type: Point_$type, x: this.ao.right + 30, y: k };
j = { $type: Point_$type, x: this.ao.right, y: e };
}
else {
h = { $type: Point_$type, x: this.ao.left - 30, y: k };
j = { $type: Point_$type, x: this.ao.left, y: e };
}
if (d > 0) {
var l = GeometryUtil.k(f, j);
if (d < l) {
i = GeometryUtil.w(j, f, d);
var m = g.x - f.x;
var n = g.y - f.y;
g = GeometryUtil.w(g, f, d);
var o = g.x - f.x;
var p = g.y - f.y;
if ((m > 0 && o < 0) || (m < 0 && o > 0) || (n > 0 && p < 0) || (n < 0 && p > 0)) {
g = f;
}
h = GeometryUtil.w(h, f, d);
var q = GeometryUtil.k(f, i) / GeometryUtil.k(f, j);
h.x = f.x + (h.x - f.x) * q;
h.y = f.y + (h.y - f.y) * q;
}
else {
this.aq._visibility = 1;
return;
}
}
else {
i = j;
}
if (this.ai < 180 && this.ai >= 0) {
if (g.y > h.y) {
g.y = f.y;
}
}
else {
if (g.y < h.y) {
g.y = f.y;
}
}
b._startPoint = f;
if (this.ah.ai.a0 == 1) {
c.e = f;
}
else {
c.e = g;
}
c.f = h;
c.g = i;
};
PieLabel.$t = markType(PieLabel, 'PieLabel', Control.$);
return PieLabel;
}(Control));
export { PieLabel };
/**
* @hidden
*/
var PieChartBase = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieChartBase, _super);
function PieChartBase() {
var _this = _super.call(this) || this;
_this.a4 = null;
_this.b0 = false;
_this.b3 = false;
_this.b2 = false;
_this.b4 = false;
_this.b1 = false;
_this.b7 = false;
_this.b6 = false;
_this.b5 = false;
_this.a8 = null;
_this.cu = null;
_this.cw = null;
_this.cv = null;
_this.cx = null;
_this.dk = null;
_this.bq = null;
_this.dm = 0;
_this.de = 0;
_this.dj = 0;
_this.co = null;
_this.cn = null;
_this.cm = null;
_this.c4 = 0;
_this.cl = null;
_this.a7 = null;
_this._xsr = null;
_this.bo = null;
_this.bp = null;
_this.au = new IndexCollection();
_this.av = new IndexCollection();
_this.cz = NaN;
_this.cy = 1;
_this._selectedItems = null;
_this.labelClick = null;
_this.selectedItemChanging = null;
_this.selectedItemsChanging = null;
_this.selectedItemChanged = null;
_this.selectedItemsChanged = null;
_this.sliceClick = null;
_this.bx = null;
_this.bw = null;
_this.i9 = null;
_this.ap = null;
_this.as = null;
_this.aq = null;
_this.ar = null;
_this.cp = null;
_this.propertyChanged = null;
_this.propertyUpdated = null;
_this.dn = null;
_this.sliceEnter = null;
_this.sliceLeave = null;
_this.sliceHover = null;
_this.ds = null;
_this.i9 = Rect.empty;
var a = _this.a3();
_this.go(a);
a.a2();
_this.ab = PieChartBase.$;
_this.co = new List$1(Number_$type, 0);
_this.cn = new List$1(Number_$type, 0);
_this.cm = new List$1(Base.$, 0);
_this.a8 = function (b, c) { return _this.gs(b, c.propertyName, c.oldValue, c.newValue); };
_this.cu = function (b, c) {
_this.gz();
_this.gy();
};
_this.cv = function (b, c) {
if (_this.b8) {
_this.gr();
_this.gq();
_this.gz();
_this.gx();
}
};
_this.cw = function (b, c) { return _this.g1(c); };
_this.cx = function (b, c) { return _this.gh(c); };
_this.dk = function (b, c) { return _this.fx(c.action, c.position, c.count, c.propertyName); };
_this.propertyUpdated = delegateCombine(_this.propertyUpdated, _this.a8);
var b = _this.selectedSlices;
b.collectionChanged = delegateCombine(b.collectionChanged, _this.cw);
_this.b4 = true;
var c = _this.explodedSlices;
c.collectionChanged = delegateCombine(c.collectionChanged, _this.cv);
_this.b1 = true;
_this.selectedItems = new ObjectCollection(0);
var d = _this.selectedItems;
d.collectionChanged = delegateCombine(d.collectionChanged, _this.cx);
_this.bx = ((function () {
var $ret = new Pool$1(Slice.$);
$ret.create = runOn(_this.a4, _this.a4.g);
$ret.activate = runOn(_this.a4, _this.a4.bf);
$ret.disactivate = runOn(_this.a4, _this.a4.bh);
$ret.destroy = runOn(_this.a4, _this.a4.bg);
return $ret;
})());
_this.bw = ((function () {
var $ret = new Pool$1(PieLabel.$);
$ret.create = runOn(_this.a4, _this.a4.d);
$ret.activate = runOn(_this.a4, _this.a4.as);
$ret.disactivate = runOn(_this.a4, _this.a4.au);
$ret.destroy = runOn(_this.a4, _this.a4.at);
return $ret;
})());
_this.a7 = new PieChartSliceSelector(_this);
FastItemObjectColumn.m();
return _this;
}
PieChartBase.prototype.a3 = function () {
return new PieChartBaseView(this);
};
PieChartBase.prototype.go = function (a) {
this.a4 = a;
};
Object.defineProperty(PieChartBase.prototype, "isFragment", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "isLayer", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
PieChartBase.prototype.onDetachedFromUI = function () {
this.a4.a1();
};
PieChartBase.prototype.onAttachedToUI = function () {
this.a4.ay();
};
PieChartBase.prototype.f0 = function () {
this.a4.ap();
};
Object.defineProperty(PieChartBase.prototype, "bv", {
get: function () {
return this.bq;
},
set: function (a) {
if (this.bq != a) {
var b = this.bq;
this.bq = a;
this.gu("ValueColumn", b, this.bq);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "c1", {
get: function () {
return Math.abs(this.da) > 1 ? this.da : this.da * 100;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "XSRP", {
get: function () {
if (this._xsr == null) {
this._xsr = new SRProvider(this.a4.c.n);
}
return this._xsr;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "d9", {
get: function () {
var a = this.XSRP.b1("InvalidLabelBinding");
if (stringIsNullOrWhiteSpace(a)) {
a = "There is no such value for the labels to bind.";
}
return a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "da", {
get: function () {
return this.c(PieChartBase.hp);
},
set: function (a) {
var b = a;
if (isNaN_(a) || isInfinity(a)) {
b = 0;
}
if (a < 0) {
b = 0;
}
if (a > 100) {
b = 100;
}
this.h(PieChartBase.hp, b);
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "br", {
get: function () {
return this.bo;
},
set: function (a) {
if (this.bo != a) {
var b = this.br;
this.bo = a;
this.gu("LabelColumn", b, this.br);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "bs", {
get: function () {
return this.bp;
},
set: function (a) {
if (this.bp != a) {
var b = this.bs;
this.bp = a;
this.gu("LegendLabelColumn", b, this.bs);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "c0", {
get: function () {
var a = this.c5;
if (isNaN_(a) || isInfinity(a) || a < 0) {
return 0;
}
if (a > 1) {
return 1;
}
return a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "c3", {
get: function () {
var a = this.dg;
if (isNaN_(a) || isInfinity(a) || a < 0) {
return 0;
}
if (a > 1) {
return 1;
}
return a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "explodedSlices", {
get: function () {
return this.au;
},
set: function (a) {
var b = this.au;
if (b != null) {
var c = this.au;
c.collectionChanged = delegateRemove(c.collectionChanged, this.cv);
}
this.b1 = false;
this.au = a;
if (this.au != null) {
var d = this.au;
d.collectionChanged = delegateCombine(d.collectionChanged, this.cv);
this.b1 = true;
}
if (this.b8) {
this.gr();
this.gq();
this.gz();
this.gx();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "selectedSlices", {
get: function () {
return this.av;
},
set: function (a) {
var b = this.av;
b.collectionChanged = delegateRemove(b.collectionChanged, this.cw);
this.b4 = false;
this.av = a;
if (this.av != null) {
var c = this.av;
c.collectionChanged = delegateCombine(c.collectionChanged, this.cw);
this.b4 = true;
}
if (this.b9) {
this.gr();
this.gq();
this.gz();
this.gx();
this.gy();
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "hc", {
get: function () {
return typeCast(DataTemplate.$, this.c(PieChartBase.h0));
},
set: function (a) {
this.h(PieChartBase.h0, a);
},
enumerable: false,
configurable: true
});
PieChartBase.prototype.cb = function () {
return this.a5 != null;
};
PieChartBase.prototype.cc = function () {
return this.a6 != null;
};
Object.defineProperty(PieChartBase.prototype, "df", {
get: function () {
return this.cz;
},
set: function (a) {
var b = this.cz;
this.cz = a;
this.gu("PixelScalingRatio", b, this.cz);
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "c2", {
get: function () {
return this.cy;
},
set: function (a) {
var b = this.cy;
this.cy = a;
this.gu("ActualPixelScalingRatio", b, this.cy);
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "selectedItem", {
get: function () {
return this.c(PieChartBase.io);
},
set: function (a) {
this.h(PieChartBase.io, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "selectedItems", {
get: function () {
return this._selectedItems;
},
set: function (a) {
this._selectedItems = a;
},
enumerable: false,
configurable: true
});
PieChartBase.prototype.gd = function (a, b) {
if (this.labelClick != null) {
this.labelClick(a, b);
}
};
PieChartBase.prototype.gf = function (a, b) {
if (this.selectedItemChanging != null) {
this.selectedItemChanging(a, b);
}
};
PieChartBase.prototype.gi = function (a, b) {
if (this.selectedItemsChanging != null) {
this.selectedItemsChanging(a, b);
}
};
PieChartBase.prototype.ge = function (a, b) {
if (this.selectedItemChanged != null) {
this.selectedItemChanged(a, b);
}
};
PieChartBase.prototype.gg = function (a, b) {
if (this.selectedItemsChanged != null) {
this.selectedItemsChanged(a, b);
}
};
PieChartBase.prototype.gk = function (a, b) {
if (this.sliceClick != null) {
this.sliceClick(a, b);
}
};
PieChartBase.prototype.fz = function (a, b) {
if (!this.b1) {
return;
}
if (!this.explodedSlices.contains(a.a5) && b) {
this.explodedSlices.add(a.a5);
}
if (this.explodedSlices.contains(a.a5) && !b) {
this.explodedSlices.remove(a.a5);
}
};
PieChartBase.prototype.g2 = function (a, b) {
this.b6 = true;
if (!this.selectedSlices.contains(a.a5) && b) {
this.selectedSlices.add(a.a5);
}
if (this.selectedSlices.contains(a.a5) && !b) {
this.selectedSlices.remove(a.a5);
}
this.b6 = false;
};
PieChartBase.prototype.g3 = function (a) {
this.a4.bd(a);
};
PieChartBase.prototype.dp = function (a) {
return this.a4.ae(a);
};
PieChartBase.prototype.i8 = function (a, b) {
var c = new Rect(0, 0, 0, 0, 0);
return c;
};
PieChartBase.prototype.ca = function (a, b) {
var c = a.ah;
if (c == null) {
return false;
}
var d = c.b6();
var e = this.i3 == 1 ? c.a3 : c.ax;
var f = this.i3 == 1 ? c.ax : c.a3;
var g = false;
var h = false;
var i = GeometryUtil.u(d, e, c.a2);
var j = GeometryUtil.u(d, f, c.a2);
e = PieChartBase.c6(i.x, d.x, i.y, d.y);
f = PieChartBase.c6(j.x, d.x, j.y, d.y);
if (this.cd(c)) {
h = true;
}
var k;
k = MathUtil.g(a.ao.right - d.x, a.ao.top - d.y);
if (k > c.a2) {
return false;
}
k = MathUtil.g(a.ao.right - d.x, a.ao.bottom - d.y);
if (k > c.a2) {
return false;
}
k = MathUtil.g(a.ao.left - d.x, a.ao.top - d.y);
if (k > c.a2) {
return false;
}
k = MathUtil.g(a.ao.left - d.x, a.ao.bottom - d.y);
if (k > c.a2) {
return false;
}
if (h) {
return true;
}
if (e > f) {
e = e - 360;
g = true;
}
var l;
l = PieChartBase.c6(a.ao.right, d.x, a.ao.top, d.y);
if (g && l > 180 && l < 360) {
l = l - 360;
}
if (l < e || l > f) {
return false;
}
l = PieChartBase.c6(a.ao.right, d.x, a.ao.bottom, d.y);
if (g && l > 180 && l < 360) {
l = l - 360;
}
if (l < e || l > f) {
return false;
}
l = PieChartBase.c6(a.ao.left, d.x, a.ao.top, d.y);
if (g && l > 180 && l < 360) {
l = l - 360;
}
if (l < e || l > f) {
return false;
}
l = PieChartBase.c6(a.ao.left, d.x, a.ao.bottom, d.y);
if (g && l > 180 && l < 360) {
l = l - 360;
}
if (l < e || l > f) {
return false;
}
return true;
};
PieChartBase.dh = function (a) {
var b = Math.round(a * Math.pow(10, 5)) / Math.pow(10, 5);
return b;
};
PieChartBase.prototype.cd = function (a) {
return PieChartBase.dh(Math.abs(a.ax - a.a3)) == 360;
};
PieChartBase.c6 = function (a, b, c, d) {
var e = MathUtil.g(a - b, c - d);
var f = Math.asin((c - d) / e) * 180 / Math.PI;
if (a < b) {
f = 180 - f;
}
if (a > b) {
f = 360 + f;
}
if (f == 360) {
f = 0;
}
return GeometryUtil.n(f);
};
PieChartBase.g8 = function (a) {
var b = new Array(a.count);
for (var c = 0; c < a.count; c++) {
var d = a._inner[c];
var e = d.ah;
var f = GeometryUtil.u(e.b7, d.ai, e.a2);
b[c] = f.y;
}
for (var g = 0; g < a.count; g++) {
for (var h = g + 1; h < a.count; h++) {
if (b[g] >= b[h]) {
var i = a._inner[g];
a._inner[g] = a._inner[h];
a._inner[h] = i;
var j = b[g];
b[g] = b[h];
b[h] = j;
}
}
}
};
PieChartBase.prototype.g0 = function (a) {
var e_1, _a, e_2, _b;
if (a.count == 0) {
return;
}
var b = this.a4.b4.width;
var c = this.a4.b4.height;
var d = a.count;
var e = a._inner[0].ah.a2;
var f = a._inner[0].ah.b6();
var g = true;
var h = 0;
var i = Number.POSITIVE_INFINITY;
var j = Number.NEGATIVE_INFINITY;
for (var k = 0; k < d - 1; k++) {
var l = a._inner[k];
var m = a._inner[k + 1];
if (l.ao.intersectsWith(m.ao)) {
h++;
}
}
var n = 0;
try {
for (var _c = __values(fromEnum(a)), _d = _c.next(); !_d.done; _d = _c.next()) {
var o = _d.value;
i = Math.min(i, o.ao.height);
j = Math.max(j, o.ao.height);
n += o.ao.height;
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _c.return))
_a.call(_c);
}
finally {
if (e_1)
throw e_1.error;
}
}
if (n > c) {
g = false;
}
if (g && h > 0) {
for (var p = 0; p < d - 1; p++) {
for (var q = p + 1; q < d; q++) {
var r = a._inner[p];
var s = a._inner[q];
if (r.ao.intersectsWith(s.ao)) {
var t = s.ao;
t.y = Math.min(r.ao.bottom + 0.01, c - i);
var u = this.db + e;
var v = Math.abs(f.y - (t.y + i / 2));
var w = Math.sqrt(Math.abs(u * u - v * v));
var x = GeometryUtil.n(s.ai);
if (x > 90 && x < 270) {
w = (t.width + w) * -1;
}
t.x = f.x + w;
s.ao = t;
}
}
}
for (var y = d - 1; y > 0; y--) {
for (var z = y - 1; z >= 0; z--) {
var aa = a._inner[y];
var ab = a._inner[z];
if (aa.ao.intersectsWith(ab.ao)) {
var ac = ab.ao;
ac.y = Math.max(aa.ao.top - i - 0.01, 0);
var ad = this.db + e;
var ae = Math.abs(f.y - (ac.y + i / 2));
var af = Math.sqrt(Math.abs(ad * ad - ae * ae));
var ag = GeometryUtil.n(ab.ai);
if (ag > 90 && ag < 270) {
af = (ac.width + af) * -1;
}
ac.x = f.x + af;
ab.ao = ac;
}
}
}
}
try {
for (var _e = __values(fromEnum(a)), _f = _e.next(); !_f.done; _f = _e.next()) {
var ah = _f.value;
var ai = ah.ao;
if (ai.left > b || ai.right < 0) {
ah._visibility = 1;
if (this.a0 == 0) {
ah.ap._visibility = 1;
}
else {
ah.aq._visibility = 1;
}
}
else if (ai.left < 0) {
var aj = Math.abs(ai.x);
ai.x = 0;
if (aj > ai.width) {
ai.width = 0;
}
else {
}
ah.ao = ai;
}
else if (ai.right > b) {
var ak = ai.right - b;
if (ak > ai.width) {
ai.width = 0;
}
else {
ai.width = ai.width - ak;
}
ah.ao = ai;
}
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_f && !_f.done && (_b = _e.return))
_b.call(_e);
}
finally {
if (e_2)
throw e_2.error;
}
}
};
PieChartBase.prototype.fx = function (a, b, c, d) {
this.gw();
};
PieChartBase.prototype.gw = function () {
this.gp();
this.gr();
this.gq();
this.gz();
this.gx();
this.gy();
this.a4.bs();
};
PieChartBase.prototype.gp = function () {
var e_3, _a;
this.dj = 0;
this.de = 0;
this.co.clear();
this.cn.clear();
this.cm.clear();
if (this.actualItemsSource == null || this.bm == null) {
return;
}
if (this.bv == null || this.bv.count == 0) {
return;
}
try {
for (var _b = __values(fromEnum(this.bv)), _c = _b.next(); !_c.done; _c = _b.next()) {
var a = _c.value;
if (isNaN_(a) || isInfinity(a) || a <= 0) {
continue;
}
this.dj = this.dj + a;
}
}
catch (e_3_1) {
e_3 = { error: e_3_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_3)
throw e_3.error;
}
}
for (var b = 0; b < this.bv.count; b++) {
var c = this.bv.item(b);
var d = this.a1 == 0 ? c <= 0 : c < 0;
if (isNaN_(c) || isInfinity(c) || d) {
continue;
}
var e = this.a2 == 1 ? c / this.dj : c;
var f = this.a2 == 1 ? this.dd / 100 : this.dd;
var g = c > 0 || (this.dd > 0 && this.a1 != 1);
if (e <= f && g) {
this.de = this.de + c;
this.cn.add(b);
this.cm.add1(this.bm.item(b));
}
else {
this.co.add(b);
}
}
};
PieChartBase.prototype.gr = function () {
if (this.actualItemsSource == null || this.bm == null) {
this.bx.count = 0;
return;
}
var a = this.co.count;
var b = this.cn.count > 0;
var c = PieChartBase.dh(this.c4);
var d = PieChartBase.dh(this.c4);
if (b) {
a++;
}
this.dm = a;
for (var e = 0; e < a; e++) {
var f = false;
var g = void 0;
if (e == a - 1 && b) {
g = this.de;
f = true;
}
else {
g = this.bv.item(this.co._inner[e]);
}
if (this.i3 == 1) {
d += PieChartBase.dh(Math.abs(g) * 360 / this.dj);
}
else {
d -= PieChartBase.dh(Math.abs(g) * 360 / this.dj);
}
var h = this.bx.item(e);
h.aw = true;
h.a3 = c;
h.ax = d;
h.a1 = this.c1;
h.a0 = this.c1;
h.isOthersSlice = f;
h.ay = this.c0;
h.a5 = e;
h.dataContext = f ? this.cm : this.bm.item(this.co._inner[e]);
this.a7.j(h);
h.isExploded = this.b1 ? this.explodedSlices.contains(e) : false;
c = d;
h.aw = false;
}
this.bx.count = a;
};
PieChartBase.prototype.fh = function () {
var a = this.XSRP.b7;
if (stringIsNullOrWhiteSpace(a)) {
a = "Others";
}
return this.e6 != null ? this.e6 : a;
};
PieChartBase.prototype.gq = function () {
var _this = this;
if (this.actualItemsSource == null || this.bm == null) {
this.bw.count = 0;
return;
}
if (this.br == null || this.br.count == 0 || this.az == 0) {
this.bw.count = 0;
}
var a = this.co.count;
if (this.cn.count > 0) {
a++;
}
this.a4.av();
var b = 0;
var _loop_1 = function (c) {
var d = stringEmpty();
var e = false;
var f;
var g = null;
if (c == a - 1 && this_1.cn.count > 0) {
f = this_1.fh();
e = true;
if (this_1.cb() || this_1.ap != null || this_1.as != null) {
var h = ((function () {
var $ret = new PieSliceDataContext();
$ret.series = _this;
$ret.item = e ? _this.cm : _this.bm.item(_this.co._inner[c]);
$ret.percentValue = _this.c9(_this.bx.item(c));
$ret.isOthersSlice = e;
return $ret;
})());
if (f != null) {
h.itemLabel = f.toString();
h.legendLabel = f.toString();
}
var i = h;
i = i.flatten();
if (this_1.ap != null && !e) {
f = this_1.ap.i(i);
}
else if (this_1.as != null && e) {
f = this_1.as.i(i);
}
else if (this_1.cb()) {
f = this_1.a5(i);
}
}
if (null != f) {
d = f.toString();
}
else {
d = this_1.fh();
}
}
else {
if (this_1.br != null && this_1.br.count >= this_1.co.count) {
f = this_1.br.item(this_1.co._inner[c]);
}
else {
f = null;
}
g = (this_1.bs != null && this_1.bs.count > 0) ? this_1.bs.item(this_1.co._inner[c]) : null;
if (this_1.cb() || this_1.ap != null || this_1.as != null) {
var j = ((function () {
var $ret = new PieSliceDataContext();
$ret.series = _this;
$ret.item = e ? _this.cm : _this.bm.item(_this.co._inner[c]);
$ret.itemLabel = f != null ? f.toString() : null;
$ret.legendLabel = g != null ? g.toString() : f != null ? f.toString() : null;
$ret.percentValue = _this.c9(_this.bx.item(c));
$ret.isOthersSlice = e;
return $ret;
})());
var k = j;
k = k.flatten();
var formattedLabel_ = null;
if ((this_1.ap != null && !e) || (this_1.as != null && e)) {
if (e) {
formattedLabel_ = this_1.as.i(k);
}
else {
formattedLabel_ = this_1.ap.i(k);
}
}
else {
formattedLabel_ = this_1.a5(k);
}
if (null == formattedLabel_ && this_1.br != null && this_1.br.count > 0) {
f = this_1.br.item(this_1.co._inner[c]);
}
else {
f = formattedLabel_;
}
}
var label_ = f;
var errorMsg_ = this_1.d9;
if (label_ === undefined) {
throw new Error(errorMsg_);
}
;
if (null != f) {
d = f.toString();
}
else {
d = null;
}
}
if (this_1.br != null && this_1.br.count > 0) {
var l = this_1.bw.item(c);
var m = this_1.bx.item(c);
m.aj = l;
l.ai = GeometryUtil.n((m.a3 + m.ax) / 2);
l.ah = m;
l.aj = ((function () {
var $ret = new TextBlock();
$ret.al = d;
return $ret;
})());
if (this_1.hc == null) {
l.dataContext = e ? this_1.cm : this_1.bm.item(this_1.co._inner[c]);
l.ak(this_1.a4);
}
else {
}
l._visibility = 0;
l.ao = this_1.a4.b3(l);
b++;
}
if (this_1.bs != null && this_1.bs.count > 0) {
var n = this_1.bx.item(c);
n.bf = g != null ? g.toString() : null;
}
};
var this_1 = this;
for (var c = 0; c < a; c++) {
_loop_1(c);
}
this.bw.count = b;
};
PieChartBase.prototype.gz = function () {
var e_4, _a;
if (this.actualItemsSource == null || this.bm == null) {
return;
}
var a = this.a4.b5();
this.i9 = new Rect(0, 0, 0, a.width, a.height);
var b = this.a4.ab();
var c = this.a4.aa(this.jc);
b = isNaN_(b) ? 0 : b / 2;
c = isNaN_(c) ? 0 : c / 2;
b = Math.max(c, b);
var d = Math.min(a.width / 2, a.height / 2);
var e = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
var f = d * this.c3;
var g = f + b;
if (g > d) {
var h = g - d;
f = f - h;
}
try {
for (var _b = __values(fromEnum(this.bx.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var i = _c.value;
var j = GeometryUtil.t(a.width, a.height, true, (i.a3 + i.ax) / 2, f * this.c0);
i.aw = true;
i.a1 = this.c1;
i.a0 = this.c1;
i.a2 = f;
i.ay = this.c0;
i.b7 = e;
i.b5 = j;
this.g3(i);
i.aw = false;
}
}
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;
}
}
this.a4.bs();
};
PieChartBase.prototype.gx = function () {
var e_5, _a, e_6, _b, e_7, _c, e_8, _d, e_9, _e;
var a = this.a4.b4.width;
var b = this.a4.b4.height;
if (b == 0 || a == 0) {
return;
}
if (this.bw.a.count == 0 || this.az == 0) {
this.bw.count = 0;
return;
}
var c = new List$1(PieLabel.$, 0);
var d = new List$1(PieLabel.$, 0);
var e = new List$1(PieLabel.$, 0);
var f = new List$1(PieLabel.$, 0);
try {
for (var _f = __values(fromEnum(this.bw.a)), _g = _f.next(); !_g.done; _g = _f.next()) {
var g = _g.value;
var h = g.ah;
if (h == null) {
continue;
}
var i = h.b6();
var j = g.ao.width;
var k = g.ao.height;
if (this.az == 1 || this.az == 4) {
var l = h.a2 * h.a1 / 100;
var m = GeometryUtil.u(i, g.ai, h.a2 - (h.a2 - l) / 2);
g.ao = new Rect(0, m.x - j / 2, m.y - k / 2, j, k);
var n = this.ca(g, m);
if (n || this.az == 1) {
if (this.iy == null) {
h.f(Slice.bp);
}
else {
h.b2 = this.iy;
}
h.au = true;
e.add(g);
g.ag = 1;
if (g.ah.ai.a0 == 0) {
g.ap._visibility = 1;
}
else {
g.aq._visibility = 1;
}
if (!n && this.az == 1) {
g._visibility = 1;
}
else {
g._visibility = 0;
}
continue;
}
}
if (this.az == 2 || this.az == 4) {
var o = PieChartBase.c7(i, h.a2, g);
var p = GeometryUtil.u(i, g.ai, o);
g.ao = new Rect(0, p.x - j / 2, p.y - k / 2, j, k);
var q = this.ca(g, p);
if (q || this.az == 2) {
if (this.iy == null) {
h.f(Slice.bp);
}
else {
h.b2 = this.iy;
}
h.au = true;
f.add(g);
g.ag = 2;
if (g.ah.ai.a0 == 0) {
g.ap._visibility = 1;
}
else {
g.aq._visibility = 1;
}
if (!q && this.az == 2) {
g._visibility = 1;
}
else {
g._visibility = 0;
}
continue;
}
}
if (this.iz == null) {
h.f(Slice.bp);
}
else {
h.b2 = this.iz;
}
h.au = false;
var r = GeometryUtil.u(i, g.ai, h.a2 + this.db);
g.ag = 3;
g._visibility = 0;
g.al();
if (g.ai < 90 && g.ai >= 0) {
g.ao = new Rect(0, r.x, r.y, j, k);
c.add(g);
}
else if (g.ai < 180 && g.ai >= 90) {
g.ao = new Rect(0, r.x - j, r.y, j, k);
d.add(g);
}
else if (g.ai < 270 && g.ai >= 180) {
g.ao = new Rect(0, r.x - j, r.y - k, j, k);
d.add(g);
}
else {
g.ao = new Rect(0, r.x, r.y - k, j, k);
c.add(g);
}
if (g.ao.y < 0) {
g.ao = new Rect(0, g.ao.x, 0, g.ao.width, g.ao.height);
}
if (g.ao.bottom > b) {
g.ao = new Rect(0, g.ao.x, b - g.ao.height, g.ao.width, g.ao.height);
}
}
}
catch (e_5_1) {
e_5 = { error: e_5_1 };
}
finally {
try {
if (_g && !_g.done && (_a = _f.return))
_a.call(_f);
}
finally {
if (e_5)
throw e_5.error;
}
}
PieChartBase.g8(c);
this.g0(c);
PieChartBase.g8(d);
this.g0(d);
try {
for (var _h = __values(fromEnum(e)), _j = _h.next(); !_j.done; _j = _h.next()) {
var s = _j.value;
this.a4.bn(s, s.ao.x, s.ao.y);
}
}
catch (e_6_1) {
e_6 = { error: e_6_1 };
}
finally {
try {
if (_j && !_j.done && (_b = _h.return))
_b.call(_h);
}
finally {
if (e_6)
throw e_6.error;
}
}
try {
for (var _k = __values(fromEnum(f)), _l = _k.next(); !_l.done; _l = _k.next()) {
var t = _l.value;
this.a4.bn(t, t.ao.x, t.ao.y);
}
}
catch (e_7_1) {
e_7 = { error: e_7_1 };
}
finally {
try {
if (_l && !_l.done && (_c = _k.return))
_c.call(_k);
}
finally {
if (e_7)
throw e_7.error;
}
}
try {
for (var _m = __values(fromEnum(c)), _o = _m.next(); !_o.done; _o = _m.next()) {
var u = _o.value;
this.a4.bn(u, u.ao.x, u.ao.y);
if (u.ah.ai.a0 == 0) {
u.am();
}
else {
u.an();
}
}
}
catch (e_8_1) {
e_8 = { error: e_8_1 };
}
finally {
try {
if (_o && !_o.done && (_d = _m.return))
_d.call(_m);
}
finally {
if (e_8)
throw e_8.error;
}
}
try {
for (var _p = __values(fromEnum(d)), _q = _p.next(); !_q.done; _q = _p.next()) {
var v = _q.value;
this.a4.bn(v, v.ao.x, v.ao.y);
if (v.ah.ai.a0 == 0) {
v.am();
}
else {
v.an();
}
}
}
catch (e_9_1) {
e_9 = { error: e_9_1 };
}
finally {
try {
if (_q && !_q.done && (_e = _p.return))
_e.call(_p);
}
finally {
if (e_9)
throw e_9.error;
}
}
this.a4.bs();
};
PieChartBase.c7 = function (a, b, c) {
var d = c.ai * Math.PI / 180;
var e = 1;
var f = GeometryUtil.u({ $type: Point_$type, x: 0, y: 0 }, c.ai, e);
var g = PieChartBase.i5(c);
var h = Math.sqrt(g.x * g.x + g.y * g.y);
var i = { $type: Point_$type, x: g.x / h, y: g.y / h };
var j = PieChartBase.c8(f, i);
var k = h / b;
var l = j * k;
var m = l;
var n = GeometryUtil.j({ $type: Point_$type, x: 0, y: 0 }, f);
var o = GeometryUtil.j({ $type: Point_$type, x: 0, y: 0 }, i);
if (o < n) {
m = -m;
}
var p = GeometryUtil.u(a, (d + m) * 180 / Math.PI, b);
var q = PieChartBase.i4(c, p);
var r = Math.sqrt((q.x - a.x) * (q.x - a.x) + (q.y - a.y) * (q.y - a.y));
var s = r - 5;
return s;
};
PieChartBase.i4 = function (a, b) {
var c = GeometryUtil.n(a.ai);
var d = a.ao.width / 2;
var e = a.ao.height / 2;
if (c >= 0 && c <= 90) {
return { $type: Point_$type, x: b.x - d, y: b.y - e };
}
if (c >= 90 && c <= 180) {
return { $type: Point_$type, x: b.x + d, y: b.y - e };
}
if (c >= 180 && c <= 270) {
return { $type: Point_$type, x: b.x + d, y: b.y + e };
}
return { $type: Point_$type, x: b.x - d, y: b.y + e };
};
PieChartBase.c8 = function (a, b) {
var c = a.x * b.x + a.y * b.y;
var d = Math.sqrt(a.x * a.x + a.y * a.y);
var e = Math.sqrt(b.x * b.x + b.y * b.y);
var f = Math.acos(c / (d * e));
return f;
};
PieChartBase.i5 = function (a) {
var b = GeometryUtil.n(a.ai);
var c = a.ao.width / 2;
var d = a.ao.height / 2;
if (b >= 0 && b <= 90) {
return { $type: Point_$type, x: c, y: d };
}
if (b >= 90 && b <= 180) {
return { $type: Point_$type, x: -c, y: d };
}
if (b >= 180 && b <= 270) {
return { $type: Point_$type, x: -c, y: -d };
}
return { $type: Point_$type, x: c, y: -d };
};
PieChartBase.prototype.gy = function () {
var e_10, _a;
var _this = this;
if (this.legend == null || !this.legend.isItemwise) {
return;
}
if ((this.br == null || this.br.count == 0) && (this.bs == null || this.bs.count == 0)) {
this.legend.clearLegendItemsForSeries(this);
return;
}
this.cl = new List$1(UIElement.$, 0);
var _loop_2 = function (a) {
var b = new ContentControl();
var c = this_2.dp(a);
var d = this_2.a4.bu(a);
var e = this_2.a4.bv(a);
b.content = ((function () {
var $ret = new PieSliceDataContext();
$ret.series = _this;
$ret.slice = a;
$ret.item = a.dataContext;
$ret.itemBrush = d;
$ret.outline = e;
$ret.thickness = a.a4;
$ret.itemLabel = c != null ? c.toString() : null;
$ret.legendLabel = a.isOthersSlice ? _this.fh() : a.bf != null ? a.bf : (c != null ? c.toString() : null);
$ret.percentValue = _this.c9(a);
$ret.isOthersSlice = a.isOthersSlice;
return $ret;
})());
var f = b.content;
if (this_2.cc() || this_2.aq != null || this_2.ar != null) {
var g = null;
if (this_2.cc()) {
g = this_2.a6(b.content);
}
if (this_2.aq != null && !f.isOthersSlice) {
g = this_2.aq.i(b.content);
}
if (this_2.ar != null && f.isOthersSlice) {
g = this_2.ar.i(b.content);
}
if (g != null) {
f.legendLabel = g.toString();
}
}
if (this_2.legendItemTemplate != null) {
b.ah = this_2.legendItemTemplate;
}
this_2.cl.add(b);
};
var this_2 = this;
try {
for (var _b = __values(fromEnum(this.bx.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var a = _c.value;
_loop_2(a);
}
}
catch (e_10_1) {
e_10 = { error: e_10_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_10)
throw e_10.error;
}
}
if (this.legend.isItemwise) {
var h = this.legend;
h.createItemwiseLegendItems(this.cl, this);
}
};
PieChartBase.prototype.bl = function () {
var a = new PieChartVisualData();
a.viewport = RectData.b(this.i9);
this.a4.ao(a);
for (var b = 0; b < this.bx.count; b++) {
var c = this.bx.item(b).am();
a.slices.add(c);
if (this.bx.item(b).isOthersSlice) {
a.othersSlice = this.bx.item(b).am();
}
}
a.others = this.cm;
a.name = this.name;
a.radiusFactor = this.c3;
a.leaderLineMargin = this.dc;
return a;
};
PieChartBase.prototype.d4 = function () {
var a = this.bl();
a.scaleByViewport();
return a.serialize();
};
PieChartBase.prototype.bt = function (a) {
var b = null;
return this.bm.registerColumn(a, b, false);
};
PieChartBase.prototype.bu = function (a) {
var b = null;
return this.bm.registerColumnObject(a, b, false);
};
PieChartBase.prototype.gs = function (a, b, c, d) {
var e_11, _a;
switch (b) {
case PieChartBase.$$p[14]:
this.actualItemsSource = this.cs();
break;
case PieChartBase.$$p[45]:
case PieChartBase.$$p[46]:
this.iy = this.i2(this.i0);
this.iz = this.i2(this.i1);
this.ak = this.ao(this.am);
this.al = this.ao(this.al);
this.actualItemsSource = this.cs();
break;
case PieChartBase.$$p[1]:
if (this.ch) {
this.ak = this.ao(this.am);
this.al = this.ao(this.al);
this.iy = this.i2(this.i0);
this.iz = this.i2(this.i1);
}
this.bm = ((function () {
var $ret = new FastItemsSource();
$ret.e = d;
return $ret;
})());
break;
case PieChartBase.$$p[16]:
case PieChartBase.$$p[17]:
if (this.ef != null) {
this.ap = new BindingFormatter();
this.ap.j = this.ef;
this.ap.d = this.ag;
}
else {
this.ap = null;
}
break;
case PieChartBase.$$p[39]:
case PieChartBase.$$p[40]:
if (this.fa != null) {
this.as = new BindingFormatter();
this.as.j = this.fa;
this.as.d = this.aj;
}
else {
this.as = null;
}
break;
case PieChartBase.$$p[29]:
case PieChartBase.$$p[30]:
if (this.ew != null) {
this.aq = new BindingFormatter();
this.aq.j = this.ew;
this.aq.d = this.ah;
}
else {
this.aq = null;
}
break;
case PieChartBase.$$p[32]:
case PieChartBase.$$p[33]:
if (this.e1 != null) {
this.ar = new BindingFormatter();
this.ar.j = this.e1;
this.ar.d = this.ai;
}
else {
this.ar = null;
}
break;
case PieChartBase.$$p[9]:
if (typeCast(FastItemsSource.$, c) != null) {
var e = c;
e.event = delegateRemove(e.event, this.dk);
this.b2 = false;
c.deregisterColumn(this.bv);
c.deregisterColumn(this.br);
this.bv = null;
this.br = null;
this.selectedItem = null;
this.selectedItems.clear();
if (this.selectedSlices != null) {
this.selectedSlices.clear();
}
(typeCast(FastItemsSource.$, c)).deregisterColumn(this.bs);
this.bs = null;
}
if (typeCast(FastItemsSource.$, d) != null) {
var f = d;
f.event = delegateCombine(f.event, this.dk);
this.b2 = true;
this.bv = this.bt(this.fi(this.fv));
this.br = this.bu(this.fg(this.ej));
this.bs = this.bu(this.ez);
this.gr();
if (this.selectedItem != null || this.selectedItems.count > 0) {
this.ha();
}
else if (this.selectedSlices != null && this.selectedSlices.count > 0) {
this.hb();
}
}
this.gw();
break;
case PieChartBase.$$p[51]:
if (this.bm != null) {
this.bm.deregisterColumn(this.bv);
this.bv = this.bt(this.fi(this.fv));
}
break;
case PieChartBase.$$p[31]:
if (this.bm != null) {
this.bm.deregisterColumn(this.bs);
this.bs = this.bu(this.ez);
this.gq();
this.gx();
this.gy();
}
break;
case PieChartBase.$$p[11]:
this.gy();
break;
case PieChartBase.$$p[10]:
case PieChartBase.$$p[19]:
if (this.bm != null) {
this.bm.deregisterColumn(this.br);
this.br = this.bu(this.fg(this.ej));
this.gq();
this.gx();
this.gy();
}
break;
case PieChartBase.$$p[47]:
this.c4 = d;
this.gr();
this.gq();
this.gz();
this.gx();
break;
case PieChartBase.$$p[49]:
this.a4.bq(this.dr);
break;
case PieChartBase.$$p[34]:
var g = typeCast(IChartLegend_$type, c);
if (g != null) {
g.clearLegendItemsForSeries(this);
}
this.gy();
break;
case PieChartBase.$$p[27]:
case PieChartBase.$$p[28]:
this.gy();
break;
case PieChartBase.$$p[42]:
case PieChartBase.$$p[8]:
case PieChartBase.$$p[48]:
this.gr();
this.gq();
this.gz();
this.gx();
break;
case PieChartBase.$$p[35]:
case PieChartBase.$$p[43]:
this.gz();
this.gy();
break;
case PieChartBase.$$p[7]:
this.ak = this.ao(this.am);
break;
case PieChartBase.$$p[41]:
this.al = this.ao(this.an);
break;
case PieChartBase.$$p[0]:
if (c != null) {
var h = c;
h.collectionChanged = delegateRemove(h.collectionChanged, this.cu);
this.b0 = false;
}
if (d != null) {
var i = d;
i.collectionChanged = delegateCombine(i.collectionChanged, this.cu);
this.b0 = true;
}
this.gz();
this.gy();
break;
case PieChartBase.$$p[4]:
if (c != null) {
var j = c;
j.collectionChanged = delegateRemove(j.collectionChanged, this.cu);
this.b3 = false;
}
if (d != null) {
var k = d;
k.collectionChanged = delegateCombine(k.collectionChanged, this.cu);
this.b3 = true;
}
this.gz();
this.gy();
break;
case "ValueColumn":
case PieChartBase.$$p[37]:
case PieChartBase.$$p[38]:
this.gw();
this.ha();
this.hb();
break;
case PieChartBase.$$p[5]:
case PieChartBase.$$p[6]:
this.gw();
break;
case PieChartBase.$$p[21]:
this.gq();
this.gx();
this.a4.bs();
break;
case PieChartBase.$$p[18]:
this.iy = this.i2(this.i0);
break;
case PieChartBase.$$p[20]:
this.iz = this.i2(this.i1);
break;
case PieChartBase.$$p[2]:
case PieChartBase.$$p[3]:
case PieChartBase.$$p[15]:
this.gq();
this.gx();
break;
case PieChartBase.$$p[36]:
this.gq();
this.gx();
this.gy();
break;
case PieChartBase.$$p[25]:
this.gx();
break;
case PieChartBase.$$p[23]:
this.gx();
break;
case "TextStyle":
this.a4.bi();
break;
case "PixelScalingRatio":
if (isNaN_(DeviceUtils.a(this.df))) {
this.c2 = 1;
}
else {
this.c2 = DeviceUtils.a(this.df);
}
break;
case "ActualPixelScalingRatio":
this.a4.a4();
break;
case "LabelTemplate":
this.gq();
this.gx();
break;
case PieChartBase.$$p[24]:
case PieChartBase.$$p[22]:
this.bw.c(runOn(this.a4, this.a4.bm));
this.gx();
break;
case PieChartBase.$$p[13]:
this.a4.a3();
break;
case "InnerExtent":
this.gw();
break;
case PieChartBase.$$p[26]:
this.gw();
break;
case "SelectedItem":
if (!this.b6) {
this.gr();
this.gz();
this.gy();
}
break;
case PieChartBase.$$p[44]:
if (EnumUtil.getEnumValue(SliceSelectionMode_$type, d) == 1 && this.selectedItems != null && this.selectedItems.count > 1) {
this.selectedItems.clear();
}
else if (EnumUtil.getEnumValue(SliceSelectionMode_$type, d) == 2 && this.selectedItem != null && this.selectedItems != null) {
if (!this.selectedItems.contains1(this.selectedItem)) {
if (typeCast(PieSliceOthersContext.$, this.selectedItem) !== null) {
var l = typeCast(PieSliceOthersContext.$, this.selectedItem);
try {
for (var _b = __values(fromEn(l.data)), _c = _b.next(); !_c.done; _c = _b.next()) {
var m = _c.value;
this.selectedItems.add1(m);
}
}
catch (e_11_1) {
e_11 = { error: e_11_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_11)
throw e_11.error;
}
}
}
else {
this.selectedItems.add1(this.selectedItem);
}
this.hb();
}
}
this.ha();
this.gr();
this.gz();
break;
}
};
PieChartBase.prototype.ao = function (a) {
var e_12, _a;
if (!this.ch || !this.ci || this.itemsSource != null) {
return a;
}
if (a == null) {
return null;
}
var b = new BrushCollection();
try {
for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
var d = BrushUtil.t(c);
b.add(d);
}
}
catch (e_12_1) {
e_12 = { error: e_12_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_12)
throw e_12.error;
}
}
return b;
};
PieChartBase.prototype.i2 = function (a) {
if (!this.ch || !this.ci || this.itemsSource != null) {
return a;
}
var b = BrushUtil.h(0, 0, 0, 0);
return b;
};
PieChartBase.prototype.fg = function (a) {
if (this.ch && this.itemsSource == null) {
return "Label";
}
return a;
};
PieChartBase.prototype.fi = function (a) {
if (this.ch && this.itemsSource == null) {
return "Value";
}
return a;
};
PieChartBase.prototype.cs = function () {
if (this.itemsSource != null) {
return this.itemsSource;
}
if (!this.ch) {
return null;
}
if (this.cp == null) {
this.cp = PieChartMockDataGenerator.a();
}
return this.cp;
};
PieChartBase.prototype.g1 = function (a) {
if (this.b7) {
return;
}
this.hb();
if (this.b9) {
this.gr();
this.gz();
this.gy();
}
};
PieChartBase.prototype.gh = function (a) {
if (a.action == 4 && a.newItems == null && a.oldItems == null) {
return;
}
if (this.b6) {
return;
}
this.ha();
if (this.b9) {
this.gr();
this.gz();
this.gy();
}
var b = new ObjectCollection(0);
if (a.oldItems != null) {
for (var c = 0; c < a.oldItems.count; c++) {
b.add1(a.oldItems.item(c));
}
}
var d = new ObjectCollection(0);
if (a.newItems != null) {
for (var e = 0; e < a.newItems.count; e++) {
d.add1(a.newItems.item(e));
}
}
var f = this.selectedItems;
this.gg(this, new SelectedItemsChangedEventArgs(b, d, f));
};
PieChartBase.prototype.gu = function (a, b, c) {
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
if (this.propertyUpdated != null) {
this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
}
};
PieChartBase.prototype.hb = function () {
var e_13, _a, e_14, _b;
if (this.actualItemsSource == null || this.bx.a.count == 0) {
return;
}
this.b6 = true;
var a = this.selectedSlices.count;
if (a == 0) {
if (this.selectedItems.count > 0) {
this.selectedItems.clear();
}
if (this.selectedItem != null) {
this.selectedItem = null;
}
}
if (this.bk == 1) {
if (a != 0) {
var b_1 = this.bx.a._inner[this.selectedSlices._inner[a - 1]];
if (b_1.isOthersSlice) {
this.selectedItem = ((function () {
var $ret = new PieSliceOthersContext();
$ret.data = typeCast(IList_$type, b_1.dataContext);
$ret.slice = b_1;
return $ret;
})());
}
else {
this.selectedItem = b_1.dataContext;
}
}
}
else if (this.bk == 2) {
if (a != 0) {
this.selectedItems.clear();
try {
for (var _c = __values(fromEnum(this.selectedSlices)), _d = _c.next(); !_d.done; _d = _c.next()) {
var c = _d.value;
var d = this.bx.a._inner[c];
if (d.isOthersSlice) {
var e = typeCast(IEnumerable_$type, d.dataContext);
try {
for (var _e = (e_14 = void 0, __values(fromEn(e))), _f = _e.next(); !_f.done; _f = _e.next()) {
var f = _f.value;
this.a7.e(f);
}
}
catch (e_14_1) {
e_14 = { error: e_14_1 };
}
finally {
try {
if (_f && !_f.done && (_b = _e.return))
_b.call(_e);
}
finally {
if (e_14)
throw e_14.error;
}
}
}
else {
this.a7.e(d.dataContext);
}
}
}
catch (e_13_1) {
e_13 = { error: e_13_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _c.return))
_a.call(_c);
}
finally {
if (e_13)
throw e_13.error;
}
}
this.selectedItem = this.bx.a._inner[this.selectedSlices._inner[a - 1]].dataContext;
}
}
this.b6 = false;
};
PieChartBase.prototype.ha = function () {
var e_15, _a;
if (this.actualItemsSource == null || this.bx.a.count == 0) {
return;
}
this.b7 = true;
this.selectedSlices.clear();
try {
for (var _b = __values(fromEnum(this.bx.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var a = _c.value;
if (this.a7.d(a)) {
this.selectedSlices.add(a.a5);
}
}
}
catch (e_15_1) {
e_15 = { error: e_15_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_15)
throw e_15.error;
}
}
this.b7 = false;
};
PieChartBase.prototype.g6 = function (a, b) {
this.g7(a, b, false);
};
PieChartBase.prototype.g7 = function (a, b, c) {
if (this.b9) {
if (this.bk == 1) {
this.a7.k(a);
}
else if (this.bk == 2) {
this.a7.i(a);
}
}
var d = new SliceClickEventArgs(a, this.a4.af(b));
this.gk(this, d);
if (!c) {
this.a4.bo(a, b);
}
};
PieChartBase.prototype.g5 = function (a) {
this.a4.al(a);
};
PieChartBase.prototype.cg = function (a, b) {
var c = new LabelClickEventArgs(a, this.a4.af(b));
this.gd(this, c);
return c.allowSliceClick;
};
PieChartBase.prototype.f1 = function (a, b) {
if (a != this.dn) {
this.dn = a;
if (a != null) {
this.gl(a, b);
}
}
this.a4.bo(a, b);
};
PieChartBase.prototype.bf = function (a, b) {
return new SliceEventArgs(a, b);
};
PieChartBase.prototype.bg = function (a, b, c) {
var d = new SliceEventArgs(a, b);
d.position = c;
return d;
};
PieChartBase.prototype.gl = function (a, b) {
if (this.sliceEnter != null) {
this.sliceEnter(a, this.bf(a, b));
}
};
PieChartBase.prototype.gm = function (a, b) {
if (this.sliceLeave != null) {
this.sliceLeave(a, this.bf(a, b));
}
};
PieChartBase.prototype.gn = function (a, b, c) {
if (this.sliceHover != null) {
this.sliceHover(a, this.bg(a, b, c));
}
};
PieChartBase.prototype.f4 = function (a, b, c) {
if (a != this.dn) {
var d = this.dn;
if (d != null) {
this.gm(d, b);
}
this.dn = a;
if (this.dn != null) {
this.gl(a, b);
}
}
else {
if (this.dn != null) {
this.gn(a, b, b.getPosition(this));
}
}
this.a4.bo(a, b);
};
PieChartBase.prototype.f3 = function (a, b) {
this.f4(a, b, false);
};
PieChartBase.prototype.f2 = function (a, b) {
this.a4.am();
if (this.dn != null) {
if (this.dn != null) {
this.gm(this.dn, b);
}
this.dn = null;
}
};
PieChartBase.prototype.gj = function () {
this.gw();
};
PieChartBase.prototype.provideContainer = function (a) {
this.a4.az(a);
};
PieChartBase.prototype.gb = function (a, b) {
this.a4.a0(a, b);
};
PieChartBase.prototype.notifyContainerResized = function () {
this.a4.ax();
};
PieChartBase.prototype.i7 = function () {
return this.a4.b2();
};
PieChartBase.prototype.i6 = function () {
return this.a4.bz();
};
PieChartBase.prototype.destroy = function () {
this.gv();
if (this.b0) {
var a = this.ak;
a.collectionChanged = delegateRemove(a.collectionChanged, this.cu);
this.b0 = false;
}
if (this.b3) {
var b = this.al;
b.collectionChanged = delegateRemove(b.collectionChanged, this.cu);
this.b3 = false;
}
this.a4.az(null);
};
Object.defineProperty(PieChartBase.prototype, "fq", {
get: function () {
return this.ds;
},
set: function (a) {
var b = this.ds;
this.ds = a;
this.gu("TextStyle", b, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "container", {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "isStacked", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "isVertical", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "hasMarkers", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "isUsableInLegend", {
get: function () {
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieChartBase.prototype, "hasSubItems", {
get: function () {
return false;
},
enumerable: false,
configurable: true
});
PieChartBase.prototype.c9 = function (a) {
if (a == null || this.bv == null || this.co == null) {
return NaN;
}
if (a.isOthersSlice) {
return this.de / this.dj * 100;
}
else {
return this.bv.item(this.co._inner[a.a5]) / this.dj * 100;
}
};
PieChartBase.prototype.f9 = function (source_, a, b, c) {
if (source_.dataView && source_.dataSource) {
source_ = source_.dataView();
}
;
if (!this.cj(source_)) {
return;
}
var d = this.bm;
if (d == null) {
return;
}
d.handleCollectionChanged(new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
};
PieChartBase.prototype.f5 = function (source_) {
if (source_.dataView && source_.dataSource) {
source_ = source_.dataView();
}
;
if (!this.cj(source_)) {
return;
}
var a = this.bm;
a.handleCollectionChanged(new NotifyCollectionChangedEventArgs(0, 4));
};
PieChartBase.prototype.cj = function (a) {
return PieChartBase.ck(a, this.itemsSource);
};
PieChartBase.ck = function (a, b) {
return a == b;
};
PieChartBase.prototype.f7 = function (source_, a, b) {
if (source_.dataView && source_.dataSource) {
source_ = source_.dataView();
}
;
if (!this.cj(source_)) {
return;
}
var c = this.bm;
if (c == null) {
return;
}
c.handleCollectionChanged(new NotifyCollectionChangedEventArgs(1, 0, b, a));
};
PieChartBase.prototype.f8 = function (source_, a, b) {
if (source_.dataView && source_.dataSource) {
source_ = source_.dataView();
}
;
if (!this.cj(source_)) {
return;
}
var c = this.bm;
if (c == null) {
return;
}
c.handleCollectionChanged(new NotifyCollectionChangedEventArgs(1, 1, b, a));
};
PieChartBase.prototype.g4 = function (source_) {
if (source_.dataView && source_.dataSource) {
source_ = source_.dataView();
}
;
this.itemsSource = source_;
};
PieChartBase.prototype.gv = function () {
this.itemsSource = null;
};
PieChartBase.prototype.g9 = function () {
this.a4.bi();
};
PieChartBase.prototype.bn = function () {
return FontUtil.toFontInfo(this.a4.c.n, this.fq);
};
PieChartBase.prototype.resolveLegendIndex = function () {
return -1;
};
PieChartBase.prototype.forSubItems = function (a) {
};
PieChartBase.$t = markType(PieChartBase, 'PieChartBase', Control.$, [INotifyPropertyChanged_$type, ILegendOwner_$type, ILegendSeries_$type, ILegendTemplateProvider_$type]);
PieChartBase.hp = DependencyProperty.i("InnerExtent", Number_$type, PieChartBase.$, new PropertyMetadata(2, 0, function (a, b) { return a.gu("InnerExtent", b.oldValue, b.newValue); }));
PieChartBase.h0 = DependencyProperty.i("LabelTemplate", DataTemplate.$, PieChartBase.$, new PropertyMetadata(2, null, function (a, b) { return a.gu("LabelTemplate", b.oldValue, b.newValue); }));
PieChartBase.io = DependencyProperty.i("SelectedItem", Base.$, PieChartBase.$, new PropertyMetadata(1, function (a, b) {
var c = typeCast(PieChartBase.$, a);
if (c.b5) {
return;
}
var d = new SelectedItemChangingEventArgs(b.oldValue, b.newValue);
c.gf(c, d);
if (!d.cancel) {
if (!c.b6) {
c.ha();
}
c.gu("SelectedItem", b.oldValue, b.newValue);
c.ge(a, new SelectedItemChangedEventArgs(b.oldValue, b.newValue));
}
else {
c.b5 = true;
c.selectedItem = b.oldValue;
c.b5 = false;
}
}));
PieChartBase.$$p = markDep(DependencyProperty, PropertyMetadata, PieChartBase, 'gu', ['ActualBrushes:ak:hd', [BrushCollection.$, null], 'ActualItemsSource::he', [IEnumerable_$type, null], 'ActualLabelInnerColor:iy:hf', [Brush.$, null], 'ActualLabelOuterColor:iz:hg', [Brush.$, null], 'ActualOutlines:al:hh', [BrushCollection.$, null], 'AllowSliceExplosion:b8:hi', [0, true], 'AllowSliceSelection:b9:hj', [0, true], 'Brushes:am:hk', [BrushCollection.$, null], 'ExplodedRadius:c5:hl', [1, 0.2], 'FastItemsSource:bm:hm', [FastItemsSource.$], 'FormatLabel:a5:hn', [Delegate_$type], 'FormatLegendLabel:a6:ho', [Delegate_$type], 'IsDragInteractionEnabled:ce:hq', [0, false], 'IsSurfaceInteractionDisabled:cf:hr', [0, false], 'ItemsSource::hs', [IEnumerable_$type, null], 'LabelExtent:db:ht', [1, 10], 'LabelFormat:ef:hu', [2, null], 'LabelFormatSpecifiers:ag:hv', [Array_$type, null], 'LabelInnerColor:i0:hw', [Brush.$, null], 'LabelMemberPath:ej:hx', [2], 'LabelOuterColor:i1:hy', [Brush.$, null], 'LabelsPosition:az:hz', [LabelsPosition_$type, enumGetBox(LabelsPosition_$type, 1)], 'LeaderLineMargin:dc:h1', [1, 6], 'LeaderLineStyle:ja:h2', [Style.$, null], 'LeaderLineType:a0:h3', [LeaderLineType_$type, enumGetBox(LeaderLineType_$type, 0)], 'LeaderLineVisibility:je:h4', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'LegendEmptyValuesMode:a1:h5', [LegendEmptyValuesMode_$type, enumGetBox(LegendEmptyValuesMode_$type, 0)], 'LegendItemBadgeTemplate::h6', [DataTemplate.$, null], 'LegendItemTemplate::h7', [DataTemplate.$, null], 'LegendLabelFormat:ew:h8', [2, null], 'LegendLabelFormatSpecifiers:ah:h9', [Array_$type, null], 'LegendLabelMemberPath:ez:ia', [2], 'LegendOthersLabelFormat:e1:ib', [2, null], 'LegendOthersLabelFormatSpecifiers:ai:ic', [Array_$type, null], 'Legend::id', [IChartLegend_$type, null], 'OthersCategoryStyle:jb:ie', [Style.$, null], 'OthersCategoryText:e6:ig', [2, null], 'OthersCategoryThreshold:dd:ih', [1, 3], 'OthersCategoryType:a2:ii', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)], 'OthersLabelFormat:fa:ij', [2, null], 'OthersLabelFormatSpecifiers:aj:ik', [Array_$type, null], 'Outlines:an:il', [BrushCollection.$, null], 'RadiusFactor:dg:im', [1, 0.9], 'SelectedStyle:jc:ip', [Style.$, null], 'SelectionMode:bk:iq', [SliceSelectionMode_$type, enumGetBox(SliceSelectionMode_$type, 1)], 'ShouldDisplayMockData:ch:ir', [0, false], 'ShouldUseSkeletonStyleForMockData:ci:is', [0, false], 'StartAngle:di:it', [1, 0], 'SweepDirection:i3:iu', [SweepDirection_$type, enumGetBox(SweepDirection_$type, 1)], 'ToolTip:dr:iv', [4, null], 'ToolTipStyle:jd:iw', [Style.$, null], 'ValueMemberPath:fv:ix', [2, null]]);
return PieChartBase;
}(Control));
export { PieChartBase };
/**
* @hidden
*/
var PieChartSliceSelector = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieChartSliceSelector, _super);
function PieChartSliceSelector(a) {
var _this = _super.call(this) || this;
_this.a = null;
_this.a = a;
return _this;
}
PieChartSliceSelector.prototype.d = function (a) {
var b = a.dataContext;
if (this.a.bk == 1) {
if (a.isOthersSlice) {
var c = typeCast(IList_$type, b);
if (c != null && c.contains(this.a.selectedItem)) {
return true;
}
if (typeCast(PieSliceOthersContext.$, this.a.selectedItem) !== null) {
return true;
}
}
if (b == this.a.selectedItem) {
return true;
}
}
else if (this.a.bk == 2) {
if (this.c(a)) {
return true;
}
}
else if (this.a.bk == 0) {
if (this.a.selectedSlices.contains(a.a5)) {
return true;
}
}
return false;
};
PieChartSliceSelector.prototype.c = function (a) {
var e_16, _a;
var b = a.dataContext;
if (a.isOthersSlice) {
try {
for (var _b = __values(fromEn(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
if (this.a.selectedItems.contains1(c)) {
return true;
}
}
}
catch (e_16_1) {
e_16 = { error: e_16_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_16)
throw e_16.error;
}
}
}
else {
if (this.a.selectedItems.contains1(b)) {
return true;
}
}
return false;
};
PieChartSliceSelector.prototype.h = function (a) {
var b = a.dataContext;
if (!a.isOthersSlice) {
if (this.a.selectedItem != b) {
return b;
}
else {
return null;
}
}
else {
if (typeCast(PieSliceOthersContext.$, this.a.selectedItem) !== null) {
return null;
}
else {
return ((function () {
var $ret = new PieSliceOthersContext();
$ret.data = typeCast(IList_$type, a.dataContext);
$ret.slice = a;
return $ret;
})());
}
}
};
PieChartSliceSelector.prototype.f = function (a, b) {
var c = false;
if (b) {
if (this.a.selectedItems.contains1(a)) {
c = this.g(a);
}
}
else {
if (!this.a.selectedItems.contains1(a)) {
c = this.b(a);
}
else {
c = this.g(a);
}
}
return c;
};
PieChartSliceSelector.prototype.e = function (a) {
return this.f(a, false);
};
PieChartSliceSelector.prototype.g = function (a) {
var b = new SelectedItemsChangingEventArgs(this.a.selectedItems, new ObjectCollection(0), this.a.selectedItems);
this.a.gi(this, b);
if (!b.cancel) {
this.a.selectedItems.remove1(a);
}
return b.cancel;
};
PieChartSliceSelector.prototype.b = function (a) {
var b = new SelectedItemsChangingEventArgs(this.a.selectedItems, ((function () {
var $ret = new ObjectCollection(0);
$ret.add1(a);
return $ret;
})()), this.a.selectedItems);
this.a.gi(this, b);
if (!b.cancel) {
this.a.selectedItems.add1(a);
}
return b.cancel;
};
PieChartSliceSelector.prototype.k = function (a) {
this.a.selectedItem = this.h(a);
};
PieChartSliceSelector.prototype.i = function (a) {
var e_17, _a, e_18, _b;
var b = new List$1(Base.$, 1, this.a.selectedItems);
if (a.isOthersSlice) {
var c = typeCast(IList_$type, a.dataContext);
var d = 0;
try {
for (var _c = __values(fromEn(c)), _d = _c.next(); !_d.done; _d = _c.next()) {
var e = _d.value;
if (this.a.selectedItems.contains1(e)) {
d++;
}
}
}
catch (e_17_1) {
e_17 = { error: e_17_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _c.return))
_a.call(_c);
}
finally {
if (e_17)
throw e_17.error;
}
}
var f = d > 0 && d < c.count;
try {
for (var _e = __values(fromEn(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
var g = _f.value;
this.f(g, f);
}
}
catch (e_18_1) {
e_18 = { error: e_18_1 };
}
finally {
try {
if (_f && !_f.done && (_b = _e.return))
_b.call(_e);
}
finally {
if (e_18)
throw e_18.error;
}
}
if (this.c(a)) {
this.a.selectedItem = ((function () {
var $ret = new PieSliceOthersContext();
$ret.data = typeCast(IList_$type, a.dataContext);
$ret.slice = a;
return $ret;
})());
}
else {
this.a.selectedItem = this.a.selectedItems.count > 0 ? this.a.selectedItems._inner[this.a.selectedItems.count - 1] : null;
}
}
else {
this.e(a.dataContext);
this.a.selectedItem = this.a.selectedItems.count > 0 ? this.a.selectedItems._inner[this.a.selectedItems.count - 1] : null;
}
};
PieChartSliceSelector.prototype.j = function (a) {
if (a != null) {
a.av = true;
a.isSelected = this.d(a);
a.av = false;
}
};
PieChartSliceSelector.$t = markType(PieChartSliceSelector, 'PieChartSliceSelector');
return PieChartSliceSelector;
}(Base));
export { PieChartSliceSelector };
/**
* @hidden
*/
var PieSliceOthersContext = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieSliceOthersContext, _super);
function PieSliceOthersContext() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._data = null;
_this._slice = null;
return _this;
}
Object.defineProperty(PieSliceOthersContext.prototype, "data", {
get: function () {
return this._data;
},
set: function (a) {
this._data = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceOthersContext.prototype, "slice", {
get: function () {
return this._slice;
},
set: function (a) {
this._slice = a;
},
enumerable: false,
configurable: true
});
PieSliceOthersContext.$t = markType(PieSliceOthersContext, 'PieSliceOthersContext');
return PieSliceOthersContext;
}(Base));
export { PieSliceOthersContext };
/**
* @hidden
*/
var Slice = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(Slice, _super);
function Slice() {
var _this = _super.call(this) || this;
_this.al = null;
_this.b8 = null;
_this.ai = null;
_this.aj = null;
_this.bf = null;
_this.b9 = null;
_this.b3 = null;
_this.aq = false;
_this.au = false;
_this.av = false;
_this.an = false;
_this.cc = null;
_this.b0 = null;
_this.b1 = null;
var a = _this.ak();
_this.bl(a);
a.b();
_this.av = false;
return _this;
}
Slice.prototype.ak = function () {
return new SliceView(this);
};
Slice.prototype.bl = function (a) {
this.al = a;
};
Object.defineProperty(Slice.prototype, "isSelected", {
get: function () {
return this.c(Slice.bv);
},
set: function (a) {
this.h(Slice.bv, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(Slice.prototype, "isExploded", {
get: function () {
return this.c(Slice.bt);
},
set: function (a) {
this.h(Slice.bt, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(Slice.prototype, "isOthersSlice", {
get: function () {
return this.c(Slice.bu);
},
set: function (a) {
this.h(Slice.bu, a);
},
enumerable: false,
configurable: true
});
Object.defineProperty(Slice.prototype, "b2", {
get: function () {
return this.c(Slice.bp);
},
set: function (a) {
this.h(Slice.bp, a);
},
enumerable: false,
configurable: true
});
Slice.prototype.ac = function () {
_super.prototype.ac.call(this);
this.al.c();
};
Slice.prototype.az = function () {
var a = Math.abs(PieChartBase.dh(this.ax - this.a3)) == 360;
if (a) {
return this.a2;
}
return this.a2;
};
Slice.prototype.cb = function () {
var a = (this.ai != null && this.ai.b8) ? true : false;
var b = this.az();
if (this.isExploded && a && this.ai.dm > 1) {
var c = new Rect(0, this.b5.x - b, this.b5.y - b, b * 2, b * 2);
return c;
}
return new Rect(0, this.b7.x - b, this.b7.y - b, b * 2, b * 2);
};
Slice.prototype.b6 = function () {
if (this.isExploded && this.ai != null && this.ai.b8 && this.ai.dm > 1) {
if (this.aq) {
return this.b3;
}
return this.b5;
}
return this.b7;
};
Object.defineProperty(Slice.prototype, "aw", {
get: function () {
return this.an;
},
set: function (a) {
var b = this.an;
this.an = a;
if (b && !this.an) {
this.bk();
}
},
enumerable: false,
configurable: true
});
Slice.prototype.bk = function () {
var _this = this;
if (this.aw) {
return;
}
var a = this.al.f();
var b = this.ai.i9;
if (isNaN_(this.a3) || isNaN_(this.ax) || isNaN_(this.a2) || isNaN_(this.ay) || this.a5 < 0 || this.ai == null || b.width == 0 || b.height == 0 || (this.b7.x == 0 && this.b7.y == 0) || (this.b5.x == 0 && this.b5.y == 0) || this.a3 == this.ax) {
return;
}
this.b8 = this.cb();
var c = GeometryUtil.i(this.b8);
var d = this.b8.height / 2;
var e = this.az();
var f = RectUtil.l(this.b8);
var g = Slice.b4(MathUtil.o(this.a3), c, f, d, 100);
var h = Slice.b4(MathUtil.o(this.ax), c, f, d, 100);
var i = Slice.b4(MathUtil.o(this.ax), c, f, this.a2, this.a0);
var j = Slice.b4(MathUtil.o(this.a3), c, f, this.a2, this.a1);
var k = Math.abs(PieChartBase.dh(this.ax - this.a3)) == 360;
if (k) {
this.cc = this.b8;
if (this.a0 == 0) {
var l = ((function () {
var $ret = new EllipseGeometry();
$ret.e = f;
$ret.c = _this.a2;
$ret.d = _this.a2;
return $ret;
})());
a.an = l;
return;
}
else if (this.a0 > 0) {
var m_1 = new Size(1, this.a2, this.a2);
var n_1 = new Size(1, this.a2 * this.a0 / 100, this.a2 * this.a0 / 100);
var o_1 = ((function () {
var $ret = PointUtil.create();
$ret.x = f.x - _this.a2;
$ret.y = f.y;
return $ret;
})());
var p_1 = ((function () {
var $ret = PointUtil.create();
$ret.x = f.x + _this.a2;
$ret.y = f.y;
return $ret;
})());
var q_1 = ((function () {
var $ret = PointUtil.create();
$ret.x = f.x - _this.a2 * _this.a0 / 100;
$ret.y = f.y;
return $ret;
})());
var r_1 = ((function () {
var $ret = PointUtil.create();
$ret.x = f.x + _this.a2 * _this.a0 / 100;
$ret.y = f.y;
return $ret;
})());
var s_1 = ((function () {
var $ret = new PathFigure();
$ret.startPoint = o_1;
return $ret;
})());
var t = new PathSegmentCollection();
var u = ((function () {
var $ret = new ArcSegment();
$ret.f = m_1;
$ret.d = 1;
$ret.e = p_1;
return $ret;
})());
t.add(u);
s_1._segments = t;
var v_1 = ((function () {
var $ret = new PathFigure();
$ret.startPoint = r_1;
return $ret;
})());
var w = new PathSegmentCollection();
var x = ((function () {
var $ret = new ArcSegment();
$ret.f = n_1;
$ret.d = 0;
$ret.e = q_1;
return $ret;
})());
w.add(x);
v_1._segments = w;
var y_1 = ((function () {
var $ret = new PathFigure();
$ret.startPoint = o_1;
return $ret;
})());
var z = new PathSegmentCollection();
var aa = ((function () {
var $ret = new ArcSegment();
$ret.f = m_1;
$ret.d = 0;
$ret.e = p_1;
return $ret;
})());
z.add(aa);
y_1._segments = z;
var ab_1 = ((function () {
var $ret = new PathFigure();
$ret.startPoint = r_1;
return $ret;
})());
var ac = new PathSegmentCollection();
var ad = ((function () {
var $ret = new ArcSegment();
$ret.f = n_1;
$ret.d = 1;
$ret.e = q_1;
return $ret;
})());
ac.add(ad);
ab_1._segments = ac;
var ae_1 = ((function () {
var $ret = new PathFigureCollection();
$ret.add(s_1);
$ret.add(v_1);
$ret.add(y_1);
$ret.add(ab_1);
return $ret;
})());
var af = ((function () {
var $ret = new PathGeometry();
$ret.c = ae_1;
return $ret;
})());
var ag = new GeometryGroup();
ag.d.add(af);
a.an = ag;
return;
}
else {
var ah = ((function () {
var $ret = new GeometryGroup();
$ret.c = 0;
return $ret;
})());
ah.d.add(((function () {
var $ret = new EllipseGeometry();
$ret.e = f;
$ret.c = _this.a2;
$ret.d = _this.a2;
return $ret;
})()));
ah.d.add(((function () {
var $ret = new EllipseGeometry();
$ret.e = f;
$ret.c = _this.a2 * _this.a0 / 100;
$ret.d = _this.a2 * _this.a0 / 100;
return $ret;
})()));
a.an = ah;
return;
}
}
var ai = new PathGeometry();
a.an = ai;
var aj = ((function () {
var $ret = new PathFigure();
$ret.isClosed = true;
return $ret;
})());
ai.c = new PathFigureCollection();
ai.c.add(aj);
aj._startPoint = g;
var ak = Math.abs(this.ax - this.a3) > 180;
var al = new ArcSegment();
al.e = h;
al.f = new Size(1, this.b8.width / 2, this.b8.height / 2);
al.b = ak;
if (this.ax > this.a3) {
al.d = 1;
}
else {
al.d = 0;
}
aj._segments = new PathSegmentCollection();
aj._segments.add(al);
var am = new LineSegment(1);
am.c = i;
aj._segments.add(am);
var an = Math.sqrt(Math.pow(i.x - h.x, 2) + Math.pow(i.y - h.y, 2));
var ao = e - an;
var ap = new ArcSegment();
ap.e = j;
if (ao < 0) {
ao = 0.1;
}
ap.f = new Size(1, ao, ao);
ap.b = al.b;
ap.d = 0;
aj._segments.add(ap);
var aq = this.ca(a, g, h, this.a3, this.ax, f, e);
this.cc = aq;
var ar = true;
if (ar && this.b8.height > 0 && this.b8.width > 0 && !b.containsRect(aq)) {
var as = aq;
var at = new Rect(0, 0, 0, b.width, b.height);
at.intersect(as);
var au = GeometryUtil.n((this.a3 + this.ax) / 2);
var av = au / 180 * Math.PI;
var aw = Math.abs((as.height - at.height) / Math.sin(av));
var ax = Math.abs((as.width - at.width) / Math.cos(av));
if (isNaN_(aw) || isInfinity(aw)) {
aw = 0;
}
if (isNaN_(ax) || isInfinity(ax)) {
ax = 0;
}
var ay = Math.max(aw, ax);
var az = GeometryUtil.t(this.ai.i9.width, this.ai.i9.height, true, au, this.a2 * this.ai.c0 - ay);
this.al.d(az.x - this.b5.x, az.y - this.b5.y);
this.aq = true;
this.b3 = az;
this.b9 = new Rect(0, as.x - (az.x - this.b5.x), as.y - (az.y - this.b5.y), as.width, as.height);
}
else {
this.aq = false;
this.al.e();
}
};
Slice.prototype.ap = function (a) {
var b = this.ai.i9;
if (this._visibility == 1) {
return false;
}
if (isNaN_(this.a3) || isNaN_(this.ax) || isNaN_(this.a2) || isNaN_(this.ay) || this.a5 < 0 || this.ai == null || b.width == 0 || b.height == 0 || (this.b7.x == 0 && this.b7.y == 0) || (this.b5.x == 0 && this.b5.y == 0)) {
return false;
}
var c = this.az();
var d = ((this.a0 / 100) * c);
var e = c;
var f = this.b7;
if (this.isExploded && this.ai.b8 && this.ai.dm > 1) {
f = this.b5;
if (this.aq) {
f = this.b3;
}
}
var g = d * d;
var h = e * e;
var i = Math.pow(a.x - f.x, 2) + Math.pow(a.y - f.y, 2);
if (i < g || i > h) {
return false;
}
var j = Math.atan2(a.y - f.y, a.x - f.x);
j = j * 180 / Math.PI;
return this.ao(j);
};
Slice.prototype.ao = function (a) {
a = GeometryUtil.n(a);
var b = Math.min(this.a3, this.ax);
var c = Math.max(this.a3, this.ax);
return (a > b && a < c) || (a - 360 > b && a - 360 < c) || (a + 360 > b && a + 360 < c);
};
Slice.prototype.ca = function (a, b, c, d, e, f, g) {
var e_19, _a;
var h = new List$1(Point_$type, 0);
h.add(b);
h.add(c);
h.add(f);
d = GeometryUtil.n(d);
e = GeometryUtil.n(e);
if ((0 > d && 0 < e) || (360 > d && 360 < e) || (e < d)) {
h.add(GeometryUtil.u(f, 0, g));
}
if (90 > d && 90 < e) {
h.add(GeometryUtil.u(f, 90, g));
}
if (180 > d && 180 < e) {
h.add(GeometryUtil.u(f, 180, g));
}
if (270 > d && 270 < e) {
h.add(GeometryUtil.u(f, 270, g));
}
var i = 1.7976931348623157E+308;
var j = 1.7976931348623157E+308;
var k = -1.7976931348623157E+308;
var l = -1.7976931348623157E+308;
try {
for (var _b = __values(fromEnum(h)), _c = _b.next(); !_c.done; _c = _b.next()) {
var m = _c.value;
i = Math.min(i, m.x);
j = Math.min(j, m.y);
k = Math.max(k, m.x);
l = Math.max(l, m.y);
}
}
catch (e_19_1) {
e_19 = { error: e_19_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_19)
throw e_19.error;
}
}
return new Rect(0, i, j, k - i, l - j);
};
Slice.prototype.am = function () {
var a = new PieSliceVisualData();
a.appearance = new PrimitiveAppearanceData();
a.labelAppearance = new LabelAppearanceData();
a.leaderLineAppearance = new PrimitiveAppearanceData();
a.startAngle = this.a3;
a.endAngle = this.ax;
a.explodedOrigin = PointData.b(this.b5);
a.explodedRadius = this.ay;
a.origin = PointData.b(this.b7);
a.radius = this.az();
a.index = this.a5;
a.innerExtentEnd = this.a0;
a.innerExtentStart = this.a1;
a.isExploded = this.isExploded;
a.isOthersSlice = this.isOthersSlice;
a.isSelected = this.isSelected;
if (this.aj != null) {
a.labelAppearance.angle = this.aj.ai;
a.labelBounds = RectData.b(this.aj.ao);
a.labelAngle = this.aj.ai;
if (typeCast(TextBlock.$, this.aj.aj) !== null) {
var b = typeCast(TextBlock.$, this.aj.aj);
a.label = b.al;
var c = null;
a.labelAppearance.labelBrush = AppearanceHelper.b(b.ao);
a.labelAppearance.text = b.al;
if (this.ai != null) {
c = this.ai.bn();
if (c == null) {
c = this.ai.a4.b.c;
}
}
a.labelAppearance = AppearanceHelper.c(b, c);
a.labelAppearance.visibility = this.aj._visibility == 0;
}
else {
a.label = this.aj.aj.toString();
}
if (this.aj.ap != null) {
a.leaderLineAppearance.fill = AppearanceHelper.b(this.aj.ap._fill);
a.leaderLineAppearance.opacity = this.aj.ap._opacity;
a.leaderLineAppearance.stroke = AppearanceHelper.b(this.aj.ap._stroke);
a.leaderLineAppearance.strokeThickness = this.aj.ap.ad;
a.leaderLineAppearance.isVisible = this.aj.ap._visibility == 0;
a.leaderLinePath = new PathVisualData(2, "leaderLine", this.aj.ap);
}
else if (this.aj.aq != null) {
a.leaderLineAppearance.fill = AppearanceHelper.b(this.aj.aq._fill);
a.leaderLineAppearance.opacity = this.aj.aq._opacity;
a.leaderLineAppearance.stroke = AppearanceHelper.b(this.aj.aq._stroke);
a.leaderLineAppearance.strokeThickness = this.aj.aq.ad;
a.leaderLineAppearance.isVisible = this.aj.aq._visibility == 0;
a.leaderLinePath = new PathVisualData(1, "leaderLine", this.aj.aq);
}
}
if (this.al != null) {
var d = this.al.f();
a.slicePath = new PathVisualData(1, "slicePath", d);
a.appearance.fill = AppearanceHelper.b(d._fill);
a.appearance.opacity = d._opacity;
a.appearance.stroke = AppearanceHelper.b(d._stroke);
a.appearance.strokeThickness = d.ad;
a.appearance.isVisible = d._visibility == 0;
}
return a;
};
Slice.b4 = function (a, b, c, d, e) {
if (d == 0) {
return c;
}
var f = Math.cos(a);
var g = Math.sin(a);
var h = Math.sqrt(d * d / (1 - (b * Math.pow(f, 2))));
h *= (e / 100);
return { $type: Point_$type, x: h * f + c.x, y: h * g + c.y };
};
Slice.$t = markType(Slice, 'Slice', ContentControl.$);
Slice.bv = DependencyProperty.i("IsSelected", Boolean_$type, Slice.$, new PropertyMetadata(2, false, function (a, b) {
var c = typeCast(Slice.$, a);
if (!c.av) {
var d = b.newValue;
if (c.ai != null) {
c.ai.g2(c, d);
}
}
}));
Slice.bt = DependencyProperty.i("IsExploded", Boolean_$type, Slice.$, new PropertyMetadata(2, false, function (a, b) {
var c = typeCast(Slice.$, a);
var d = b.newValue;
if (c.ai != null) {
c.ai.fz(c, d);
}
}));
Slice.bu = DependencyProperty.i("IsOtherSlice", Boolean_$type, Slice.$, new PropertyMetadata(2, false, function (a, b) { return a.bk(); }));
Slice.bp = DependencyProperty.i("Foreground", Brush.$, Slice.$, new PropertyMetadata(1, null));
Slice.$$p = markDep(DependencyProperty, PropertyMetadata, Slice, 'bk', ['EndAngle:ax:bm', [1, 0], 'ExplodedOrigin:b5:bn', [Point_$type, PointUtil.create()], 'ExplodedRadius:ay:bo', [1, 0], 'Index:a5:bq', [1, -1], 'InnerExtentEnd:a0:br', [1, 0], 'InnerExtentStart:a1:bs', [1, 0], 'Origin:b7:bw', [Point_$type, PointUtil.create()], 'Radius:a2:bx', [1, 0], 'StartAngle:a3:by', [1, 0], 'StrokeThickness:a4:bz', [1, 1]]);
return Slice;
}(ContentControl));
export { Slice };
/**
* @hidden
*/
var PieChartBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieChartBaseView, _super);
function PieChartBaseView(a) {
var _this = _super.call(this) || this;
_this.a = null;
_this.bt = null;
_this.b = null;
_this.h = null;
_this.j = null;
_this.i = null;
_this.k = null;
_this.c = null;
_this.b4 = null;
_this.l = false;
_this.b1 = Rect.empty;
_this.by = { $type: Point_$type, x: NaN, y: NaN };
_this.m = false;
_this.f = null;
_this.v = null;
_this.u = null;
_this.w = 0;
_this.b0 = null;
_this.ah = null;
_this.t = false;
_this.e = null;
_this.a = a;
_this.c = new PieChartViewManager(_this);
return _this;
}
PieChartBaseView.prototype.a2 = function () {
this.e = new PieSliceDataContext();
this.e.series = this.a;
this.b4 = Rect.empty;
this.v = new List$1(Slice.$, 0);
this.u = new List$1(PieLabel.$, 0);
this.a.legendItemTemplate = ((function () {
var $ret = new DataTemplate();
$ret.render = PieLegendTemplates.h;
$ret.measure = PieLegendTemplates.c;
return $ret;
})());
this.a.legendItemBadgeTemplate = ((function () {
var $ret = new DataTemplate();
$ret.render = PieLegendTemplates.g;
$ret.measure = PieLegendTemplates.f;
return $ret;
})());
this.c.ab();
};
PieChartBaseView.prototype.bc = function () {
var a = this.c.b();
if (this.a.am == null) {
this.a.am = a.a;
}
if (this.a.an == null) {
this.a.an = a.b;
}
if (this.a.jc == null) {
this.a.jc = ((function () {
var $ret = new Style();
$ret.fill = a.h != null ? a.h.color.colorString : null;
$ret.stroke = a.i != null ? a.i.color.colorString : null;
$ret.strokeThickness = a.e;
$ret.opacity = a.d;
return $ret;
})());
}
this.b = a;
if (this.a.fq != null) {
this.b.c = this.a.bn();
}
};
PieChartBaseView.prototype.ay = function () {
this.c.ad();
};
PieChartBaseView.prototype.a1 = function () {
this.c.ag();
};
PieChartBaseView.prototype.az = function (a) {
if (a == null) {
this.l = false;
this.c.ae(null);
this.h = null;
this.j = null;
this.i = null;
this.k = null;
return;
}
this.c.ae(a);
this.h = this.c.e;
this.j = this.c.g;
this.i = this.c.f;
this.k = this.c.h;
};
PieChartBaseView.prototype.b2 = function () {
return this.b4;
};
PieChartBaseView.prototype.bz = function () {
return this.c.aq();
};
PieChartBaseView.prototype.bb = function () {
this.b4 = this.c.ar();
this.a.gj();
};
PieChartBaseView.prototype.aw = function () {
if (!this.l) {
this.l = true;
this.c.aj(runOn(this, this.bj));
}
};
PieChartBaseView.prototype.bj = function () {
if (this.l) {
this.l = false;
this.a6();
}
};
PieChartBaseView.prototype.a6 = function () {
this.an();
this.c.y(this.b4.width, this.b4.height);
var a = this.k == this.j;
if (this.k != null && this.k.d && !a) {
if (this.a.c2 != 1) {
this.k.aa();
this.k.ab(this.a.c2, this.a.c2);
}
if (!this.b1.isEmpty) {
if (!this.k.e) {
this.k.l(this.b1.left, this.b1.top, this.b1.width, this.b1.height);
}
}
}
if (this.i != null && this.i.d && !a) {
if (this.a.c2 != 1) {
this.i.aa();
this.i.ab(this.a.c2, this.a.c2);
}
if (!this.b1.isEmpty) {
if (!this.i.e) {
this.i.l(this.b1.left, this.b1.top, this.b1.width, this.b1.height);
}
}
}
if (this.j != null && this.j.d) {
if (this.a.c2 != 1) {
this.j.aa();
this.j.ab(this.a.c2, this.a.c2);
}
if (!this.b1.isEmpty) {
if (!this.j.e) {
this.j.l(this.b1.left, this.b1.top, this.b1.width, this.b1.height);
}
}
}
if (this.h != null && this.h.d && !a) {
if (this.a.c2 != 1) {
this.h.aa();
this.h.ab(this.a.c2, this.a.c2);
}
if (!this.b1.isEmpty) {
if (!this.h.e) {
this.h.l(this.b1.left, this.b1.top, this.b1.width, this.b1.height);
}
}
}
this.a7();
if (!this.b1.isEmpty && this.a.c2 != 1) {
if (this.k != null && this.k.d && !a) {
this.k.z();
}
if (this.i != null && this.i.d && !a) {
this.i.z();
}
if (this.j != null && this.j.d) {
this.j.z();
}
if (this.h != null && this.h.d && !a) {
this.h.z();
}
}
};
PieChartBaseView.prototype.a7 = function () {
var e_20, _a;
this.b1 = this.b4;
if (this.j != null && this.j.d) {
this.ba();
this.a8();
}
if (this.i != null && this.i.d) {
var a = this.b.c;
if (this.a.fq != null) {
a = this.a.bn();
}
this.i.ad(a);
try {
for (var _b = __values(fromEnum(this.u)), _c = _b.next(); !_c.done; _c = _b.next()) {
var b = _c.value;
if (b._visibility == 0) {
var c = b.aj;
if (c != null) {
{
if (b.ah.b2 == null) {
if (b.ah.au) {
c.ao = this.b.f;
}
else {
c.ao = this.b.g;
}
}
else {
c.ao = b.ah.b2;
}
this.i.x(c);
}
}
var d = b.ah.b0;
if (b.ah.y != null) {
var e = new Path();
this.j.j(e, b.ah.y);
if (e._fill != null) {
d = e._fill;
}
}
if (this.a.a0 != 0 && b.aq != null) {
b.aq._stroke = d;
b.aq.ad = 1;
if (this.a.ja != null) {
this.i.j(b.aq, this.a.ja);
}
this.i.t(b.aq);
}
if (this.a.a0 == 0 && b.ap != null) {
b.ap._stroke = d;
b.ap.ad = 1;
if (this.a.ja != null) {
this.i.j(b.ap, this.a.ja);
}
this.i.s(b.ap);
}
}
}
}
catch (e_20_1) {
e_20 = { error: e_20_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_20)
throw e_20.error;
}
}
}
};
PieChartBaseView.prototype.a9 = function (a) {
if (a._visibility != 0) {
return;
}
var b = a.al.f();
this.c.al(b);
b.ad = 1;
b._opacity = a._opacity;
if (a.b0 != null) {
b._fill = a.b0;
}
if (a.b1 != null) {
b._stroke = a.b1;
}
if (a.y != null) {
this.j.j(b, a.y);
}
if (b.j != null) {
this.j.aa();
this.j.k(b.j);
}
var c = b._fill;
var d = b._stroke;
var e = this.n(a, b, this.j);
this.j.t(b);
if (e) {
b._fill = c;
b._stroke = d;
}
if (b.j != null) {
this.j.z();
}
};
PieChartBaseView.prototype.ba = function () {
var e_21, _a;
try {
for (var _b = __values(fromEnum(this.v)), _c = _b.next(); !_c.done; _c = _b.next()) {
var a = _c.value;
if (!a.isSelected) {
this.a9(a);
}
}
}
catch (e_21_1) {
e_21 = { error: e_21_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_21)
throw e_21.error;
}
}
};
PieChartBaseView.prototype.a8 = function () {
var e_22, _a;
try {
for (var _b = __values(fromEnum(this.v)), _c = _b.next(); !_c.done; _c = _b.next()) {
var a = _c.value;
if (a.isSelected) {
this.a9(a);
}
}
}
catch (e_22_1) {
e_22 = { error: e_22_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_22)
throw e_22.error;
}
}
};
PieChartBaseView.prototype.n = function (a, b, c) {
return false;
};
PieChartBaseView.prototype.ak = function (a, b, c) {
if (!isNaN_(this.by.x) && !isNaN_(this.by.y)) {
if (Math.abs(a.x - this.by.x) > 10 || Math.abs(a.y - this.by.y) > 10) {
this.m = true;
}
}
var d = this.f;
this.bk(a);
if (this.f == null && d != null) {
var e = ((function () {
var $ret = new MouseEventArgs();
$ret.position = a;
return $ret;
})());
this.a.f2(this.f, e);
}
else if (this.f != null) {
var f = ((function () {
var $ret = new MouseEventArgs();
$ret.position = a;
return $ret;
})());
this.a.f3(this.f, f);
}
};
PieChartBaseView.prototype.aj = function (a) {
var b = this.f;
this.bk(a);
var c = ((function () {
var $ret = new MouseEventArgs();
$ret.position = a;
return $ret;
})());
this.a.f2(b, c);
};
PieChartBaseView.prototype.ai = function (a) {
this.m = false;
this.by = { $type: Point_$type, x: a.x, y: a.y };
this.bk(a);
};
PieChartBaseView.prototype.al = function (a) {
if (!this.a.ce || !this.m) {
this.aq(a);
}
if (this.a.ce && this.m) {
var b = this.f;
this.f = null;
var c = ((function () {
var $ret = new MouseEventArgs();
$ret.position = a;
return $ret;
})());
this.a.f2(b, c);
}
this.m = false;
this.by = { $type: Point_$type, x: NaN, y: NaN };
};
PieChartBaseView.prototype.aq = function (a) {
var e_23, _a;
var b = ((function () {
var $ret = new MouseButtonEventArgs();
$ret.position = a;
return $ret;
})());
var c = true;
var d = null;
try {
for (var _b = __values(fromEnum(this.u)), _c = _b.next(); !_c.done; _c = _b.next()) {
var e = _c.value;
var f = e.ao.containsPoint(a);
if (f) {
d = e;
c = this.a.cg(e.ah, b);
break;
}
}
}
catch (e_23_1) {
e_23 = { error: e_23_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_23)
throw e_23.error;
}
}
this.bk(a);
if (this.f == null && c && d != null) {
this.a.g6(d.ah, b);
}
else if (this.f != null && c) {
this.a.g6(this.f, b);
}
};
PieChartBaseView.prototype.bk = function (a) {
this.f = null;
for (var b = 0; b < this.v.count; b++) {
if (this.v._inner[b]._visibility == 0 && this.v._inner[b].ap(a)) {
this.f = this.v._inner[b];
break;
}
}
};
PieChartBaseView.prototype.o = function (a) {
var e_24, _a;
try {
for (var _b = __values(fromEnum(this.u)), _c = _b.next(); !_c.done; _c = _b.next()) {
var b = _c.value;
var c = b.ao.containsPoint(a);
if (c) {
return true;
}
}
}
catch (e_24_1) {
e_24 = { error: e_24_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_24)
throw e_24.error;
}
}
return false;
};
PieChartBaseView.prototype.q = function (a) {
for (var b = 0; b < this.v.count; b++) {
if (this.v._inner[b]._visibility == 0 && this.v._inner[b].ap(a)) {
return true;
}
}
return false;
};
PieChartBaseView.prototype.p = function (a) {
return this.o(a) || this.q(a);
};
PieChartBaseView.prototype.be = function () {
this.a.gj();
};
PieChartBaseView.prototype.am = function () {
this.ar();
};
PieChartBaseView.prototype.bo = function (a, b) {
var c = b;
this.bp(c.position, a, b);
};
PieChartBaseView.prototype.g = function () {
var a = new Slice();
a.ai = this.a;
this.v.add(a);
return a;
};
PieChartBaseView.prototype.bf = function (a) {
a._visibility = 0;
};
PieChartBaseView.prototype.bh = function (a) {
a._visibility = 1;
};
PieChartBaseView.prototype.bg = function (a) {
a.ai = null;
this.v.remove(a);
};
PieChartBaseView.prototype.d = function () {
var a = new PieLabel();
if (this.a.a0 == 0) {
a.ap = new Line();
}
else {
a.aq = new Path();
var b = new PathGeometry();
b.c.add(new PathFigure());
b.c._inner[0]._segments.add(new BezierSegment(0));
a.aq.an = b;
}
this.u.add(a);
return a;
};
PieChartBaseView.prototype.as = function (a) {
a._visibility = 0;
};
PieChartBaseView.prototype.au = function (a) {
a._visibility = 1;
};
PieChartBaseView.prototype.at = function (a) {
this.u.remove(a);
};
PieChartBaseView.prototype.bm = function (a) {
if ((this.a.a0 != 0 && a.aq != null) || (this.a.a0 == 0 && a.ap != null)) {
return;
}
if (this.a.a0 == 0) {
a.aq = null;
a.ap = new Line();
}
else {
a.ap = null;
a.aq = new Path();
var b = new PathGeometry();
var c = new PathFigure();
c._startPoint = { $type: Point_$type, x: NaN, y: NaN };
b.c.add(c);
b.c._inner[0]._segments.add(new BezierSegment(0));
a.aq.an = b;
}
};
PieChartBaseView.prototype.bd = function (a) {
if (this.a.jb != null && a.isOthersSlice) {
a.b0 = this.bw(a.a5);
a.b1 = this.bx(a.a5);
a.y = this.a.jb;
}
else if (a.isSelected && this.a.b9 && this.a.jc != null) {
a.y = this.a.jc;
}
else {
a.y = null;
a.b0 = this.bw(a.a5);
a.b1 = this.bx(a.a5);
}
};
PieChartBaseView.prototype.bw = function (a) {
if (this.a.ak != null && a >= 0 && this.a.ak.count > 0) {
return this.a.ak.item(a % this.a.ak.count);
}
return null;
};
PieChartBaseView.prototype.bx = function (a) {
if (this.a.al != null && a >= 0 && this.a.al.count > 0) {
return this.a.al.item(a % this.a.al.count);
}
return null;
};
PieChartBaseView.prototype.ae = function (a) {
if (a == null || a.aj == null) {
return this.a.ej;
}
var b = a.aj;
var c = b.aj;
if (typeCast(TextBlock.$, c) !== null) {
return c.al;
}
return c;
};
PieChartBaseView.prototype.z = function (a) {
var b = typeCast(TextBlock.$, a);
if (b != null && b.al != null && this.i != null) {
return this.i.f(b) + 0;
}
return 0;
};
PieChartBaseView.prototype.bl = function () {
this.w = FontUtil.getCurrentFontHeight(this.c.n, this.c.d());
};
PieChartBaseView.prototype.y = function (a) {
return this.w + 0;
};
PieChartBaseView.prototype.b3 = function (a) {
var b = a.aj;
if (typeCast(TextBlock.$, b) !== null) {
var c = this.z(b);
var d = this.y(b);
return new Rect(0, 0, 0, c, d);
}
return Rect.empty;
};
PieChartBaseView.prototype.b5 = function () {
return new Size(1, this.b4.width, this.b4.height);
};
PieChartBaseView.prototype.bn = function (a, b, c) {
var d = typeCast(TextBlock.$, a.aj);
if (d != null) {
d.n = b;
d.o = c;
}
this.aw();
};
PieChartBaseView.prototype.bq = function (a) {
this.br(a);
};
PieChartBaseView.prototype.bs = function () {
this.aw();
};
PieChartBaseView.prototype.av = function () {
this.an();
};
PieChartBaseView.prototype.an = function () {
var a = this.b.c;
if (this.a.fq != null) {
a = this.a.bn();
}
if (this.i != null) {
this.i.ad(a);
}
};
PieChartBaseView.prototype.a0 = function (a, b) {
this.c.af(a, b);
};
PieChartBaseView.prototype.ax = function () {
this.c.ac();
};
Object.defineProperty(PieChartBaseView.prototype, "ag", {
get: function () {
return this.c != null && this.c.n != null ? this.c.n.getResourceString("invalidLabelBinding") : "There is no such value for the labels to bind.";
},
enumerable: false,
configurable: true
});
PieChartBaseView.prototype.ar = function () {
if (this.t == true) {
this.t = false;
this.c.aa(this.e);
}
};
PieChartBaseView.prototype.br = function (a) {
this.c.an(a);
};
PieChartBaseView.prototype.bp = function (a, b, c) {
this.t = true;
this.b0 = a;
if (b == null) {
this.ah = null;
this.e.item = null;
}
else {
this.ah = b.dataContext;
this.e.item = b.dataContext;
this.e.slice = b;
}
var d = this.a.i6();
var pos_ = { $type: Point_$type, x: a.x + 15 + d.x, y: a.y + 15 + d.y };
var context_ = this.e;
this.c.am(pos_, context_);
};
PieChartBaseView.prototype.bi = function () {
this.bc();
this.bl();
this.a.gw();
};
PieChartBaseView.prototype.a3 = function () {
this.c.ah(this.a.cf);
};
PieChartBaseView.prototype.ad = function () {
return this.c.v();
};
PieChartBaseView.prototype.ap = function () {
if (this.l) {
this.bj();
}
};
PieChartBaseView.prototype.s = function () {
return this.ad() != null;
};
PieChartBaseView.prototype.ao = function (a) {
this.c.z(a);
};
PieChartBaseView.prototype.r = function () {
return true;
};
PieChartBaseView.prototype.a5 = function () {
};
PieChartBaseView.prototype.bu = function (a) {
var b = this.c.ao(a.y);
if (b != null) {
return b;
}
return a.b0;
};
PieChartBaseView.prototype.bv = function (a) {
var b = this.c.ap(a.y);
if (b != null) {
return b;
}
return a.b1;
};
PieChartBaseView.prototype.x = function (a) {
return this.c.m(a.y);
};
PieChartBaseView.prototype.aa = function (a) {
return this.c.m(a);
};
PieChartBaseView.prototype.ab = function () {
var e_25, _a;
try {
for (var _b = __values(fromEnum(this.v)), _c = _b.next(); !_c.done; _c = _b.next()) {
var a = _c.value;
if (!a.isSelected) {
return a.a4;
}
}
}
catch (e_25_1) {
e_25 = { error: e_25_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_25)
throw e_25.error;
}
}
return NaN;
};
PieChartBaseView.prototype.a4 = function () {
this.c.ai();
this.aw();
};
PieChartBaseView.prototype.af = function (a) {
return this.c.c.as;
};
PieChartBaseView.$t = markType(PieChartBaseView, 'PieChartBaseView');
return PieChartBaseView;
}(Base));
export { PieChartBaseView };
/**
* @hidden
*/
var PieSliceDataContext = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieSliceDataContext, _super);
function PieSliceDataContext() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._slice = null;
_this._percentValue = 0;
_this._isOthersSlice = false;
return _this;
}
Object.defineProperty(PieSliceDataContext.prototype, "slice", {
get: function () {
return this._slice;
},
set: function (a) {
this._slice = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceDataContext.prototype, "percentValue", {
get: function () {
return this._percentValue;
},
set: function (a) {
this._percentValue = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceDataContext.prototype, "isOthersSlice", {
get: function () {
return this._isOthersSlice;
},
set: function (a) {
this._isOthersSlice = a;
},
enumerable: false,
configurable: true
});
PieSliceDataContext.prototype.flatten = function () {
var e_26, _a;
var ret_ = _super.prototype.flatten.call(this);
var percentValue_ = this.percentValue;
var isOthersSlice_ = this.isOthersSlice;
ret_.percentValue = percentValue_;
ret_.isOthersSlice = isOthersSlice_;
if (isOthersSlice_ && this.item != null) {
var items_ = [];
try {
for (var _b = __values(fromEn(this.item)), _c = _b.next(); !_c.done; _c = _b.next()) {
var currItem_ = _c.value;
items_.push(currItem_);
}
}
catch (e_26_1) {
e_26 = { error: e_26_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_26)
throw e_26.error;
}
}
ret_.item = items_;
}
return ret_;
};
PieSliceDataContext.$t = markType(PieSliceDataContext, 'PieSliceDataContext', DataContext.$);
return PieSliceDataContext;
}(DataContext));
export { PieSliceDataContext };
/**
* @hidden
*/
var SliceView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SliceView, _super);
function SliceView(a) {
var _this = _super.call(this) || this;
_this.a = null;
_this.g = null;
_this.a = a;
return _this;
}
SliceView.prototype.b = function () {
this.g = new Path();
this.a.content = this.g;
};
SliceView.prototype.c = function () {
this.a.bk();
};
SliceView.prototype.f = function () {
return this.g;
};
SliceView.prototype.d = function (a, b) {
this.g.j = ((function () {
var $ret = new TranslateTransform();
$ret.j = a;
$ret.k = b;
return $ret;
})());
};
SliceView.prototype.e = function () {
this.g.j = null;
};
SliceView.$t = markType(SliceView, 'SliceView');
return SliceView;
}(Base));
export { SliceView };