igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
351 lines (350 loc) • 13.1 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-react-core";
import { Defaults } from "./Defaults";
import { Point_$type, runOn, typeCast, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { RadialBaseView } from "./RadialBaseView";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-react-core";
import { PathFigure } from "igniteui-react-core";
import { PolyLineSegment } from "igniteui-react-core";
import { ViewportUtils } from "./ViewportUtils";
import { ChartSelection } from "./ChartSelection";
import { Clipper } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
/**
* @hidden
*/
export let RadialColumnSeries = /*@__PURE__*/ (() => {
class RadialColumnSeries extends AnchoredRadialSeries {
bk() {
return new RadialColumnSeries();
}
get_e1() {
return true;
}
get_fm() {
return true;
}
jl() {
if (!isNaN_(this.jk)) {
return super.jl();
}
return Defaults.h;
}
ct() {
return new RadialColumnSeriesView(this);
}
q3(a) {
super.q3(a);
this.ads = a;
}
constructor() {
super();
this.ab = RadialColumnSeries.$;
}
ac() {
super.ac();
this.ru(false);
}
rc(a, b, c, d) {
super.rc(a, b, c, d);
switch (b) {
case RadialColumnSeries.$$p[0]:
case RadialColumnSeries.$$p[1]:
this.q5();
break;
}
}
preferredCategoryMode(a) {
return a != null && a == this.y4 ? 2 : 0;
}
o7(a, b) {
super.o7(a, b);
let c = b;
if (a) {
c.dj.count = 0;
}
}
get_ef() {
return true;
}
ix() {
return this.y4.k8(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
}
abf(a, b) {
super.abf(a, b);
let c = a.h;
let d = b.ca;
let e = b.b9;
let f = this.getEffectiveViewport1(b);
let g = this.wo(b);
let h = this.za.k5(e, d, f, g);
let i = b;
let j = this.za;
let k = Math.max(0, 0.5 * j.n6);
k = Math.max(k, h.minLength * 0.9);
let l = ViewportUtils.d(k, d, e, f);
let m = this.y4.k8(d, e, f);
let n = Math.max(0.1 * this.za.n7, k);
let o = this.zb.d(0, n, d, e, f);
let p = this.zb.e(0, n, d, e, f);
let q = this.zb.d(m, n, d, e, f);
let r = this.zb.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.acb.count;
this.zj.a2(this, this.z0(), runOn(this, this.ys), this.z9(b), this.aaa(b));
this.zj.r = this.adt;
this.zj.s = this.adu;
this.zj.k = this.adt;
this.zj.l = this.adu;
let v = false;
let w = this.zj.b;
if (w != null) {
v = true;
}
let x = this.y4;
let y = new ScalerParams(1, b.ca, b.b9, x.ch);
y.c = this.getEffectiveViewport();
for (let z = 0; z < c.count; ++z) {
let aa = Math.min(a.h._inner[z][2], h.maxLength * 1.1);
let ab = this.zb.d(a.h._inner[z][0], aa, d, e, f);
let ac = this.zb.e(a.h._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.ac8(c, z, u, x, y, b.t);
}
let ag = this.zj.k;
let ah = this.zj.l;
let ai = a.h._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.zj.ad(aj, false, false, false, false);
}
i.dj.count = c.count;
this.ads.dp();
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p6(a, c, b);
return c.toArray();
}
p6(a, b, c) {
if (this.y5 == 0) {
super.p6(a, b, c);
return;
}
let d = this.cw.ca;
let e = this.cw.b9;
let f = this.getEffectiveViewport1(this.cw);
let g = this.dc.w1(this.wx, this.getEffectiveViewport(), d);
let h = this.za.k5(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.wy(a);
let k = new Clipper(1, j.left, j.bottom, j.right, j.top, true);
let l = this.za;
let m = Math.max(0, 0.5 * l.n6);
m = Math.max(m, h.minLength * 0.9);
let n = ViewportUtils.d(m, d, e, f);
let o = this.y4.k8(d, e, f);
let p = Math.max(0.1 * this.za.n7, m);
let q = this.zb.d(0, p, d, e, f);
let r = this.zb.e(0, p, d, e, f);
let s = this.zb.d(o, p, d, e, f);
let t = this.zb.e(o, p, d, e, f);
let u = Math.sqrt((q - s) * (q - s) + (r - t) * (r - t));
let v = this.y4 != null && this.y4.cl;
for (let w = 0; w < this.y4.lk; w++) {
let x = typeCast(RadialBaseView.$, this.cw);
let y = x.da.getBucket(w);
let z = Math.min(this.zb.b.od(y[2]), h.maxLength * 1.1);
let aa = this.acm(this.y4, d, e, f);
if (v) {
aa = this.acl(w, this.y4, d, e, f);
if (isNaN_(aa)) {
aa = 0;
}
}
y[0] = this.y4.getScaledAngle(y[0]) + aa;
let ab = this.zb.d(y[0], z, d, e, f);
let ac = this.zb.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 = /*@__PURE__*/ markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
RadialColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:adt:adx', [1, 0], 'RadiusY:adu:ady', [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.xf = Defaults.c;
this.c9.jq = 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.ig + 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 = /*@__PURE__*/ markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
return RadialColumnSeriesView;
})();