igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
378 lines (377 loc) • 14.4 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 { __extends, __values } from "tslib";
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
*/
var RadialColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(RadialColumnSeries, _super);
function RadialColumnSeries() {
var _this = _super.call(this) || this;
_this.ab = RadialColumnSeries.$;
return _this;
}
RadialColumnSeries.prototype.bk = function () {
return new RadialColumnSeries();
};
RadialColumnSeries.prototype.get_e1 = function () {
return true;
};
RadialColumnSeries.prototype.get_fm = function () {
return true;
};
RadialColumnSeries.prototype.jn = function () {
if (!isNaN_(this.jm)) {
return _super.prototype.jn.call(this);
}
return Defaults.h;
};
RadialColumnSeries.prototype.ct = function () {
return new RadialColumnSeriesView(this);
};
RadialColumnSeries.prototype.q8 = function (a) {
_super.prototype.q8.call(this, a);
this.ady = a;
};
RadialColumnSeries.prototype.ac = function () {
_super.prototype.ac.call(this);
this.rz(false);
};
RadialColumnSeries.prototype.rh = function (a, b, c, d) {
_super.prototype.rh.call(this, a, b, c, d);
switch (b) {
case RadialColumnSeries.$$p[0]:
case RadialColumnSeries.$$p[1]:
this.ra();
break;
}
};
RadialColumnSeries.prototype.preferredCategoryMode = function (a) {
return a != null && a == this.za ? 2 : 0;
};
RadialColumnSeries.prototype.pb = function (a, b) {
_super.prototype.pb.call(this, a, b);
var c = b;
if (a) {
c.dj.count = 0;
}
};
RadialColumnSeries.prototype.get_ef = function () {
return true;
};
RadialColumnSeries.prototype.iy = function () {
return this.za.ou(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
};
RadialColumnSeries.prototype.abl = function (a, b) {
_super.prototype.abl.call(this, a, b);
var c = a.h;
var d = b.ca;
var e = b.b9;
var f = this.getEffectiveViewport1(b);
var g = this.wu(b);
var h = this.zg.or(e, d, f, g);
var i = b;
var j = this.zg;
var k = Math.max(0, 0.5 * j.sa);
k = Math.max(k, h.minLength * 0.9);
var l = ViewportUtils.d(k, d, e, f);
var m = this.za.ou(d, e, f);
var n = Math.max(0.1 * this.zg.sb, k);
var o = this.zh.d(0, n, d, e, f);
var p = this.zh.e(0, n, d, e, f);
var q = this.zh.d(m, n, d, e, f);
var r = this.zh.e(m, n, d, e, f);
var s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
var t = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
var u = this.ach.count;
this.zp.a2(this, this.z6(), runOn(this, this.yy), this.aaf(b), this.aag(b));
this.zp.r = this.adz;
this.zp.s = this.ad0;
this.zp.k = this.adz;
this.zp.l = this.ad0;
var v = false;
var w = this.zp.b;
if (w != null) {
v = true;
}
var x = this.za;
var y = new ScalerParams(1, b.ca, b.b9, x.df);
y.c = this.getEffectiveViewport();
for (var z = 0; z < c.count; ++z) {
var aa = Math.min(a.h._inner[z][2], h.maxLength * 1.1);
var ab = this.zh.d(a.h._inner[z][0], aa, d, e, f);
var ac = this.zh.e(a.h._inner[z][0], aa, d, e, f);
var ad = Math.sqrt((ab - t.x) * (ab - t.x) + (ac - t.y) * (ac - t.y));
var ae = ad;
var af = l;
if (v) {
this.ade(c, z, u, x, y, b.t);
}
var ag = this.zp.k;
var ah = this.zp.l;
var ai = a.h._inner[z][0] - (Math.PI / 2);
var aj = i.dj.item(z);
var ak = 0 - (s / 2);
var al = (s / 2);
var am = Math.max(af, ae);
var an = Math.min(af, ae);
var ao = Math.cos(ai);
var ap = Math.sin(ai);
var aq = { $type: Point_$type, x: t.x + (ak * ao - am * ap), y: t.y + (ak * ap + am * ao) };
var ar = { $type: Point_$type, x: t.x + (al * ao - am * ap), y: t.y + (al * ap + am * ao) };
var as = { $type: Point_$type, x: t.x + (al * ao - an * ap), y: t.y + (al * ap + an * ao) };
var at = { $type: Point_$type, x: t.x + (ak * ao - an * ap), y: t.y + (ak * ap + an * ao) };
var au = new PathGeometry();
var av = new PathFigure();
av._startPoint = aq;
av._isClosed = true;
var 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.zp.ad(aj, false, false, false, false);
}
i.dj.count = c.count;
this.ady.dp();
};
RadialColumnSeries.prototype.ak = function (a, b) {
var c = new List$1(ChartSelection.$, 0);
this.qa(a, c, b);
return c.toArray();
};
RadialColumnSeries.prototype.qa = function (a, b, c) {
var _this = this;
if (this.zb == 0) {
_super.prototype.qa.call(this, a, b, c);
return;
}
var d = this.cw.ca;
var e = this.cw.b9;
var f = this.getEffectiveViewport1(this.cw);
var g = this.dc.xv(this.w3, this.getEffectiveViewport(), d);
var h = this.zg.or(e, d, f, g);
var i = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
var j = this.dc.xs(a);
var k = new Clipper(1, j.left, j.bottom, j.right, j.top, true);
var l = this.zg;
var m = Math.max(0, 0.5 * l.sa);
m = Math.max(m, h.minLength * 0.9);
var n = ViewportUtils.d(m, d, e, f);
var o = this.za.ou(d, e, f);
var p = Math.max(0.1 * this.zg.sb, m);
var q = this.zh.d(0, p, d, e, f);
var r = this.zh.e(0, p, d, e, f);
var s = this.zh.d(o, p, d, e, f);
var t = this.zh.e(o, p, d, e, f);
var u = Math.sqrt((q - s) * (q - s) + (r - t) * (r - t));
var v = this.za != null && this.za.dj;
var _loop_1 = function (w) {
var x = typeCast(RadialBaseView.$, this_1.cw);
var y = x.da.getBucket(w);
var z = Math.min(this_1.zh.b.sh(y[2]), h.maxLength * 1.1);
var aa = this_1.acs(this_1.za, d, e, f);
if (v) {
aa = this_1.acr(w, this_1.za, d, e, f);
if (isNaN_(aa)) {
aa = 0;
}
}
y[0] = this_1.za.getScaledAngle(y[0]) + aa;
var ab = this_1.zh.d(y[0], z, d, e, f);
var ac = this_1.zh.e(y[0], z, d, e, f);
var ad = Math.sqrt((ab - i.x) * (ab - i.x) + (ac - i.y) * (ac - i.y));
var ae = ad;
var af = n;
var ag = y[0] - (Math.PI / 2);
var ah = 0 - (u / 2);
var ai = (u / 2);
var aj = Math.max(af, ae);
var ak = Math.min(af, ae);
var al = Math.cos(ag);
var am = Math.sin(ag);
var an = { $type: Point_$type, x: i.x + (ah * al - aj * am), y: i.y + (ah * am + aj * al) };
var ao = { $type: Point_$type, x: i.x + (ai * al - aj * am), y: i.y + (ai * am + aj * al) };
var ap = { $type: Point_$type, x: i.x + (ai * al - ak * am), y: i.y + (ai * am + ak * al) };
var aq = { $type: Point_$type, x: i.x + (ah * al - ak * am), y: i.y + (ah * am + ak * al) };
var 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) {
return "continue";
}
if (c == 7 || c == 6) {
b.add(((function () {
var $ret = new ChartSelection();
$ret.series = _this;
return $ret;
})()));
return { value: void 0 };
}
else if (c == 2 || c == 1) {
b.add(((function () {
var $ret = new ChartSelection();
$ret.item = _this.dp.item(w);
return $ret;
})()));
}
else {
b.add(((function () {
var $ret = new ChartSelection();
$ret.item = _this.dp.item(w);
$ret.series = _this;
return $ret;
})()));
}
};
var this_1 = this;
for (var w = 0; w < this.za.o6; w++) {
var state_1 = _loop_1(w);
if (typeof state_1 === "object")
return state_1.value;
}
};
RadialColumnSeries.$t = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:adz:ad3', [1, 0], 'RadiusY:ad0:ad4', [1, 0]]);
return RadialColumnSeries;
}(AnchoredRadialSeries));
export { RadialColumnSeries };
/**
* @hidden
*/
var RadialColumnSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(RadialColumnSeriesView, _super);
function RadialColumnSeriesView(a) {
var _this = _super.call(this, a) || this;
_this.di = null;
_this.dj = null;
_this.dk = null;
_this.dr = new Path();
_this.di = a;
_this.dj = ((function () {
var $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;
})());
return _this;
}
RadialColumnSeriesView.prototype.a4 = function () {
_super.prototype.a4.call(this);
this.dk = new List$1(Path.$, 0);
if (!this.t) {
this.c9.xl = Defaults.c;
this.c9.jt = Defaults.i;
}
};
RadialColumnSeriesView.prototype.ds = function () {
var a = new Path();
this.dk.add(a);
a._visibility = 1;
return a;
};
RadialColumnSeriesView.prototype.dl = function (a) {
a._visibility = 0;
};
RadialColumnSeriesView.prototype.dn = function (a) {
a._visibility = 1;
};
RadialColumnSeriesView.prototype.dm = function (a) {
this.dk.remove(a);
};
RadialColumnSeriesView.prototype.dq = function (a, b, c, d, e, f) {
this.a2();
};
RadialColumnSeriesView.prototype.bs = function (a, b) {
_super.prototype.bs.call(this, a, b);
var c = a;
};
RadialColumnSeriesView.prototype.bt = function (a, b) {
_super.prototype.bt.call(this, a, b);
var c = a;
};
RadialColumnSeriesView.prototype.ak = function (a) {
return this.dk._inner[a];
};
RadialColumnSeriesView.prototype.aj = function (a) {
var b = this.dk._inner[a];
this.dr._visibility = b._visibility;
this.dr.an = b.an;
var c = this.b4(a);
this.dr._fill = c;
this.dr._stroke = c;
this.dr.ad = this.f.ig + 3;
return this.dr;
};
RadialColumnSeriesView.prototype.bj = function (a, b) {
_super.prototype.bj.call(this, a, b);
if (a.d) {
for (var c = 0; c < this.dk.count; c++) {
var d = this.ai(c, b);
this.br(d, c, b);
a.t(d);
}
}
};
RadialColumnSeriesView.prototype.ax = function (a) {
var e_1, _a;
_super.prototype.ax.call(this, a);
var b = 0;
try {
for (var _b = __values(fromEnum(this.dj.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
this.f.bc.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
b++;
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
};
RadialColumnSeriesView.prototype.dp = function () {
this.a2();
};
RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
return RadialColumnSeriesView;
}(AnchoredRadialSeriesView));
export { RadialColumnSeriesView };