igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,471 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.