igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
428 lines (427 loc) • 16.8 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 { Defaults } from "./Defaults";
import { Point_$type, runOn, typeCast, markType, markDep, fromEnum } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
import { CoreGeometryUtil } from "igniteui-angular-core";
import { PolygonUtil } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { RadialBaseView } from "./RadialBaseView";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { PolyLineSegment } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { Clipper } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
/**
* @hidden
*/
export let RadialColumnSeries = /*@__PURE__*/ (() => {
class RadialColumnSeries extends AnchoredRadialSeries {
constructor() {
super();
this.ab = RadialColumnSeries.$;
}
bk() {
return new RadialColumnSeries();
}
get_e2() {
return true;
}
get_fo() {
return true;
}
js() {
if (!isNaN_(this.jr)) {
return super.js();
}
return Defaults.h;
}
ct() {
return new RadialColumnSeriesView(this);
}
rg(a) {
super.rg(a);
this.ad8 = a;
}
ac() {
super.ac();
this.r7(false);
}
rp(a, b, c, d) {
super.rp(a, b, c, d);
switch (b) {
case RadialColumnSeries.$$p[0]:
case RadialColumnSeries.$$p[1]:
this.ri();
break;
}
}
g2(a, b) {
if (this.g5(a, b)) {
return true;
}
if (this.x1(a, b)) {
return true;
}
return false;
}
g5(a, b) {
let c = this.zt();
let d = this.cw.ca;
let e = this.cw.b9;
let f = this.cw.getEffectiveViewport();
let g = this.w3(this.cw);
let h = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
let i = this.zp;
let j = this.zp.pt(e, d, f, g);
let k = Math.max(0, 0.5 * i.tc);
k = Math.max(k, j.minLength * 0.9);
let l = ViewportUtils.d(k, d, e, f);
let m = this.zj.pw(d, e, f);
let n = Math.max(0.1 * this.zp.td, k);
let o = this.zq.d(0, n, d, e, f);
let p = this.zq.e(0, n, d, e, f);
let q = this.zq.d(m, n, d, e, f);
let r = this.zq.e(m, n, d, e, f);
let s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
let t = this.i1(b) + (this.il / 2);
let u = this.an(this.a0(), c.k, this.aap(this.cw), this.aaq(this.cw), this.w1(a), true);
if (u == null) {
return false;
}
for (let v = 0; v < u.length; v++) {
let w = Math.min(u[v][2], j.maxLength * 1.1);
let x = this.zq.d(u[v][0], w, d, e, f);
let y = this.zq.e(u[v][0], w, d, e, f);
let z = Math.sqrt((x - h.x) * (x - h.x) + (y - h.y) * (y - h.y));
let aa = z;
let ab = l;
let ac = u[v][0] - (Math.PI / 2);
let ad = 0 - (s / 2);
let ae = (s / 2);
let af = Math.max(ab, aa);
let ag = Math.min(ab, aa);
let ah = Math.cos(ac);
let ai = Math.sin(ac);
let aj = new List$1(Point_$type, 0);
let ak = { $type: Point_$type, x: h.x + (ad * ah - af * ai), y: h.y + (ad * ai + af * ah) };
let al = { $type: Point_$type, x: h.x + (ae * ah - af * ai), y: h.y + (ae * ai + af * ah) };
let am = { $type: Point_$type, x: h.x + (ae * ah - ag * ai), y: h.y + (ae * ai + ag * ah) };
let an = { $type: Point_$type, x: h.x + (ad * ah - ag * ai), y: h.y + (ad * ai + ag * ah) };
aj.add(ak);
aj.add(al);
aj.add(am);
aj.add(an);
aj.add(ak);
if (CoreGeometryUtil.i(a, ak, al, t)) {
return true;
}
if (CoreGeometryUtil.i(a, al, am, t)) {
return true;
}
if (CoreGeometryUtil.i(a, am, an, t)) {
return true;
}
if (CoreGeometryUtil.i(a, an, ak, t)) {
return true;
}
if (PolygonUtil.b(aj, a)) {
return true;
}
}
return false;
}
preferredCategoryMode(a) {
return a != null && a == this.zj ? 2 : 0;
}
ph(a, b) {
super.ph(a, b);
let c = b;
if (a) {
c.dj.count = 0;
}
}
get_ef() {
return true;
}
i3() {
return this.zj.pw(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
}
abv(a, b) {
super.abv(a, b);
let c = a.k;
let d = b.ca;
let e = b.b9;
let f = this.getEffectiveViewport1(b);
let g = this.w3(b);
let h = this.zp.pt(e, d, f, g);
let i = b;
let j = this.zp;
let k = Math.max(0, 0.5 * j.tc);
k = Math.max(k, h.minLength * 0.9);
let l = ViewportUtils.d(k, d, e, f);
let m = this.zj.pw(d, e, f);
let n = Math.max(0.1 * this.zp.td, k);
let o = this.zq.d(0, n, d, e, f);
let p = this.zq.e(0, n, d, e, f);
let q = this.zq.d(m, n, d, e, f);
let r = this.zq.e(m, n, d, e, f);
let s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
let t = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
let u = this.acr.count;
this.zy.a2(this, this.aaf(), runOn(this, this.y7), this.aap(b), this.aaq(b));
this.zy.r = this.ad9;
this.zy.s = this.aea;
this.zy.k = this.ad9;
this.zy.l = this.aea;
let v = false;
let w = this.zy.b;
if (w != null) {
v = true;
}
let x = this.zj;
let y = new ScalerParams(1, b.ca, b.b9, x.dn);
y.c = this.getEffectiveViewport();
for (let z = 0; z < c.count; ++z) {
let aa = Math.min(a.k._inner[z][2], h.maxLength * 1.1);
let ab = this.zq.d(a.k._inner[z][0], aa, d, e, f);
let ac = this.zq.e(a.k._inner[z][0], aa, d, e, f);
let ad = Math.sqrt((ab - t.x) * (ab - t.x) + (ac - t.y) * (ac - t.y));
let ae = ad;
let af = l;
if (v) {
this.ado(c, z, u, x, y, b.t);
}
let ag = this.zy.k;
let ah = this.zy.l;
let ai = a.k._inner[z][0] - (Math.PI / 2);
let aj = i.dj.item(z);
let ak = 0 - (s / 2);
let al = (s / 2);
let am = Math.max(af, ae);
let an = Math.min(af, ae);
let ao = Math.cos(ai);
let ap = Math.sin(ai);
let aq = { $type: Point_$type, x: t.x + (ak * ao - am * ap), y: t.y + (ak * ap + am * ao) };
let ar = { $type: Point_$type, x: t.x + (al * ao - am * ap), y: t.y + (al * ap + am * ao) };
let as = { $type: Point_$type, x: t.x + (al * ao - an * ap), y: t.y + (al * ap + an * ao) };
let at = { $type: Point_$type, x: t.x + (ak * ao - an * ap), y: t.y + (ak * ap + an * ao) };
let au = new PathGeometry();
let av = new PathFigure();
av._startPoint = aq;
av._isClosed = true;
let aw = new PolyLineSegment();
aw._points.add(ar);
aw._points.add(as);
aw._points.add(at);
av._segments.add(aw);
au.c.add(av);
aj.an = au;
this.zy.ad(aj, false, false, false, false);
}
i.dj.count = c.count;
this.ad8.dp();
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.qh(a, c, b);
return c.toArray();
}
qh(a, b, c) {
if (this.zk == 0) {
super.qh(a, b, c);
return;
}
let d = this.cw.ca;
let e = this.cw.b9;
let f = this.getEffectiveViewport1(this.cw);
let g = this.dc.yz(this.xc, this.getEffectiveViewport(), d);
let h = this.zp.pt(e, d, f, g);
let i = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
let j = this.dc.yw(a);
let k = new Clipper(1, j.left, j.bottom, j.right, j.top, true);
let l = this.zp;
let m = Math.max(0, 0.5 * l.tc);
m = Math.max(m, h.minLength * 0.9);
let n = ViewportUtils.d(m, d, e, f);
let o = this.zj.pw(d, e, f);
let p = Math.max(0.1 * this.zp.td, m);
let q = this.zq.d(0, p, d, e, f);
let r = this.zq.e(0, p, d, e, f);
let s = this.zq.d(o, p, d, e, f);
let t = this.zq.e(o, p, d, e, f);
let u = Math.sqrt((q - s) * (q - s) + (r - t) * (r - t));
let v = this.zj != null && this.zj.ds;
for (let w = 0; w < this.zj.p8; w++) {
let x = typeCast(RadialBaseView.$, this.cw);
let y = x.da.getBucket(w);
let z = Math.min(this.zq.b.tj(y[2]), h.maxLength * 1.1);
let aa = this.ac2(this.zj, d, e, f);
if (v) {
aa = this.ac1(w, this.zj, d, e, f);
if (isNaN_(aa)) {
aa = 0;
}
}
y[0] = this.zj.getScaledAngle(y[0]) + aa;
let ab = this.zq.d(y[0], z, d, e, f);
let ac = this.zq.e(y[0], z, d, e, f);
let ad = Math.sqrt((ab - i.x) * (ab - i.x) + (ac - i.y) * (ac - i.y));
let ae = ad;
let af = n;
let ag = y[0] - (Math.PI / 2);
let ah = 0 - (u / 2);
let ai = (u / 2);
let aj = Math.max(af, ae);
let ak = Math.min(af, ae);
let al = Math.cos(ag);
let am = Math.sin(ag);
let an = { $type: Point_$type, x: i.x + (ah * al - aj * am), y: i.y + (ah * am + aj * al) };
let ao = { $type: Point_$type, x: i.x + (ai * al - aj * am), y: i.y + (ai * am + aj * al) };
let ap = { $type: Point_$type, x: i.x + (ai * al - ak * am), y: i.y + (ai * am + ak * al) };
let aq = { $type: Point_$type, x: i.x + (ah * al - ak * am), y: i.y + (ah * am + ak * al) };
let ar = new List$1(Point_$type, 0);
k.i = ar;
k.j(an);
k.j(ao);
k.j(ap);
k.j(aq);
k.i = null;
if (ar == null || ar.count == 0) {
continue;
}
if (c == 7 || c == 6) {
b.add(((() => {
let $ret = new ChartSelection();
$ret.series = this;
return $ret;
})()));
return;
}
else if (c == 2 || c == 1) {
b.add(((() => {
let $ret = new ChartSelection();
$ret.item = this.dp.item(w);
return $ret;
})()));
}
else {
b.add(((() => {
let $ret = new ChartSelection();
$ret.item = this.dp.item(w);
$ret.series = this;
return $ret;
})()));
}
}
}
}
RadialColumnSeries.$t = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:ad9:aed', [1, 0], 'RadiusY:aea:aee', [1, 0]]);
return RadialColumnSeries;
})();
/**
* @hidden
*/
export let RadialColumnSeriesView = /*@__PURE__*/ (() => {
class RadialColumnSeriesView extends AnchoredRadialSeriesView {
constructor(a) {
super(a);
this.di = null;
this.dj = null;
this.dk = null;
this.dr = new Path();
this.di = a;
this.dj = ((() => {
let $ret = new Pool$1(Path.$);
$ret.create = runOn(this, this.ds);
$ret.activate = runOn(this, this.dl);
$ret.disactivate = runOn(this, this.dn);
$ret.destroy = runOn(this, this.dm);
return $ret;
})());
}
a4() {
super.a4();
this.dk = new List$1(Path.$, 0);
if (!this.t) {
this.c9.xu = Defaults.c;
this.c9.jy = Defaults.i;
}
}
ds() {
let a = new Path();
this.dk.add(a);
a._visibility = 1;
return a;
}
dl(a) {
a._visibility = 0;
}
dn(a) {
a._visibility = 1;
}
dm(a) {
this.dk.remove(a);
}
dq(a, b, c, d, e, f) {
this.a2();
}
bs(a, b) {
super.bs(a, b);
let c = a;
}
bt(a, b) {
super.bt(a, b);
let c = a;
}
ak(a) {
return this.dk._inner[a];
}
aj(a) {
let b = this.dk._inner[a];
this.dr._visibility = b._visibility;
this.dr.an = b.an;
let c = this.b4(a);
this.dr._fill = c;
this.dr._stroke = c;
this.dr.ad = this.f.il + 3;
return this.dr;
}
bj(a, b) {
super.bj(a, b);
if (a.d) {
for (let c = 0; c < this.dk.count; c++) {
let d = this.ai(c, b);
this.br(d, c, b);
a.t(d);
}
}
}
ax(a) {
super.ax(a);
let b = 0;
for (let c of fromEnum(this.dj.a)) {
this.f.bc.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
b++;
}
}
dp() {
this.a2();
}
}
RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
return RadialColumnSeriesView;
})();