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_e0() {
return true;
}
get_fl() {
return true;
}
jk() {
if (!isNaN_(this.jj)) {
return super.jk();
}
return Defaults.h;
}
ct() {
return new RadialColumnSeriesView(this);
}
q1(a) {
super.q1(a);
this.adr = a;
}
constructor() {
super();
this.ab = RadialColumnSeries.$;
}
ac() {
super.ac();
this.rs(false);
}
ra(a, b, c, d) {
super.ra(a, b, c, d);
switch (b) {
case RadialColumnSeries.$$p[0]:
case RadialColumnSeries.$$p[1]:
this.q3();
break;
}
}
preferredCategoryMode(a) {
return a != null && a == this.y1 ? 2 : 0;
}
o5(a, b) {
super.o5(a, b);
let c = b;
if (a) {
c.da.count = 0;
}
}
get_ee() {
return true;
}
iw() {
return this.y1.k8(this.cw.b2, this.cw.b1, this.getEffectiveViewport1(this.cw));
}
abe(a, b) {
super.abe(a, b);
let c = a.h;
let d = b.b2;
let e = b.b1;
let f = this.getEffectiveViewport1(b);
let g = this.wl(b);
let h = this.y7.k5(e, d, f, g);
let i = b;
let j = this.y7;
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.y1.k8(d, e, f);
let n = Math.max(0.1 * this.y7.n7, k);
let o = this.za.d(0, n, d, e, f);
let p = this.za.e(0, n, d, e, f);
let q = this.za.d(m, n, d, e, f);
let r = this.za.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.aca.count;
this.zi.a2(this, this.zz(), runOn(this, this.yp), this.z8(b), this.z9(b));
this.zi.r = this.ads;
this.zi.s = this.adt;
this.zi.k = this.ads;
this.zi.l = this.adt;
let v = false;
let w = this.zi.b;
if (w != null) {
v = true;
}
let x = this.y1;
let y = new ScalerParams(1, b.b2, b.b1, 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.za.d(a.h._inner[z][0], aa, d, e, f);
let ac = this.za.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.ac7(c, z, u, x, y, b.r);
}
let ag = this.zi.k;
let ah = this.zi.l;
let ai = a.h._inner[z][0] - (Math.PI / 2);
let aj = i.da.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.zi.ad(aj, false, false, false, false);
}
i.da.count = c.count;
this.adr.df();
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p4(a, c, b);
return c.toArray();
}
p4(a, b, c) {
if (this.y2 == 0) {
super.p4(a, b, c);
return;
}
let d = this.cw.b2;
let e = this.cw.b1;
let f = this.getEffectiveViewport1(this.cw);
let g = this.dc.wd(this.wu, this.getEffectiveViewport(), d);
let h = this.y7.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.wa(a);
let k = new Clipper(1, j.left, j.bottom, j.right, j.top, true);
let l = this.y7;
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.y1.k8(d, e, f);
let p = Math.max(0.1 * this.y7.n7, m);
let q = this.za.d(0, p, d, e, f);
let r = this.za.e(0, p, d, e, f);
let s = this.za.d(o, p, d, e, f);
let t = this.za.e(o, p, d, e, f);
let u = Math.sqrt((q - s) * (q - s) + (r - t) * (r - t));
let v = this.y1 != null && this.y1.cl;
for (let w = 0; w < this.y1.lk; w++) {
let x = typeCast(RadialBaseView.$, this.cw);
let y = x.c1.getBucket(w);
let z = Math.min(this.za.b.od(y[2]), h.maxLength * 1.1);
let aa = this.acl(this.y1, d, e, f);
if (v) {
aa = this.ack(w, this.y1, d, e, f);
if (isNaN_(aa)) {
aa = 0;
}
}
y[0] = this.y1.getScaledAngle(y[0]) + aa;
let ab = this.za.d(y[0], z, d, e, f);
let ac = this.za.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:ads:adw', [1, 0], 'RadiusY:adt:adx', [1, 0]]);
return RadialColumnSeries;
})();
/**
* @hidden
*/
export let RadialColumnSeriesView = /*@__PURE__*/ (() => {
class RadialColumnSeriesView extends AnchoredRadialSeriesView {
constructor(a) {
super(a);
this.c9 = null;
this.da = null;
this.db = null;
this.dh = new Path();
this.c9 = a;
this.da = ((() => {
let $ret = new Pool$1(Path.$);
$ret.create = runOn(this, this.di);
$ret.activate = runOn(this, this.dc);
$ret.disactivate = runOn(this, this.de);
$ret.destroy = runOn(this, this.dd);
return $ret;
})());
}
ax() {
super.ax();
this.db = new List$1(Path.$, 0);
if (!this.r) {
this.c0.xc = Defaults.c;
this.c0.jp = Defaults.i;
}
}
di() {
let a = new Path();
this.db.add(a);
a._visibility = 1;
return a;
}
dc(a) {
a._visibility = 0;
}
de(a) {
a._visibility = 1;
}
dd(a) {
this.db.remove(a);
}
dg(a, b, c, d, e, f) {
this.av();
}
bk(a, b) {
super.bk(a, b);
let c = a;
}
bl(a, b) {
super.bl(a, b);
let c = a;
}
af(a) {
return this.db._inner[a];
}
ae(a) {
let b = this.db._inner[a];
this.dh._visibility = b._visibility;
this.dh.an = b.an;
let c = this.bw(a);
this.dh._fill = c;
this.dh._stroke = c;
this.dh.ad = this.f.ie + 3;
return this.dh;
}
bc(a, b) {
super.bc(a, b);
if (a.d) {
for (let c = 0; c < this.db.count; c++) {
let d = this.ad(c, b);
this.bj(d, c, b);
a.t(d);
}
}
}
aq(a) {
super.aq(a);
let b = 0;
for (let c of fromEnum(this.da.a)) {
this.f.bc.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
b++;
}
}
df() {
this.av();
}
}
RadialColumnSeriesView.$t = /*@__PURE__*/ markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
return RadialColumnSeriesView;
})();