igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
662 lines (661 loc) • 24.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 { AnchoredRadialSeries } from "./AnchoredRadialSeries";
import { DependencyProperty } from "igniteui-angular-core";
import { enumGetBox, Point_$type, runOn, typeCast, markType, markDep, fromEnum } from "igniteui-angular-core";
import { LegendEmptyValuesMode_$type } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { RadialBaseView } from "./RadialBaseView";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
import { SliceCoords } from "./SliceCoords";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { ArcSegment } from "igniteui-angular-core";
import { PieSliceCollisionGeometry } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { GeometryUtil } from "igniteui-angular-core";
import { MathUtil } from "igniteui-angular-core";
import { ProportionalCategoryAngleAxis } from "./ProportionalCategoryAngleAxis";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { DataContext } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { CollisionRect } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { intDivide, isNaN_ } from "igniteui-angular-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
/**
* @hidden
*/
export let RadialPieSeries = /*@__PURE__*/ (() => {
class RadialPieSeries extends AnchoredRadialSeries {
constructor() {
super();
this.adr = null;
this.adw = null;
this.ado = 0;
this.ab = RadialPieSeries.$;
}
bj() {
return new RadialPieSeries();
}
get_fm() {
return true;
}
get_fk() {
return true;
}
jj() {
if (!isNaN_(this.ji)) {
return super.jj();
}
return Defaults.h;
}
cs() {
return new RadialPieSeriesView(this);
}
q0(a) {
super.q0(a);
this.adq = a;
}
get ads() {
return this.adr;
}
set ads(a) {
if (this.adr != a) {
let b = this.ads;
this.adr = a;
this.raisePropertyChanged("LegendLabelColumn", b, this.ads);
}
}
get adz() {
return this.adw;
}
set adz(a) {
if (this.adw != a) {
let b = this.adw;
this.adw = a;
this.raisePropertyChanged("LegendLabelMemberPath", b, this.adw);
}
}
get adp() {
return this.ado;
}
set adp(a) {
if (this.ado != a) {
let b = this.ado;
this.ado = a;
this.raisePropertyChanged("LegendEmptyValuesMode", enumGetBox(LegendEmptyValuesMode_$type, b), enumGetBox(LegendEmptyValuesMode_$type, this.ado));
}
}
preferredCategoryMode(a) {
return a != null && a == this.yy ? 2 : 0;
}
o4(a, b) {
super.o4(a, b);
let c = b;
if (a && c.c6 != null) {
c.c6.count = 0;
}
}
iv() {
return this.yy.k8(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
}
ar(a, b) {
let c = new List$1(Rect.$, 0);
let d = this.cv.by;
let e = this.cv.bx;
let f = this.getEffectiveViewport1(this.cv);
let g = this.wi(this.cv);
let h = this.y4.k5(e, d, f, g);
let i = { $type: Point_$type, x: 0.5, y: 0.5 };
let j = this.y4;
let k = Math.max(0, 0.5 * j.n6);
let l = k;
l = Math.max(l, h.minLength);
let m = this.yy.k8(d, e, f);
let n = this.yy != null && this.yy.cl;
let o = this.y9;
if (this.d3()) {
o = this.zc;
}
{
if (n) {
m = this.zz(a, d, e, f);
}
if (b < 0 || b > o.f.count - 1) {
return null;
}
let p = o.f._inner[b][0];
let q = Math.min(o.f._inner[b][2], h.maxLength);
return this.adt(d, e, f, p - (m * 0.5), p + (m * 0.5), l, q, i);
}
}
get_ed() {
return true;
}
get_acf() {
return true;
}
get_ab9() {
return true;
}
abb(a, b) {
super.abb(a, b);
let c = b;
let d = b.by;
let e = b.bx;
let f = this.getEffectiveViewport1(b);
let g = this.wi(b);
let h = this.y4.k5(e, d, f, g);
let i = a.f;
let j = this.y4;
let k = Math.max(0, 0.5 * j.n6);
let l = k;
l = Math.max(l, h.minLength);
let m = this.yy.k8(d, e, f);
let n = this.yy.cl;
let o = { $type: Point_$type, x: 0.5, y: 0.5 };
let p = this.adu;
let q = this.adv;
let r = (p > 0 && q > 0);
let s = this.ab7.count;
this.zf.a2(this, this.zw(), runOn(this, this.ym), this.z5(b), this.z6(b));
this.zf.r = this.adu;
this.zf.s = this.adv;
this.zf.k = this.adu;
this.zf.l = this.adv;
let t = false;
let u = this.zf.b;
if (u != null) {
t = true;
}
let v = this.yy;
let w = new ScalerParams(1, b.by, b.bx, v.ch);
w.c = this.getEffectiveViewport();
let x = 0;
let y = 0;
for (let z = 0; z < i.count; ++z) {
let aa = i._inner[z][0];
let ab = Math.min(i._inner[z][2], h.maxLength);
let ac = i._inner[z][1];
let ad = i._inner[z][2];
let ae = i._inner[z][3];
if (t) {
this.ac4(i, z, s, v, w, b.q);
}
if (n) {
if (isNaN_(aa) || isNaN_(ac) || isNaN_(ad)) {
continue;
}
let af = (b.cx.c + z) * b.cx.b;
if ((b.cx.c + z) * b.cx.b > this.yy.lk - 1) {
if ((af) * b.cx.b >= this.yy.lj) {
af = (af) - (intDivide((this.yy.lj), b.cx.b));
}
}
m = ae;
if (isNaN_(m)) {
continue;
}
}
let ag = c.c6.item(x);
x++;
let ah = this.zf.k;
let ai = this.zf.l;
r = (ah > 0 && ai > 0);
let aj = null;
if (r) {
aj = this.ad5(d, e, f, aa - (m * 0.5), aa + (m * 0.5), l, ab, o, ah, ai);
}
else {
aj = this.ad6(d, e, f, aa - (m * 0.5), aa + (m * 0.5), l, ab, o);
}
ag.an = aj;
this.zf.ad(ag, false, false, false, false);
let ak = i._inner[z][2];
if (ak > y) {
y = ak;
}
}
c.cz = ViewportUtils.f(y, d, e);
c.c0 = { $type: Point_$type, x: ViewportUtils.e(o.x, d, e, f), y: ViewportUtils.i(o.y, d, e, f) };
c.c6.count = x;
c.db();
}
ad6(a, b, c, d, e, f, g, h) {
let i = SliceCoords.b(a, b, c, d, e, f, g, h);
let j = new PathFigure();
j._startPoint = i.d;
j._isClosed = true;
j._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = i.f;
return $ret;
})()));
j._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = i.h;
$ret.f = i.n;
$ret.d = 1;
$ret.b = i.c;
return $ret;
})()));
j._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = i.j;
return $ret;
})()));
j._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = i.d;
$ret.f = i.m;
$ret.d = 0;
$ret.b = i.c;
return $ret;
})()));
let k = new PathGeometry();
k.c.add(j);
return k;
}
adt(a, b, c, d, e, f, g, h) {
let i = SliceCoords.b(a, b, c, d, e, f, g, h);
if (isNaN_(i.n.width) || isNaN_(d) || isNaN_(e)) {
return null;
}
let j = ViewportUtils.e(0.5, a, b, c);
let k = ViewportUtils.i(0.5, a, b, c);
return new PieSliceCollisionGeometry(j, k, i.n.width, i.m.width, d, e);
}
ad5(a, b, c, d, e, f, g, h, i, j) {
let k = SliceCoords.a(a, b, c, d, e, f, g, h, i, j);
if (k == null) {
return this.ad6(a, b, c, d, e, f, g, h);
}
let l = new PathFigure();
l._startPoint = k.d;
l._isClosed = true;
let m = ((d + ((e - d) * 0.5)) * 180 / Math.PI) + 90;
let n = new Size(1, k.l.width * (f / g), k.l.height * (f / g));
l._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = k.e;
$ret.f = n;
$ret.c = m;
$ret.d = 1;
$ret.b = false;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = k.f;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = k.g;
$ret.f = k.l;
$ret.c = m;
$ret.d = 1;
$ret.b = false;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = k.h;
$ret.f = k.n;
$ret.d = 1;
$ret.b = k.c;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = k.i;
$ret.f = k.l;
$ret.c = m;
$ret.d = 1;
$ret.b = false;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = k.j;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = k.k;
$ret.f = n;
$ret.c = m;
$ret.d = 1;
$ret.b = false;
return $ret;
})()));
l._segments.add(((() => {
let $ret = new ArcSegment();
$ret.e = k.d;
$ret.f = k.m;
$ret.d = 0;
$ret.b = k.c;
return $ret;
})()));
let o = new PathGeometry();
o.c.add(l);
return o;
}
q8(a, b, c, d) {
super.q8(a, b, c, d);
switch (b) {
case RadialPieSeries.$$p[0]:
case RadialPieSeries.$$p[1]:
this.q2();
break;
case "FastItemsSource":
if (c != null) {
if (this.ads != null) {
c.deregisterColumn(this.ads);
}
}
if (d != null) {
if (this.adz != null) {
this.ads = this.dm(this.adz);
}
}
break;
case "LegendLabelMemberPath":
if (this.dn != null) {
this.dn.deregisterColumn(this.ads);
this.ads = this.dm(this.adz);
this.pd();
this.ps();
}
break;
}
}
wm(a) {
let b = this.adq.by;
let c = this.adq.bx;
let d = this.getEffectiveViewport1(this.adq);
let e = this.wi(this.adq);
let f = this.y4.k5(c, b, d, e);
let g = { $type: Point_$type, x: 0.5, y: 0.5 };
let h = GeometryUtil.j(g, a);
let i = this.y9.f;
let j = 0;
for (let k = 0; k < i.count; k++) {
let l = i._inner[k][0];
let m = Math.min(i._inner[k][2], f.maxLength);
let n = i._inner[k][3];
if (isNaN_(n)) {
continue;
}
l = l % 6.28318531;
if (l < 0) {
l += 6.28318531;
}
if (h >= l - (n * 0.5) && h <= l + (n * 0.5)) {
let o = Math.max(0, 0.5 * this.y4.n6);
let p = o;
p = Math.max(p, f.minLength);
let q = SliceCoords.b(b, c, d, l - (n * 0.5), l + (n * 0.5), p, m, g);
let r = GeometryUtil.u({ $type: Point_$type, x: ViewportUtils.e(g.x, b, c, d), y: ViewportUtils.i(g.y, b, c, d) }, MathUtil.f(l), q.n.width);
let s = 1.7976931348623157E+308;
let t = 1.7976931348623157E+308;
let u = -1.7976931348623157E+308;
let v = -1.7976931348623157E+308;
s = Math.min(s, q.d.x);
s = Math.min(s, q.f.x);
s = Math.min(s, q.h.x);
s = Math.min(s, q.j.x);
s = Math.min(s, r.x);
t = Math.min(t, q.d.y);
t = Math.min(t, q.f.y);
t = Math.min(t, q.h.y);
t = Math.min(t, q.j.y);
t = Math.min(t, r.y);
u = Math.max(u, q.d.x);
u = Math.max(u, q.f.x);
u = Math.max(u, q.h.x);
u = Math.max(u, q.j.x);
u = Math.max(u, r.x);
v = Math.max(v, q.d.y);
v = Math.max(v, q.f.y);
v = Math.max(v, q.h.y);
v = Math.max(v, q.j.y);
v = Math.max(v, r.y);
return new Rect(0, s, t, u - s, v - t);
}
j++;
}
return new Rect(0, 0, 0, 0, 0);
}
kt(a) {
if (this.yy != null && this.yy.cl && a == this.yy.othersIndex) {
return null;
}
if (this.ads != null) {
return this.ads.item(a);
}
return null;
}
eb(a, b, c, d, e) {
if (super.eb(a, b, c, d, e)) {
let f = typeCast(ProportionalCategoryAngleAxis.$, this.yy) !== null && this.yy.hasOthersCategory;
if (e && (this.adp == 1 || (this.adp == 2 && !f))) {
let g = this.yy;
let h = new ScalerParams(1, this.db.v4, this.wr, g.ch);
h.c = this.getEffectiveViewport1(this.cv);
let i = this.y4;
let j = new ScalerParams(1, this.db.v4, this.wr, i.ch);
j.c = this.getEffectiveViewport1(this.cv);
let k = this.z4;
for (let l = 0; l < this.dn.count; l++) {
let m = this.dn.item(l);
let n = NaN;
if (m != null) {
n = this.jb(m);
}
if (n == 0) {
let o = new SeriesPointOfInterest();
o.f = this.aa4(n, m, l, d, k, c, b, false);
o.b = ((() => {
let $ret = new DataContext();
$ret.item = m;
$ret.series = this;
return $ret;
})());
o.g = this.vf;
o.c = l;
if (this.g8) {
o.g = this.vm(l);
}
let p = false;
for (let q = 0; q < a.count; q++) {
if (o.c < a._inner[q].c) {
a.insert(q, o);
p = true;
break;
}
}
if (!p) {
a.add(o);
}
}
}
}
return true;
}
return false;
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p3(a, c, b);
return c.toArray();
}
p3(a, b, c) {
if (this.yz == 0) {
super.p3(a, b, c);
return;
}
let d = this.cv.by;
let e = this.cv.bx;
let f = this.getEffectiveViewport1(this.cv);
let g = this.wi(this.cv);
let h = this.y4.k5(e, d, f, g);
let i = { $type: Point_$type, x: 0.5, y: 0.5 };
let j = this.y4;
let k = Math.max(0, 0.5 * j.n6);
let l = k;
l = Math.max(l, h.minLength);
let m = this.yy.k8(d, e, f);
let n = this.yy != null && this.yy.cl;
let o = new CollisionRect(0, a);
for (let p = 0; p < this.yy.lk; p++) {
let q = typeCast(RadialBaseView.$, this.cv);
let r = q.cx.getBucket(p);
let s = this.aci(this.yy, d, e, f);
if (n) {
m = this.zz(p, d, e, f);
s = this.ach(p, this.yy, d, e, f);
if (isNaN_(s)) {
s = 0;
}
}
r[0] = this.yy.getScaledAngle(r[0]) + s;
let t = r[0];
let u = Math.min(this.y7.b.od(r[2]), h.maxLength);
let v = this.adt(d, e, f, t - (m * 0.5), t + (m * 0.5), l, u, i);
if (v.collidesWithHeavy(o)) {
if (c == 7 || c == 6) {
b.add(((() => {
let $ret = new ChartSelection();
$ret.series = this;
return $ret;
})()));
return;
}
if (c == 2 || c == 1) {
b.add(((() => {
let $ret = new ChartSelection();
$ret.item = this.dn.item(p);
return $ret;
})()));
}
else {
b.add(((() => {
let $ret = new ChartSelection();
$ret.item = this.dn.item(p);
$ret.series = this;
return $ret;
})()));
}
}
}
}
}
RadialPieSeries.$t = markType(RadialPieSeries, 'RadialPieSeries', AnchoredRadialSeries.$);
RadialPieSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialPieSeries, 'raisePropertyChanged', ['RadiusX:adu:ad3', [1, 2], 'RadiusY:adv:ad4', [1, 2]]);
return RadialPieSeries;
})();
/**
* @hidden
*/
export let RadialPieSeriesView = /*@__PURE__*/ (() => {
class RadialPieSeriesView extends AnchoredRadialSeriesView {
constructor(a) {
super(a);
this.c5 = null;
this.c6 = null;
this.c7 = null;
this.dc = new Path();
this.c5 = a;
this.c6 = ((() => {
let $ret = new Pool$1(Path.$);
$ret.create = runOn(this, this.dd);
$ret.activate = runOn(this, this.c8);
$ret.disactivate = runOn(this, this.da);
$ret.destroy = runOn(this, this.c9);
return $ret;
})());
}
au() {
super.au();
this.c7 = new List$1(Path.$, 0);
if (!this.q) {
this.cw.w9 = Defaults.c;
this.cw.jo = Defaults.i;
}
}
dd() {
let a = ((() => {
let $ret = new Path();
$ret.dataContext = ((() => {
let $ret = new DataContext();
$ret.series = this.e;
return $ret;
})());
return $ret;
})());
this.c7.add(a);
a._visibility = 1;
return a;
}
c8(a) {
a._visibility = 0;
}
da(a) {
a._visibility = 1;
}
c9(a) {
this.c7.remove(a);
}
bg(a, b) {
super.bg(a, b);
let c = a;
}
ac(a) {
return this.c7._inner[a];
}
ab(a) {
let b = this.c7._inner[a];
this.dc._visibility = b._visibility;
this.dc.an = b.an;
let c = this.bs(a);
this.dc._fill = c;
this.dc._stroke = c;
this.dc.ad = this.e.id;
return this.dc;
}
a8(a, b) {
super.a8(a, b);
if (a.d) {
for (let c = 0; c < this.c7.count; c++) {
let d = this.aa(c, b);
a.t(d);
}
}
}
db() {
this.as();
}
an(a) {
super.an(a);
let b = 0;
for (let c of fromEnum(this.c6.a)) {
this.e.bc.exportPathData(a, c, "slice" + b, ["Main", "Fill"]);
b++;
}
}
}
RadialPieSeriesView.$t = markType(RadialPieSeriesView, 'RadialPieSeriesView', AnchoredRadialSeriesView.$);
return RadialPieSeriesView;
})();