UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

378 lines (377 loc) 14.4 kB
/* 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_e0 = function () { return true; }; RadialColumnSeries.prototype.get_fl = function () { return true; }; RadialColumnSeries.prototype.jk = function () { if (!isNaN_(this.jj)) { return _super.prototype.jk.call(this); } return Defaults.h; }; RadialColumnSeries.prototype.ct = function () { return new RadialColumnSeriesView(this); }; RadialColumnSeries.prototype.q1 = function (a) { _super.prototype.q1.call(this, a); this.adr = a; }; RadialColumnSeries.prototype.ac = function () { _super.prototype.ac.call(this); this.rs(false); }; RadialColumnSeries.prototype.ra = function (a, b, c, d) { _super.prototype.ra.call(this, a, b, c, d); switch (b) { case RadialColumnSeries.$$p[0]: case RadialColumnSeries.$$p[1]: this.q3(); break; } }; RadialColumnSeries.prototype.preferredCategoryMode = function (a) { return a != null && a == this.y1 ? 2 : 0; }; RadialColumnSeries.prototype.o5 = function (a, b) { _super.prototype.o5.call(this, a, b); var c = b; if (a) { c.da.count = 0; } }; RadialColumnSeries.prototype.get_ee = function () { return true; }; RadialColumnSeries.prototype.iw = function () { return this.y1.k8(this.cw.b2, this.cw.b1, this.getEffectiveViewport1(this.cw)); }; RadialColumnSeries.prototype.abe = function (a, b) { _super.prototype.abe.call(this, a, b); var c = a.h; var d = b.b2; var e = b.b1; var f = this.getEffectiveViewport1(b); var g = this.wl(b); var h = this.y7.k5(e, d, f, g); var i = b; var j = this.y7; var k = Math.max(0, 0.5 * j.n6); k = Math.max(k, h.minLength * 0.9); var l = ViewportUtils.d(k, d, e, f); var m = this.y1.k8(d, e, f); var n = Math.max(0.1 * this.y7.n7, k); var o = this.za.d(0, n, d, e, f); var p = this.za.e(0, n, d, e, f); var q = this.za.d(m, n, d, e, f); var r = this.za.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.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; var v = false; var w = this.zi.b; if (w != null) { v = true; } var x = this.y1; var y = new ScalerParams(1, b.b2, b.b1, x.ch); 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.za.d(a.h._inner[z][0], aa, d, e, f); var ac = this.za.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.ac7(c, z, u, x, y, b.r); } var ag = this.zi.k; var ah = this.zi.l; var ai = a.h._inner[z][0] - (Math.PI / 2); var aj = i.da.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.zi.ad(aj, false, false, false, false); } i.da.count = c.count; this.adr.df(); }; RadialColumnSeries.prototype.ak = function (a, b) { var c = new List$1(ChartSelection.$, 0); this.p4(a, c, b); return c.toArray(); }; RadialColumnSeries.prototype.p4 = function (a, b, c) { var _this = this; if (this.y2 == 0) { _super.prototype.p4.call(this, a, b, c); return; } var d = this.cw.b2; var e = this.cw.b1; var f = this.getEffectiveViewport1(this.cw); var g = this.dc.wd(this.wu, this.getEffectiveViewport(), d); var h = this.y7.k5(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.wa(a); var k = new Clipper(1, j.left, j.bottom, j.right, j.top, true); var l = this.y7; var m = Math.max(0, 0.5 * l.n6); m = Math.max(m, h.minLength * 0.9); var n = ViewportUtils.d(m, d, e, f); var o = this.y1.k8(d, e, f); var p = Math.max(0.1 * this.y7.n7, m); var q = this.za.d(0, p, d, e, f); var r = this.za.e(0, p, d, e, f); var s = this.za.d(o, p, d, e, f); var t = this.za.e(o, p, d, e, f); var u = Math.sqrt((q - s) * (q - s) + (r - t) * (r - t)); var v = this.y1 != null && this.y1.cl; var _loop_1 = function (w) { var x = typeCast(RadialBaseView.$, this_1.cw); var y = x.c1.getBucket(w); var z = Math.min(this_1.za.b.od(y[2]), h.maxLength * 1.1); var aa = this_1.acl(this_1.y1, d, e, f); if (v) { aa = this_1.ack(w, this_1.y1, d, e, f); if (isNaN_(aa)) { aa = 0; } } y[0] = this_1.y1.getScaledAngle(y[0]) + aa; var ab = this_1.za.d(y[0], z, d, e, f); var ac = this_1.za.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.y1.lk; 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:ads:adw', [1, 0], 'RadiusY:adt:adx', [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.c9 = null; _this.da = null; _this.db = null; _this.dh = new Path(); _this.c9 = a; _this.da = ((function () { var $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; })()); return _this; } RadialColumnSeriesView.prototype.ax = function () { _super.prototype.ax.call(this); this.db = new List$1(Path.$, 0); if (!this.r) { this.c0.xc = Defaults.c; this.c0.jp = Defaults.i; } }; RadialColumnSeriesView.prototype.di = function () { var a = new Path(); this.db.add(a); a._visibility = 1; return a; }; RadialColumnSeriesView.prototype.dc = function (a) { a._visibility = 0; }; RadialColumnSeriesView.prototype.de = function (a) { a._visibility = 1; }; RadialColumnSeriesView.prototype.dd = function (a) { this.db.remove(a); }; RadialColumnSeriesView.prototype.dg = function (a, b, c, d, e, f) { this.av(); }; RadialColumnSeriesView.prototype.bk = function (a, b) { _super.prototype.bk.call(this, a, b); var c = a; }; RadialColumnSeriesView.prototype.bl = function (a, b) { _super.prototype.bl.call(this, a, b); var c = a; }; RadialColumnSeriesView.prototype.af = function (a) { return this.db._inner[a]; }; RadialColumnSeriesView.prototype.ae = function (a) { var b = this.db._inner[a]; this.dh._visibility = b._visibility; this.dh.an = b.an; var c = this.bw(a); this.dh._fill = c; this.dh._stroke = c; this.dh.ad = this.f.ie + 3; return this.dh; }; RadialColumnSeriesView.prototype.bc = function (a, b) { _super.prototype.bc.call(this, a, b); if (a.d) { for (var c = 0; c < this.db.count; c++) { var d = this.ad(c, b); this.bj(d, c, b); a.t(d); } } }; RadialColumnSeriesView.prototype.aq = function (a) { var e_1, _a; _super.prototype.aq.call(this, a); var b = 0; try { for (var _b = __values(fromEnum(this.da.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.df = function () { this.av(); }; RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$); return RadialColumnSeriesView; }(AnchoredRadialSeriesView)); export { RadialColumnSeriesView };