igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,445 lines (1,444 loc) • 144 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 { 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
*/
export let PieChartViewManager = /*@__PURE__*/ (() => {
class PieChartViewManager extends Base {
constructor(a) {
super();
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;
}
ac() {
let a = this.n.rootWrapper.width();
let b = this.n.rootWrapper.height();
this.af(a, b);
}
af(a, b) {
this.ab();
this.c.bl = new Rect(0, 0, 0, a, b);
let 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();
}
ag() {
if (this.c != null) {
this.c.bh(this.s, "");
}
}
ad() {
this.ab();
if (this.c != null) {
this.c.at(this.s, "");
}
}
ab() {
let a = this.a.a.df;
let b = this.a.a.c2;
if (!isNaN_(a) && a != 0) {
return;
}
if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
this.a.a.c2 = window.devicePixelRatio;
}
}
y(a, b) {
let c = this.k;
let d = this.j;
let e = this.l;
if (e != 1) {
c = Math.round(a * e);
d = Math.round(b * e);
}
let 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);
}
}
ar() {
this.as = new Rect(0, 0, 0, this.k, this.j);
return this.as;
}
ak(a) {
let b = this.k;
let c = this.j;
let 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));
}
}
d() {
return this.a.b.c;
}
aq() {
let a = DOMEventProxy.c4(this.n.rootWrapper);
return { $type: Point_$type, x: a.left, y: a.top };
}
aj(a) {
if (this.n != null) {
this.n.setTimeout(a, 0);
}
else {
window.setTimeout(a, 0);
}
}
b() {
let a = new PieChartStyleInfo();
let b;
let c;
let 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 = ((() => {
let $ret = new Brush();
$ret.fill = this.n.getCssDefaultPropertyValue("ui-chart-innerlabels", "color");
return $ret;
})());
a.g = ((() => {
let $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 = ((() => {
let $ret = new Brush();
$ret.fill = "#00000033";
return $ret;
})());
a.d = 1;
return a;
}
al(a) {
a._stroke = ((() => {
let $ret = new Brush();
$ret.fill = "#000000";
return $ret;
})());
a._fill = ((() => {
let $ret = new Brush();
$ret.fill = "#222222";
return $ret;
})());
}
ae(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;
}
let 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);
let c = this.c;
c.onMouseOver = delegateCombine(c.onMouseOver, runOn(this.a, this.a.ak));
let d = this.c;
d.onMouseLeave = delegateCombine(d.onMouseLeave, runOn(this.a, this.a.aj));
let e = this.c;
e.onMouseDown = delegateCombine(e.onMouseDown, runOn(this.a, this.a.ai));
let 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());
}
x(a) {
this.n.append(a);
}
ah(a) {
if (this.c == null) {
return;
}
this.c.ae = a;
}
v() {
return this.n;
}
z(a) {
a.width = this.k;
a.height = this.j;
}
an(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");
}
}
}
am(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);
}
}
aa(a) {
if (this._toolTipObject != null) {
let context_ = a;
if (this._toolTipObject.hideToolTip) {
this._toolTipObject.hideToolTip(context_);
}
;
}
}
ao(style_) {
let a = null;
let fillColor_ = null;
if (style_ != null) {
if (style_.fill) {
fillColor_ = style_.fill;
}
;
if (fillColor_ != null) {
a = Brush.create(fillColor_);
}
}
return a;
}
ap(style_) {
let a = null;
let outlineColor_ = null;
if (style_ != null) {
if (style_.stroke) {
outlineColor_ = style_.stroke;
}
;
if (outlineColor_ != null) {
a = Brush.create(outlineColor_);
}
}
return a;
}
m(style_) {
let actualOutlineThickness_ = NaN;
if (style_ != null) {
if (style_.strokeThickness) {
actualOutlineThickness_ = style_.strokeThickness;
}
;
}
return actualOutlineThickness_;
}
ai() {
}
}
PieChartViewManager.$t = markType(PieChartViewManager, 'PieChartViewManager');
return PieChartViewManager;
})();
/**
* @hidden
*/
export let LabelClickEventArgs = /*@__PURE__*/ (() => {
class LabelClickEventArgs extends EventArgs {
constructor(a, b) {
super();
this._slice = null;
this.c = true;
this.slice = a;
}
get slice() {
return this._slice;
}
set slice(a) {
this._slice = a;
}
get item() {
if (this.slice != null) {
return this.slice.dataContext;
}
else {
return null;
}
}
get allowSliceClick() {
return this.c;
}
set allowSliceClick(a) {
this.c = a;
}
}
LabelClickEventArgs.$t = markType(LabelClickEventArgs, 'LabelClickEventArgs', EventArgs.$);
return LabelClickEventArgs;
})();
/**
* @hidden
*/
export let SliceClickEventArgs = /*@__PURE__*/ (() => {
class SliceClickEventArgs extends EventArgs {
constructor(a, b) {
super();
this._slice = null;
this.d = false;
this.c = false;
this._originalEvent = null;
this.slice = a;
this.originalEvent = b;
if (a == null) {
return;
}
this.d = a.isSelected;
this.c = a.isExploded;
}
get slice() {
return this._slice;
}
set slice(a) {
this._slice = a;
}
get isSelected() {
return this.d;
}
set isSelected(a) {
this.d = a;
this.slice.ai.g2(this.slice, a);
}
get isExploded() {
return this.c;
}
set isExploded(a) {
this.c = a;
this.slice.isExploded = a;
}
get isOthersSlice() {
return this.slice.isOthersSlice;
}
get index() {
return this.slice.a5;
}
get dataContext() {
if (this.slice != null) {
return this.slice.dataContext;
}
return null;
}
get originalEvent() {
return this._originalEvent;
}
set originalEvent(a) {
this._originalEvent = a;
}
get origin() {
return this.slice.isExploded ? this.slice.b3 : this.slice.b7;
}
get radius() {
return this.slice.isExploded ? this.slice.ay : this.slice.a2;
}
get bounds() {
return this.slice.isExploded ? this.slice.b9 : this.slice.cc;
}
get startAngle() {
return this.slice.a3;
}
get endAngle() {
return this.slice.ax;
}
get fill() {
return this.slice.b0;
}
get outline() {
return this.slice.b1;
}
}
SliceClickEventArgs.$t = markType(SliceClickEventArgs, 'SliceClickEventArgs', EventArgs.$);
return SliceClickEventArgs;
})();
/**
* @hidden
*/
export let SliceEventArgs = /*@__PURE__*/ (() => {
class SliceEventArgs extends EventArgs {
constructor(a, b) {
super();
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.d = a.isSelected;
this.c = a.isExploded;
}
get slice() {
return this._slice;
}
set slice(a) {
this._slice = a;
}
get isSelected() {
return this.d;
}
set isSelected(a) {
this.d = a;
this.slice.ai.g2(this.slice, a);
}
get isExploded() {
return this.c;
}
set isExploded(a) {
this.c = a;
this.slice.isExploded = a;
}
get isOthersSlice() {
return this.slice.isOthersSlice;
}
get index() {
return this.slice.a5;
}
get origin() {
return this.slice.isExploded ? this.slice.b3 : this.slice.b7;
}
get radius() {
return this.slice.isExploded ? this.slice.ay : this.slice.a2;
}
get bounds() {
return this.slice.isExploded ? this.slice.b9 : this.slice.cc;
}
get startAngle() {
return this.slice.a3;
}
get endAngle() {
return this.slice.ax;
}
get fill() {
return this.slice.b0;
}
get outline() {
return this.slice.b1;
}
get dataContext() {
if (this.slice != null) {
if (this.slice.isOthersSlice) {
return this.slice.dataContext.toArray();
}
return this.slice.dataContext;
}
return null;
}
get position() {
return this._position;
}
set position(a) {
this._position = a;
}
get originalEvent() {
return this._originalEvent;
}
set originalEvent(a) {
this._originalEvent = a;
}
}
SliceEventArgs.$t = markType(SliceEventArgs, 'SliceEventArgs', EventArgs.$);
return SliceEventArgs;
})();
/**
* @hidden
*/
export let PieLabel = /*@__PURE__*/ (() => {
class PieLabel extends Control {
constructor() {
super();
this.ah = null;
this.ao = null;
this.ai = 0;
this.aj = null;
this.ap = null;
this.aq = null;
this.ag = 0;
}
ak(a) {
if (a.a.az == 3) {
this.ao = a.b3(this);
let b = typeCast(TextBlock.$, this.aj);
let c = b.al;
a.a.gz();
let d = this.ah.isExploded ? this.ah.b5 : this.ah.b7;
let e = GeometryUtil.u(d, this.ai, this.ah.a2 + a.a.db);
let 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();
}
}
}
let g = new TextBlock();
g.al = c;
this.aj = g;
}
}
al() {
}
am() {
this.ap._visibility = this.ah.ai.je != 0 ? this.ah.ai.je : this.ah.aj._visibility;
let a;
let b = this.ah.ai.dc;
let 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) {
let 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;
}
an() {
this.aq._visibility = this.ah.ai.je != 0 ? this.ah.ai.je : this.ah.aj._visibility;
let a = this.ah.b6();
let b = this.aq.an.c._inner[0];
let c = b._segments._inner[0];
let d = this.ah.ai.dc;
let e = (this.ao.top + this.ao.bottom) / 2;
let f = GeometryUtil.u(a, this.ai, this.ah.a2);
let g = GeometryUtil.u(a, this.ai, this.ah.a2 + this.ah.ai.db / 2);
let h;
let i;
let j;
let 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) {
let l = GeometryUtil.k(f, j);
if (d < l) {
i = GeometryUtil.w(j, f, d);
let m = g.x - f.x;
let n = g.y - f.y;
g = GeometryUtil.w(g, f, d);
let o = g.x - f.x;
let 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);
let 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;
})();
/**
* @hidden
*/
export let PieChartBase = /*@__PURE__*/ (() => {
class PieChartBase extends Control {
constructor() {
super();
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;
let 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 = (b, c) => this.gs(b, c.propertyName, c.oldValue, c.newValue);
this.cu = (b, c) => {
this.gz();
this.gy();
};
this.cv = (b, c) => {
if (this.b8) {
this.gr();
this.gq();
this.gz();
this.gx();
}
};
this.cw = (b, c) => this.g1(c);
this.cx = (b, c) => this.gh(c);
this.dk = (b, c) => this.fx(c.action, c.position, c.count, c.propertyName);
this.propertyUpdated = delegateCombine(this.propertyUpdated, this.a8);
let b = this.selectedSlices;
b.collectionChanged = delegateCombine(b.collectionChanged, this.cw);
this.b4 = true;
let c = this.explodedSlices;
c.collectionChanged = delegateCombine(c.collectionChanged, this.cv);
this.b1 = true;
this.selectedItems = new ObjectCollection(0);
let d = this.selectedItems;
d.collectionChanged = delegateCombine(d.collectionChanged, this.cx);
this.bx = ((() => {
let $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 = ((() => {
let $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();
}
a3() {
return new PieChartBaseView(this);
}
go(a) {
this.a4 = a;
}
get isFragment() {
return false;
}
get isLayer() {
return false;
}
onDetachedFromUI() {
this.a4.a1();
}
onAttachedToUI() {
this.a4.ay();
}
f0() {
this.a4.ap();
}
get bv() {
return this.bq;
}
set bv(a) {
if (this.bq != a) {
let b = this.bq;
this.bq = a;
this.gu("ValueColumn", b, this.bq);
}
}
get c1() {
return Math.abs(this.da) > 1 ? this.da : this.da * 100;
}
get XSRP() {
if (this._xsr == null) {
this._xsr = new SRProvider(this.a4.c.n);
}
return this._xsr;
}
get d9() {
let a = this.XSRP.b1("InvalidLabelBinding");
if (stringIsNullOrWhiteSpace(a)) {
a = "There is no such value for the labels to bind.";
}
return a;
}
get da() {
return this.c(PieChartBase.hp);
}
set da(a) {
let b = a;
if (isNaN_(a) || isInfinity(a)) {
b = 0;
}
if (a < 0) {
b = 0;
}
if (a > 100) {
b = 100;
}
this.h(PieChartBase.hp, b);
}
get br() {
return this.bo;
}
set br(a) {
if (this.bo != a) {
let b = this.br;
this.bo = a;
this.gu("LabelColumn", b, this.br);
}
}
get bs() {
return this.bp;
}
set bs(a) {
if (this.bp != a) {
let b = this.bs;
this.bp = a;
this.gu("LegendLabelColumn", b, this.bs);
}
}
get c0() {
let a = this.c5;
if (isNaN_(a) || isInfinity(a) || a < 0) {
return 0;
}
if (a > 1) {
return 1;
}
return a;
}
get c3() {
let a = this.dg;
if (isNaN_(a) || isInfinity(a) || a < 0) {
return 0;
}
if (a > 1) {
return 1;
}
return a;
}
get explodedSlices() {
return this.au;
}
set explodedSlices(a) {
let b = this.au;
if (b != null) {
let c = this.au;
c.collectionChanged = delegateRemove(c.collectionChanged, this.cv);
}
this.b1 = false;
this.au = a;
if (this.au != null) {
let d = this.au;
d.collectionChanged = delegateCombine(d.collectionChanged, this.cv);
this.b1 = true;
}
if (this.b8) {
this.gr();
this.gq();
this.gz();
this.gx();
}
}
get selectedSlices() {
return this.av;
}
set selectedSlices(a) {
let b = this.av;
b.collectionChanged = delegateRemove(b.collectionChanged, this.cw);
this.b4 = false;
this.av = a;
if (this.av != null) {
let 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();
}
}
get hc() {
return typeCast(DataTemplate.$, this.c(PieChartBase.h0));
}
set hc(a) {
this.h(PieChartBase.h0, a);
}
cb() {
return this.a5 != null;
}
cc() {
return this.a6 != null;
}
get df() {
return this.cz;
}
set df(a) {
let b = this.cz;
this.cz = a;
this.gu("PixelScalingRatio", b, this.cz);
}
get c2() {
return this.cy;
}
set c2(a) {
let b = this.cy;
this.cy = a;
this.gu("ActualPixelScalingRatio", b, this.cy);
}
get selectedItem() {
return this.c(PieChartBase.io);
}
set selectedItem(a) {
this.h(PieChartBase.io, a);
}
get selectedItems() {
return this._selectedItems;
}
set selectedItems(a) {
this._selectedItems = a;
}
gd(a, b) {
if (this.labelClick != null) {
this.labelClick(a, b);
}
}
gf(a, b) {
if (this.selectedItemChanging != null) {
this.selectedItemChanging(a, b);
}
}
gi(a, b) {
if (this.selectedItemsChanging != null) {
this.selectedItemsChanging(a, b);
}
}
ge(a, b) {
if (this.selectedItemChanged != null) {
this.selectedItemChanged(a, b);
}
}
gg(a, b) {
if (this.selectedItemsChanged != null) {
this.selectedItemsChanged(a, b);
}
}
gk(a, b) {
if (this.sliceClick != null) {
this.sliceClick(a, b);
}
}
fz(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);
}
}
g2(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;
}
g3(a) {
this.a4.bd(a);
}
dp(a) {
return this.a4.ae(a);
}
i8(a, b) {
let c = new Rect(0, 0, 0, 0, 0);
return c;
}
ca(a, b) {
let c = a.ah;
if (c == null) {
return false;
}
let d = c.b6();
let e = this.i3 == 1 ? c.a3 : c.ax;
let f = this.i3 == 1 ? c.ax : c.a3;
let g = false;
let h = false;
let i = GeometryUtil.u(d, e, c.a2);
let 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;
}
let 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;
}
let 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;
}
static dh(a) {
let b = Math.round(a * Math.pow(10, 5)) / Math.pow(10, 5);
return b;
}
cd(a) {
return PieChartBase.dh(Math.abs(a.ax - a.a3)) == 360;
}
static c6(a, b, c, d) {
let e = MathUtil.g(a - b, c - d);
let 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);
}
static g8(a) {
let b = new Array(a.count);
for (let c = 0; c < a.count; c++) {
let d = a._inner[c];
let e = d.ah;
let f = GeometryUtil.u(e.b7, d.ai, e.a2);
b[c] = f.y;
}
for (let g = 0; g < a.count; g++) {
for (let h = g + 1; h < a.count; h++) {
if (b[g] >= b[h]) {
let i = a._inner[g];
a._inner[g] = a._inner[h];
a._inner[h] = i;
let j = b[g];
b[g] = b[h];
b[h] = j;
}
}
}
}
g0(a) {
if (a.count == 0) {
return;
}
let b = this.a4.b4.width;
let c = this.a4.b4.height;
let d = a.count;
let e = a._inner[0].ah.a2;
let f = a._inner[0].ah.b6();
let g = true;
let h = 0;
let i = Number.POSITIVE_INFINITY;
let j = Number.NEGATIVE_INFINITY;
for (let k = 0; k < d - 1; k++) {
let l = a._inner[k];
let m = a._inner[k + 1];
if (l.ao.intersectsWith(m.ao)) {
h++;
}
}
let n = 0;
for (let o of fromEnum(a)) {
i = Math.min(i, o.ao.height);
j = Math.max(j, o.ao.height);
n += o.ao.height;
}
if (n > c) {
g = false;
}
if (g && h > 0) {
for (let p = 0; p < d - 1; p++) {
for (let q = p + 1; q < d; q++) {
let r = a._inner[p];
let s = a._inner[q];
if (r.ao.intersectsWith(s.ao)) {
let t = s.ao;
t.y = Math.min(r.ao.bottom + 0.01, c - i);
let u = this.db + e;
let v = Math.abs(f.y - (t.y + i / 2));
let w = Math.sqrt(Math.abs(u * u - v * v));
let x = GeometryUtil.n(s.ai);
if (x > 90 && x < 270) {
w = (t.width + w) * -1;
}
t.x = f.x + w;
s.ao = t;
}
}
}
for (let y = d - 1; y > 0; y--) {
for (let z = y - 1; z >= 0; z--) {
let aa = a._inner[y];
let ab = a._inner[z];
if (aa.ao.intersectsWith(ab.ao)) {
let ac = ab.ao;
ac.y = Math.max(aa.ao.top - i - 0.01, 0);
let ad = this.db + e;
let ae = Math.abs(f.y - (ac.y + i / 2));
let af = Math.sqrt(Math.abs(ad * ad - ae * ae));
let ag = GeometryUtil.n(ab.ai);
if (ag > 90 && ag < 270) {
af = (ac.width + af) * -1;
}
ac.x = f.x + af;
ab.ao = ac;
}
}
}
}
for (let ah of fromEnum(a)) {
let 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) {
let aj = Math.abs(ai.x);
ai.x = 0;
if (aj > ai.width) {
ai.width = 0;
}
else {
}
ah.ao = ai;
}
else if (ai.right > b) {
let ak = ai.right - b;
if (ak > ai.width) {
ai.width = 0;
}
else {
ai.width = ai.width - ak;
}
ah.ao = ai;
}
}
}
fx(a, b, c, d) {
this.gw();
}
gw() {
this.gp();
this.gr();
this.gq();
this.gz();
this.gx();
this.gy();
this.a4.bs();
}
gp() {
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;
}
for (let a of fromEnum(this.bv)) {
if (isNaN_(a) || isInfinity(a) || a <= 0) {
continue;
}
this.dj = this.dj + a;
}
for (let b = 0; b < this.bv.count; b++) {
let c = this.bv.item(b);
let d = this.a1 == 0 ? c <= 0 : c < 0;
if (isNaN_(c) || isInfinity(c) || d) {
continue;
}
let e = this.a2 == 1 ? c / this.dj : c;
let f = this.a2 == 1 ? this.dd / 100 : this.dd;
let 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);
}
}
}
gr() {
if (this.actualItemsSource == null || this.bm == null) {
this.bx.count = 0;
return;
}
let a = this.co.count;
let b = this.cn.count > 0;
let c = PieChartBase.dh(this.c4);
let d = PieChartBase.dh(this.c4);
if (b) {
a++;
}
this.dm = a;
for (let e = 0; e < a; e++) {
let f = false;
let g;
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);
}
let 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]);