igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,509 lines • 68.6 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 { PieChartBase } from "./PieChartBase";
import { DependencyProperty } from "igniteui-react-core";
import { PieChartBaseView } from "./PieChartBaseView";
import { Base, Number_$type, typeCast, fromEnum, markType, markDep, IEnumerable_$type, INotifyPropertyChanged_$type, PropertyChangedEventArgs, Point_$type, delegateCombine, enumGetBox, EnumUtil, Delegate_$type, Array_$type, Boolean_$type, delegateRemove, runOn, fromEn, toEnum } from "igniteui-react-core";
import { Control } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { NotifyCollectionChangedEventArgs } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { FastItemsSource } from "igniteui-react-core";
import { IChartLegend_$type } from "igniteui-react-core";
import { ContentControl } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PieSliceDataContext } from "./PieSliceDataContext";
import { UIElement } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { Visibility_$type } from "igniteui-react-core";
import { OthersCategoryType_$type } from "igniteui-react-core";
import { BrushCollection } from "igniteui-react-core";
import { isNaN_, isInfinity, intDivide } from "igniteui-react-core";
import { ILegendSeries_$type } from "igniteui-react-core";
import { ILegendTemplateProvider_$type } from "igniteui-react-core";
import { LabelsPosition_$type } from "./LabelsPosition";
import { Style } from "igniteui-react-core";
import { LeaderLineType_$type } from "./LeaderLineType";
import { DataTemplate } from "igniteui-react-core";
import { ILegendOwner_$type } from "igniteui-react-core";
import { SRProvider } from "igniteui-react-core";
import { PropertyUpdatedEventArgs } from "igniteui-react-core";
import { stringIsNullOrWhiteSpace } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { ObservableCollection$1 } from "igniteui-react-core";
import { DomRenderer_$type } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { HoleDimensionsChangedEventArgs } from "./HoleDimensionsChangedEventArgs";
import { DoughnutChartVisualData } from "./DoughnutChartVisualData";
import { RingSeriesVisualDataList } from "./RingSeriesVisualDataList";
import { RectData } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { PieLegendTemplates } from "./PieLegendTemplates";
import { BrushUtil } from "igniteui-react-core";
import { FontUtil } from "igniteui-react-core";
import { DOMEventProxy } from "igniteui-react-core";
import { SliceVisualData } from "./SliceVisualData";
import { RingSeriesVisualData } from "./RingSeriesVisualData";
import { RingVisualDataList } from "./RingVisualDataList";
import { RingVisualData } from "./RingVisualData";
import { ArcVisualDataList } from "./ArcVisualDataList";
import { ArcVisualData } from "./ArcVisualData";
import { SliceVisualDataList } from "./SliceVisualDataList";
import { PointData } from "igniteui-react-core";
import { AppearanceHelper } from "igniteui-react-core";
import { PathVisualData } from "igniteui-react-core";
import { DoughnutChartLabelVisualData } from "./DoughnutChartLabelVisualData";
import { RectUtil } from "igniteui-react-core";
import { SizeData } from "igniteui-react-core";
/**
* @hidden
*/
export let Arc = /*@__PURE__*/ (() => {
class Arc extends PieChartBase {
a3() {
return new ArcView(this);
}
go(a) {
super.go(a);
this.jg = a;
}
constructor() {
super();
this.jh = null;
this.jf = null;
this.jk = 0;
this.ab = Arc.$;
}
get ji() {
return this.jh;
}
set ji(a) {
let b = this.jh;
this.jh = a;
this.jg.b8(b, this.jh);
}
get jl() {
if (this.ji != null) {
return this.ji.i;
}
return 0;
}
gk(a, b) {
super.gk(a, b);
if (this.ji != null) {
this.ji.c.ax.bu(a, b);
}
}
fz(a, b) {
if (this.ji != null && this.ji.d != null) {
super.fz(a, b);
let c = this.jj(a);
if (c != null) {
this.ji.d.bj(c, b);
}
}
}
g2(a, b) {
if (this.ji != null && this.ji.d != null) {
super.g2(a, b);
let c = this.jj(a);
if (c != null) {
this.ji.d.b5(c, b);
}
}
}
jj(a) {
for (let b of fromEnum(this.jf.g)) {
if (b.b == a) {
return b;
}
}
return null;
}
g1(a) {
if (this.b9) {
this.gr();
this.gz();
this.gy();
}
}
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);
this.dm = a;
if (b) {
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) * this.jm / this.dj);
}
else {
d -= PieChartBase.dh(Math.abs(g) * this.jm / this.dj);
}
let h = this.bx.item(e);
if (this.c1 >= 100) {
h._visibility = 1;
}
else {
h._visibility = 0;
}
h.aw = true;
h.a3 = c;
h.ax = d;
h.a1 = 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]);
h.isExploded = this.explodedSlices.contains(e);
h.isSelected = this.selectedSlices.contains(e);
c = d;
h.aw = false;
}
this.bx.count = a;
if (this.jf != null) {
this.jf.q(this);
}
}
gy() {
let a = typeCast(IChartLegend_$type, this.legend);
if (a == null) {
return;
}
if (this.br == null || this.br.count == 0 || ((this.ji != null && this.ji.c != null) && (this.ji.d != null && !this.ji.d.series.contains(this.ji.c)))) {
a.clearLegendItemsForSeries(this.ji.c);
a.flushTextContentChangedCheck();
return;
}
this.cl = new List$1(UIElement.$, 0);
for (let b of fromEnum(this.bx.a)) {
let c = new ContentControl();
let d = this.dp(b);
let e = b.b0;
let f = b.isOthersSlice ? this.e6 : (this.bs != null && this.bs.count > 0) ? this.bs.item(this.co._inner[b.a5]) : null;
f = (f == null && this.br.count > 0) ? this.br.item(this.co._inner[b.a5]) : f;
c.content = ((() => {
let $ret = new PieSliceDataContext();
$ret.series = this.ji.c;
$ret.slice = b;
$ret.item = b.dataContext;
$ret.itemBrush = e;
$ret.legendLabel = f != null ? f.toString() : null;
$ret.itemLabel = d != null ? d.toString() : null;
$ret.percentValue = this.c9(b);
$ret.isOthersSlice = b.isOthersSlice;
return $ret;
})());
let g = c.content;
if (this.a6 != null) {
let h = this.a6(g);
if (h != null) {
g.legendLabel = h.toString();
}
}
if (this.aq != null && !g.isOthersSlice) {
let i = this.aq.i(g);
g.legendLabel = i;
}
if (this.ar != null && g.isOthersSlice) {
let j = this.ar.i(g);
g.legendLabel = j;
}
if (this.legendItemTemplate != null) {
c.ah = this.legendItemTemplate;
}
this.cl.add(c);
}
if (a.isItemwise) {
let k = a;
k.createLegendItemsInsert(this.cl, this.ji.c);
}
}
gs(a, b, c, d) {
super.gs(a, b, c, d);
switch (b) {
case Arc.$$p[0]:
this.jk = d;
this.gr();
this.gq();
this.gz();
this.gx();
break;
case "RadiusFactor":
if (this.ji != null && this.ji.d != null) {
this.ji.d.bw();
}
break;
case "Legend":
let e = typeCast(IChartLegend_$type, c);
if (e != null && this.ji != null && this.ji.c != null) {
e.clearLegendItemsForSeries(this.ji.c);
e.flushTextContentChangedCheck();
}
break;
}
}
jn() {
return this.a4.ad();
}
}
Arc.$t = /*@__PURE__*/ markType(Arc, 'Arc', PieChartBase.$);
Arc.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, Arc, 'gu', ['EndAngle:jm:jp', [1, 360]]);
return Arc;
})();
/**
* @hidden
*/
export let ArcItem = /*@__PURE__*/ (() => {
class ArcItem extends Base {
constructor() {
super();
this.d = null;
this.b = null;
this.n = null;
this.l = 0;
this.m = 0;
this.k = 0;
this.i = 0;
this.j = 0;
this.c = 0;
this.a = null;
this.g = null;
this.e = null;
this.h = null;
this.k = 0;
this.i = 360;
this.g = new List$1(SliceItem.$, 0);
}
o(a, b) {
let c = 0;
let d = 0;
let e = new List$1(Number_$type, 0);
let f = new List$1(Number_$type, 0);
let g = new List$1(Base.$, 0);
this.g.clear();
if (this.h == null) {
return;
}
let h = new FastItemsSource();
h.e = this.h;
let i = this.f(h, this.n);
if (i == null || i.count == 0) {
h.deregisterColumn(i);
h.m();
return;
}
for (let j of fromEnum(i)) {
if (isNaN_(j) || isInfinity(j) || j <= 0) {
continue;
}
c = c + j;
}
for (let k = 0; k < i.count; k++) {
let l = i.item(k);
if (isNaN_(l) || isInfinity(l) || l <= 0) {
continue;
}
let m = this.c == 1 ? l / c : l;
let n = this.c == 1 ? this.j / 100 : this.j;
if (m <= n) {
d = d + l;
f.add(k);
g.add1(h.item(k));
}
else {
e.add(k);
}
}
let o = e.count;
let p = f.count > 0;
let q = PieChartBase.dh(a);
let r = PieChartBase.dh(a);
if (p) {
o++;
}
for (let s = 0; s < o; s++) {
let t = false;
let u;
if (s == o - 1 && p) {
u = d;
t = true;
}
else {
u = i.item(e._inner[s]);
}
let v = 1;
if (v == 1) {
r += PieChartBase.dh(Math.abs(u) * b / c);
}
else {
r -= PieChartBase.dh(Math.abs(u) * b / c);
}
this.g.add(((() => {
let $ret = new SliceItem();
$ret.e = q;
$ret.d = r - q;
$ret.g = t ? g : h.item(e._inner[s]);
return $ret;
})()));
q = r;
}
h.deregisterColumn(i);
h.m();
}
f(a, b) {
let c = null;
return a.registerColumn(b, c, false);
}
p(a) {
let b = this.e == null ? a : this.e.e;
let c = this.e == null ? 360 : this.e.d;
this.o(b, c);
}
q(a) {
this.g.clear();
for (let b = 0; b < a.bx.count; b++) {
let c = a.bx.item(b);
this.g.add(((() => {
let $ret = new SliceItem();
$ret.e = c.a3;
$ret.d = c.ax - c.a3;
$ret.f = b;
$ret.a = this;
$ret.g = c.dataContext;
$ret.c = c.isOthersSlice;
$ret.b = c;
return $ret;
})()));
}
}
}
ArcItem.$t = /*@__PURE__*/ markType(ArcItem, 'ArcItem');
return ArcItem;
})();
/**
* @hidden
*/
export let RingSeriesBase = /*@__PURE__*/ (() => {
class RingSeriesBase extends Control {
constructor() {
super();
this.as = null;
this.ax = null;
this.propertyChanged = null;
this.propertyUpdated = null;
this.bd = null;
this.a2 = false;
this.a1 = false;
this.bb = null;
this.eh = null;
this.aw = null;
this.c9 = null;
this.az = null;
this.eh = { $type: Point_$type, x: 0, y: 0 };
this.as = (a, b) => this.c4(a, b.propertyName, b.oldValue, b.newValue);
this.propertyUpdated = delegateCombine(this.propertyUpdated, this.as);
this.aw = this.av();
this.c1(this.aw);
this.aw.k();
this.bb = (a, b) => this.cv(b.action, b.position, b.count, b.propertyName);
}
c6(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));
}
}
get el() {
if (this.ek != null) {
return this.ek;
}
if (this.ax != null && this.ax.cg != null) {
return this.ax.cg;
}
return null;
}
set el(a) {
let b = this.el;
if (this.ek != null && a != this.ek) {
a = this.ek;
}
this.c6("SelectedStyleResolved", b, a);
}
get co() {
return this.bd;
}
set co(a) {
let b = this.bd;
this.bd = a;
this.c6("TextStyle", b, a);
}
get da() {
return typeCast(DataTemplate.$, this.c(RingSeriesBase.dp));
}
set da(a) {
this.h(RingSeriesBase.dp, a);
}
get a3() {
return this.c(RingSeriesBase.df);
}
set a3(a) {
this.a2 = true;
this.h(RingSeriesBase.df, a);
}
get a4() {
if (!this.a2) {
return this.ax.ax;
}
else {
return this.a3;
}
}
c4(a, b, c, d) {
if (b == RingSeriesBase.$$p[4]) {
this.ay = ((() => {
let $ret = new FastItemsSource();
$ret.e = d;
return $ret;
})());
}
if (b == RingSeriesBase.$$p[1]) {
if (typeCast(FastItemsSource.$, c) != null) {
let e = (typeCast(FastItemsSource.$, c));
e.event = delegateRemove(e.event, this.bb);
this.a1 = false;
}
if (typeCast(FastItemsSource.$, d) != null) {
let f = (typeCast(FastItemsSource.$, d));
f.event = delegateCombine(f.event, this.bb);
this.a1 = true;
}
this.c3();
}
switch (b) {
case RingSeriesBase.$$p[32]:
this.el = d;
break;
case RingSeriesBase.$$p[36]:
this.c3();
break;
case RingSeriesBase.$$p[23]:
this.c3();
break;
}
}
get container() {
return this.ax;
}
get isStacked() {
return false;
}
get isVertical() {
return false;
}
get isUsableInLegend() {
return true;
}
get hasMarkers() {
return false;
}
get hasSubItems() {
return false;
}
cv(a, b, c, d) {
this.c3();
}
av() {
return new RingSeriesBaseView(this);
}
c1(a) {
}
c5(a) {
this.aw.n(a);
}
cu() {
if (this.aw != null) {
this.aw.i();
}
}
get isFragment() {
return false;
}
get isLayer() {
return false;
}
cy(a, b) {
this.cw(new NotifyCollectionChangedEventArgs(1, 0, b, a));
}
c0(a, b, c) {
this.cw(new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
}
cx() {
this.cw(new NotifyCollectionChangedEventArgs(0, 4));
}
cz(a, b) {
this.cw(new NotifyCollectionChangedEventArgs(1, 1, b, a));
}
cw(a) {
if (this.ay != null) {
this.ay.handleCollectionChanged(a);
}
}
resolveLegendIndex() {
return -1;
}
forSubItems(a) {
}
get a0() {
if (this.az == null) {
this.az = new SRProvider(this.aw.g);
}
return this.az;
}
cj() {
let a = this.a0.b7;
if (stringIsNullOrWhiteSpace(a)) {
a = "Others";
}
return this.ca != null ? this.ca : a;
}
}
RingSeriesBase.$t = /*@__PURE__*/ markType(RingSeriesBase, 'RingSeriesBase', Control.$, [INotifyPropertyChanged_$type, ILegendSeries_$type, ILegendTemplateProvider_$type]);
RingSeriesBase.dp = /*@__PURE__*/ DependencyProperty.i("LabelTemplate", DataTemplate.$, RingSeriesBase.$, /*@__PURE__*/ new PropertyMetadata(2, null, (a, b) => (typeCast(RingSeriesBase.$, a)).c6("LabelTemplate", b.oldValue, b.newValue)));
RingSeriesBase.df = /*@__PURE__*/ DependencyProperty.i("IsSurfaceInteractionDisabled", Boolean_$type, RingSeriesBase.$, /*@__PURE__*/ new PropertyMetadata(2, false, (a, b) => a.c6("IsSurfaceInteractionDisabled", b.oldValue, b.newValue)));
RingSeriesBase.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RingSeriesBase, 'c6', ['Brushes:ak:db', [BrushCollection.$, null], 'FastItemsSource:ay:dc', [FastItemsSource.$], 'FormatLabel:aq:dd', [Delegate_$type], 'FormatLegendLabel:ar:de', [Delegate_$type], 'ItemsSource::dg', [IEnumerable_$type, null], 'LabelExtent:a6:dh', [1, 10], 'LabelFormat:bl:di', [2, null], 'LabelFormatSpecifiers:ag:dj', [Array_$type, null], 'LabelInnerColor:ef:dk', [Brush.$, null], 'LabelMemberPath:bp:dl', [2], 'LabelOuterColor:eg:dm', [Brush.$, null], 'LabelsPosition:an:dn', [LabelsPosition_$type, /*@__PURE__*/ enumGetBox(LabelsPosition_$type, 1)], 'LeaderLineMargin:a7:dq', [1, 6], 'LeaderLineStyle:ei:dr', [Style.$, null], 'LeaderLineType:ao:ds', [LeaderLineType_$type, /*@__PURE__*/ enumGetBox(LeaderLineType_$type, 0)], 'LeaderLineVisibility:en:dt', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'LegendItemBadgeTemplate::du', [DataTemplate.$, null], 'LegendItemTemplate::dv', [DataTemplate.$, null], 'LegendLabelFormat:b0:dw', [2, null], 'LegendLabelFormatSpecifiers:ah:dx', [Array_$type, null], 'LegendLabelMemberPath:b3:dy', [2], 'LegendOthersLabelFormat:b5:dz', [2, null], 'LegendOthersLabelFormatSpecifiers:ai:d0', [Array_$type, null], 'Legend::d1', [IChartLegend_$type, null], 'OthersCategoryStyle:ej:d2', [Style.$, null], 'OthersCategoryText:ca:d3', [2, null], 'OthersCategoryThreshold:a8:d4', [1, 3], 'OthersCategoryType:ap:d5', [OthersCategoryType_$type, /*@__PURE__*/ enumGetBox(OthersCategoryType_$type, 1)], 'OthersLabelFormat:ce:d6', [2, null], 'OthersLabelFormatSpecifiers:aj:d7', [Array_$type, null], 'Outlines:al:d8', [BrushCollection.$, null], 'RadiusFactor:a9:d9', [1, 0.9], 'SelectedStyle:ek:ea', [Style.$, null], 'StartAngle:ba:eb', [1, 0], 'ToolTip::ec', [4, null], 'ToolTipStyle:em:ed', [Style.$, null], 'ValueMemberPath:cs:ee', [2, null]]);
return RingSeriesBase;
})();
/**
* @hidden
*/
export let Ring = /*@__PURE__*/ (() => {
class Ring extends Base {
constructor() {
super();
this.j = 0;
this.h = 0;
this.q = new Size();
this.p = null;
this._ringControl = null;
this.b = null;
this.i = 0;
this.g = null;
this.d = null;
this.e = false;
this.p = { $type: Point_$type, x: 0, y: 0 };
this.q = new Size(1, 0, 0);
this.ringControl = ((() => {
let $ret = new RingControl();
$ret.ai = this;
return $ret;
})());
this.g = new List$1(ArcItem.$, 0);
this.e = true;
}
get ringControl() {
return this._ringControl;
}
set ringControl(a) {
this._ringControl = a;
}
get c() {
return this.b;
}
set c(a) {
this.b = a;
this.b.aw.h(this.ringControl);
if (this.ringControl != null) {
this.ringControl.ak.s(a);
}
}
f() {
if (this.ringControl != null && this.ringControl.ak.d()) {
let a, b;
a = this.p.x - this.c.eh.x;
b = this.p.y - this.c.eh.y;
this.ringControl.ak.v(a, b);
return this.ringControl.an();
}
return false;
}
o() {
if (this.ringControl != null) {
this.ringControl.width = this.q.width;
this.ringControl.height = this.q.height;
this.c.aw.h(this.ringControl);
this.ringControl.ao = this.g;
}
}
l(source_, a, b) {
this.ringControl.as(source_, a, b);
}
k(source_) {
this.ringControl.ar(source_);
}
m(source_, a, b) {
this.ringControl.at(source_, a, b);
}
n(source_, a, b, c) {
this.ringControl.au(source_, a, b, c);
}
}
Ring.$t = /*@__PURE__*/ markType(Ring, 'Ring');
return Ring;
})();
/**
* @hidden
*/
export let RingCollection = /*@__PURE__*/ (() => {
class RingCollection extends ObservableCollection$1 {
constructor() {
super(Ring.$, 0);
}
p() {
for (let a of fromEnum(this)) {
if (a.e) {
let b = 0;
let c = a.ringControl.arcs.count;
while (b < c) {
a.ringControl.arcs.destroy(a.ringControl.arcs.item(b));
b++;
}
a.ringControl.arcs.count = 0;
a.ringControl = null;
}
}
super.p();
}
u(a) {
let b = this._inner[a];
if (b.e) {
b.ringControl.arcs.destroy(b.ringControl.arcs.item(a));
b.ringControl.arcs.count = 0;
b.ringControl = null;
}
super.u(a);
}
}
RingCollection.$t = /*@__PURE__*/ markType(RingCollection, 'RingCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(Ring.$));
return RingCollection;
})();
/**
* @hidden
*/
export let RingControl = /*@__PURE__*/ (() => {
class RingControl extends Control {
constructor() {
super();
this.ak = null;
this.ah = null;
this.arcs = null;
this.ao = null;
this.a0 = null;
this.propertyChanged = null;
this.propertyUpdated = null;
this.ab = RingControl.$;
this.ak = this.aj();
this.ax(this.ak);
this.ak.r();
this.arcs = ((() => {
let $ret = new Pool$1(Arc.$);
$ret.create = runOn(this.ak, this.ak.a);
$ret.activate = runOn(this.ak, this.ak.l);
$ret.disactivate = runOn(this.ak, this.ak.n);
$ret.destroy = runOn(this.ak, this.ak.m);
return $ret;
})());
}
get al() {
return this.ai.c;
}
get ai() {
return this.ah;
}
set ai(a) {
this.ah = a;
if (this.ah == null) {
this.ak.s(null);
}
else {
this.ak.s(this.ah.c);
}
}
aj() {
return new RingControlView(this);
}
ax(a) {
}
az(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));
}
}
aw() {
this.an();
}
an() {
if (this.ao == null) {
return false;
}
if (!this.ak.d()) {
return false;
}
let a = 0;
let b = false;
for (let c of fromEnum(this.ao)) {
let d = this.arcs.item(a);
d.jf = c;
if (d.da != this.ai.h) {
d.da = this.ai.h;
}
if ((d.width != this.ai.q.width || d.height != this.ai.q.height) && d.a4.s()) {
d.width = this.ai.q.width;
d.height = this.ai.q.height;
this.ak.ab(d);
b = true;
}
if (d.di != c.k) {
d.di = c.k;
}
if (d.jm != c.i) {
d.jm = c.i;
}
if (d.itemsSource != c.h) {
d.itemsSource = c.h;
}
if (d.am != c.a) {
d.am = c.a;
}
this.ak.t(d, 0, 0);
a++;
}
this.arcs.count = a;
return b;
}
ay(a) {
this.ak.w(a);
}
av() {
this.ak.q();
}
ap() {
return this.ak.j();
}
as(source_, a, b) {
for (let c = 0; c < this.arcs.count; c++) {
this.arcs.item(c).f7(source_, a, b);
}
}
ar(source_) {
for (let a = 0; a < this.arcs.count; a++) {
this.arcs.item(a).f5(source_);
}
}
at(source_, a, b) {
for (let c = 0; c < this.arcs.count; c++) {
this.arcs.item(c).f8(source_, a, b);
}
}
au(source_, a, b, c) {
for (let d = 0; d < this.arcs.count; d++) {
this.arcs.item(d).f9(source_, a, b, c);
}
}
}
RingControl.$t = /*@__PURE__*/ markType(RingControl, 'RingControl', Control.$, [INotifyPropertyChanged_$type]);
return RingControl;
})();
/**
* @hidden
*/
export let RingSeriesCollection = /*@__PURE__*/ (() => {
class RingSeriesCollection extends ObservableCollection$1 {
constructor() {
super(RingSeriesBase.$, 0);
}
}
RingSeriesCollection.$t = /*@__PURE__*/ markType(RingSeriesCollection, 'RingSeriesCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(RingSeriesBase.$));
return RingSeriesCollection;
})();
/**
* @hidden
*/
export let SliceItem = /*@__PURE__*/ (() => {
class SliceItem extends Base {
constructor() {
super();
this.e = 0;
this.d = 0;
this.a = null;
this.f = 0;
this.b = null;
this.g = null;
this.c = false;
}
}
SliceItem.$t = /*@__PURE__*/ markType(SliceItem, 'SliceItem');
return SliceItem;
})();
/**
* @hidden
*/
export let SliceCollection = /*@__PURE__*/ (() => {
class SliceCollection extends ObservableCollection$1 {
constructor() {
super(SliceItem.$, 0);
this.ae = false;
this.ag = false;
}
r(a, b) {
if (this.contains(b)) {
return;
}
let c = this.ah(b.b);
if (c != -1) {
super.x(c, b);
}
else {
super.r(a, b);
if (this.ae) {
if (this.ag) {
b.b.isSelected = true;
}
else {
b.b.isExploded = true;
}
}
}
}
x(a, b) {
if (this.ae) {
if (this.ag) {
this._inner[a].b.isSelected = false;
}
else {
this._inner[a].b.isExploded = false;
}
}
super.x(a, b);
}
u(a) {
let b = this._inner[a];
super.u(a);
if (this.ae) {
if (this.ag) {
b.b.isSelected = false;
}
else {
b.b.isExploded = false;
}
}
}
remove(a) {
let b = this.ah(a.b);
if (b != -1) {
this.u(b);
return true;
}
else {
return false;
}
}
p() {
while (this.count > 0) {
this.u(0);
}
}
ah(a) {
for (let b = 0; b < this.count; b++) {
if (this._inner[b].b == a) {
return b;
}
}
return -1;
}
}
SliceCollection.$t = /*@__PURE__*/ markType(SliceCollection, 'SliceCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(SliceItem.$));
return SliceCollection;
})();
/**
* @hidden
*/
export let XamDoughnutChart = /*@__PURE__*/ (() => {
class XamDoughnutChart extends Control {
constructor() {
super();
this.al = new RingSeriesCollection();
this.aj = new RingCollection();
this.ap = ((() => {
let $ret = new SliceCollection();
$ret.ae = true;
$ret.ag = true;
return $ret;
})());
this.ao = ((() => {
let $ret = new SliceCollection();
$ret.ae = true;
$ret.ag = false;
return $ret;
})());
this.ah = null;
this.a0 = NaN;
this.az = 1;
this.au = null;
this.sliceClick = null;
this.propertyChanged = null;
this.propertyUpdated = null;
this.holeDimensionsChanged = null;
let a = this.at();
this.bv(a);
a.s();
this.ab = XamDoughnutChart.$;
this.ah = (b, c) => this.bz(b, c.propertyName, c.oldValue, c.newValue);
this.propertyUpdated = delegateCombine(this.propertyUpdated, this.ah);
let b = this.series;
b.collectionChanged = delegateCombine(b.collectionChanged, runOn(this, this.b6));
}
get ak() {
return this.aj;
}
get series() {
return this.al;
}
b6(a, b) {
let c = new List$1(RingSeriesBase.$, 0);
if (b.oldItems != null) {
for (let d of fromEn(b.oldItems)) {
if (b.newItems == null || !b.newItems.contains(d)) {
d.cu();
this.au.w(d);
}
}
}
this.bx();
this.b2();
}
get a3() {
return this.c(XamDoughnutChart.cc);
}
set a3(a) {
this.h(XamDoughnutChart.cc, a);
}
get ar() {
return this.ap;
}
set ar(a) {
this.ap.clear();
this.ap.ae = false;
this.ap = a;
this.ap.ae = true;
this.ap.ag = true;
for (let b = 0; b < this.ap.count; b++) {
this.ap._inner[b].b.isSelected = true;
}
}
get aq() {
return this.ao;
}
set aq(a) {
this.ao.clear();
this.ao.ae = false;
this.ao = a;
this.ao.ae = true;
this.ao.ag = false;
for (let b = 0; b < this.ao.count; b++) {
this.ao._inner[b].b.isExploded = true;
}
}
get a4() {
return this.a0;
}
set a4(a) {
let b = this.a0;
this.a0 = a;
this.b1("PixelScalingRatio", b, this.a0);
}
get a1() {
return this.az;
}
set a1(a) {
let b = this.az;
this.az = a;
this.b1("ActualPixelScalingRatio", b, this.az);
}
destroy() {
this.au.v(null);
for (let a of fromEnum(this.series)) {
a.cu();
}
}
b5(a, b) {
if (b) {
this.ar.add(a);
}
else {
this.ar.remove(a);
}
}
bj(a, b) {
if (b) {
this.aq.add(a);
}
else {
this.aq.remove(a);
}
}
bz(a, b, c, d) {
switch (b) {
case XamDoughnutChart.$$p[5]:
for (let e of fromEnum(this.series)) {
e.el = d;
}
break;
case XamDoughnutChart.$$p[0]:
for (let f = 0; f < this.aj.count; f++) {
for (let g of fromEnum(this.aj._inner[f].ringControl.arcs.a)) {
g.b8 = this.av;
}
}
break;
case XamDoughnutChart.$$p[1]:
for (let h = 0; h < this.aj.count; h++) {
for (let i of fromEnum(this.aj._inner[h].ringControl.arcs.a)) {
i.b9 = this.aw;
}
}
break;
case "PixelScalingRatio":
let j = DeviceUtils.a(this.a4);
if (isNaN_(j)) {
this.a1 = 1;
}
else {
this.a1 = j;
}
break;
case "ActualPixelScalingRatio":
for (let k of fromEnum(this.aj)) {
for (let l of fromEnum(k.ringControl.arcs.a)) {
l.c2 = this.a1;
}
}
break;
}
}
at() {
return new XamDoughnutChartView(this);
}
bv(a) {
this.au = a;
}
b2() {
this.by();
this.b4();
this.b3();
this.bw();
this.au.z();
}
b4() {
for (let a of fromEnum(this.series)) {
a.c8();
}
}
bw() {
let a = this.au.ab;
if (a.isEmpty || a.width == 0 || a.height == 0) {
return;
}
let b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
let c = Math.min(a.width / 2, a.height / 2);
let d = 0.9;
if (this.series.count > 0) {
d = this.series._inner[0].a9;
if (isNaN_(d) || isInfinity(d) || d < 0) {
d = 0;
}
else if (d > 1) {
d = 1;
}
}
let e = this.a3 * c / 100 * d;
this.au.x(e * 2, e * 2);
this.au.u(b.x - e, b.y - e);
}
b3() {
let a = false;
for (let b of fromEnum(this.aj)) {
if (b.f()) {
a = true;
}
}
if (a) {
for (let c of fromEnum(this.aj)) {
c.c.aw.l();
}
}
}
by() {
let a = this.au.ab;
if (a.isEmpty || a.width == 0 || a.height == 0) {
return;
}
let b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
let c = Math.min(a.width / 2, a.height / 2);
let d = Math.max(a.width / 2, a.height / 2);
if (a.width > a.height) {
c = c + d;
d = c - d;
c = c - d;
}
let e = ((100 - this.a3) / 100 * c) / this.aj.count;
let f = ((100 - this.a3) / 100 * d) / this.aj.count;
let g = this.a3 * c / 100;
let h = this.a3 * d / 100;
let i = 1;
for (let j of fromEnum(this.aj)) {
let k = (g + (e * i));
let l = (h + (f * i));
j.i = e;
j.q = new Size(1, k * 2, l * 2);
j.p = { $type: Point_$type, x: b.x - k, y: b.y - l };
j.h = 100 - (e / k * 100);
j.o();
i++;
}
}
bx() {
this.aq.clear();
this.ar.clear();
this.aj.clear();
this.au.j();
this.au.i();
let a = 0;
for (let b = 0; b < this.series.count; b++) {
let c = this.series._inner[b];
c.ax = this;
this.au.h(c);
let series_ = c;
series_.externalObject.sychronizeCollections();
let d = c.au();
for (let e of fromEnum(d)) {
e.d = this;
e.j = a;
this.aj.add(e);
a++;
}
}
}
bt() {
if (this.au != null) {
this.height = this.au.ab.height;
this.width = this.au.ab.width;
}
this.b2();
}
bu(a, b) {
let c = a;
let d = c.ji.c;
if (d.a4) {
return;
}
if (this.sliceClick != null) {
this.sliceClick(a, b);
}
}
b1(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));
}
}
onDetachedFromUI() {
this.au.r();
for (let a = 0; a < this.aj.count; a++) {
for (let b of fromEnum(this.aj._inner[a].ringControl.arcs.a)) {
b.onDetachedFromUI();
}
for (let c of fromEnum(this.aj._inner[a].ringControl.arcs.b)) {
c.onDetachedFromUI();
}
}
}
onAttachedToUI() {
this.au.q();
for (let a = 0; a < this.aj.count; a++) {
for (let b of fromEnum(this.aj._inner[a].ringControl.arcs.a)) {
b.onAttachedToUI();
}
for (let c of fromEnum(this.aj._inner[a].ringControl.arcs.b)) {
c.onAttachedToUI();
}
}
}
provideContainer(a) {
this.au.v(a);
}
notifyResized() {
this.au.y();
}
bd() {
return this.au.g();
}
cf() {
return this.au.aa;
}
a2() {
return this.au.d;
}
bk() {
let a;
let b;
for (let c = 0; c < this.series.count; c++) {
b = this.series._inner[c].au();
for (let d = 0; d < b.count; d++) {
a = b._inner[d].ringControl.ak.h();
for (let e = 0; e < a.count; e++) {
a._inner[e].f0();
}
}
}
}
bs() {
if (this.holeDimensionsChanged != null) {
this.holeDimensionsChanged(this, new HoleDimensionsChangedEventArgs(this.cf(), this.a2()));
}
}
as() {
let a = new DoughnutChartVisualData();
a.series = new RingSeriesVisualDataList();
a.viewport = RectData.b(this.au.ab);
this.au.o(a);
return a;
}
bc() {
let a = this.as();
a.scaleByViewport();
return a.serialize();
}
*_ay(a) {
for (let b of fromEnum(this.series)) {
if (PieChartBase.ck(a, b.itemsSource)) {
yield b;
}
}
}
ay(a) {
return toEnum(() => this._ay(a));
}
bm(source_, a, b) {
for (let c of fromEnum(this.ay(source_))) {
c.cy(a, b);
}
}
bp(source_, a, b, c) {
for (let d of fromEnum(this.ay(source_))) {
d.c0(a, b, c);
}
}
bl(source_) {
for (let a of fromEnum(this.ay(source_))) {
a.cx();
}
}
bn(source_, a, b) {
for (let c of fromEnum(this.ay(source_))) {
c.cz(a, b);
}
}
}
XamDoughnutChart.$t = /*@__PURE__*/ markType(XamDoughnutChart, 'XamDoughnutChart', Control.$, [INotifyPropertyChanged_$type, ILegendOwner_$type]);
XamDoughnutChart.cc = /*@__PURE__*/ DependencyProperty.i("InnerExtent", Number_$type, XamDoughnutChart.$, /*@__PURE__*/ new PropertyMetadata(2, 40, (a, b) => {
let c = b.newValue;
if (c < 0 || c > 100) {
if (b.oldValue != null) {
a.a3 = b.oldValue;
}
return;
}
a.b2();
a.b1("InnerExtent", b.oldValue, b.newValue);
}));
XamDoughnutChart.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, XamDoughnutChart, 'b1', ['AllowSliceExplosion:av:b8', [0, true], 'AllowSliceSelection:aw:b9', [0, true], 'CenterData:a5:ca', [4, null], 'CenterDataTemplate:b7:cb', [DataTemplate.$, null], 'IsSurfaceInteractionDisabled:ax:cd', [0, false], 'SelectedStyle:cg:ce', [Style.$, null]]);
return XamDoughnutChart;
})();
/**
* @hidden
*/
export let ArcView = /*@__PURE__*/ (() => {
class ArcView extends PieChartBaseView {
constructor(a) {
super(a);
this.b6 = null;
this.b6 = a;
}
b8(a, b) {
this.e.series = this.b6.ji.c;
}
b7() {
return this.f;
}
b9() {
this.bc();
this.bt = new Brush();
let a = this.c.v();
this.bt._fill = a.rootWrapper.getStyleProperty("color");
}
}
ArcView.$t = /*@__PURE__*/ markType(ArcView, 'ArcView', PieChartBaseView.$);
return ArcView;
})();
/**
* @hidden
*/
export let RingControlView = /*@__PURE__*/ (() => {
class RingControlView extends Base {
constructor(a) {
super();
this.b = null;
this.f = new List$1(Arc.$, 0);
this.g = new List$1(Arc.$, 0);
this.i = null;
this.e = new Dictionary$2(Arc.$, DomRenderer_$type, 0);
this.c = null;
this.b = a;
}
a() {
let a = new Arc();
a.o = 0;
a.n = 0;
a.ji = this.b.ai;
this.f.add(a);
this.z(a);
if (a.fq != this.b.al.co) {
a.fq = this.b.al.co;
}
a.db = this.b.al.a6;
a.a5 = this.b.al.aq;
a.ej = this.b.al.bp;
a.az = this.b.al.an;
a.hc = this.b.al.da;
a.fv = this.b.al.cs;
if (this.b.al.toolTip != null) {
a.dr = this.b.al.toolTip;
}
a.je = this.b.al.en;
a.ja = this.b.al.ei;
a.a0 = this.b.al.ao;
a.dc = this.b.al.a7;
a.dd = this.b.al.a8;
a.a2 = this.b.al.ap;
a.e6 = this.b.al.cj();
a.jb = this.b.al.ej;
a.legend = this.b.al.legend;
a.legendItemTemplate = this.b.al.legendItemTemplate;
a.legendItemBadgeTemplate = this.b.al.legendItemBadgeTemplate;
a.an = this.b.al.al;
a.i0 = this.b.al.ef;
a.i1 = this.b.al.eg;
a.di = this.b.al.ba;
a.am = this.b.al.ak;
a.jc = this.b.al.el;
a.cf = true;
a.dg = this.b.al.a9;
a.b8 = this.b.al.ax.av;
a.b9 = this.b.al.ax.aw;
a.a6 = this.b.al.ar;
a.ez = this.b.al.b3;
a.c2 = this.b.al.ax.a1;
return a;
}
l(a) {
let b = this.e.item(a).rootWrapper;
if (b != null) {
b.show();
}
this.g.add(a);
}
n(a) {
let b = this.e.item(a).rootWrapper;
if (b != null) {
b.hide();
}
this.g.remove(a);
}
m(a) {
this.o(a);
this.f.remove(a);
}
h() {
return this.f;
}
r() {
}
aa() {
this.b.aw();
}
t(a, b, c) {
b = b + this.b.n;
c = c + this.b.o;
if (this.c != null) {
b = b + this.c.n;
c = c + this.c.o;
}
if (a.n != b || a.o != c) {
a.n = b;
a.o = c;
this.u(a, this.e.item(a).rootWrapper);
}
}
w(a) {
if (a == null) {
this.b.arcs.count = 0;
for (let b of fromEnum(this.f)) {
b.destroy();
}
this.f.clear();
this.e.clear();
this.g.clear();
return;
}
this.i = a;
this.i.rootWrapper.setStyleProperty("position", "relative");
for (let c of fromEnum(this.f)) {
let d = this.e.item(c);
this.i.append(d.rootWrapper);
c.jg.b9();
}
this.aa();
}
z(a) {
let b = this.i.createElement("div");
b.setStyleProperty("position", "absolute");
this.e.addItem(a, this.i.getSubR