igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
377 lines (376 loc) • 14.7 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-angular-core";
import { Defaults } from "./Defaults";
import { Point_$type, runOn, typeCast, markType, markDep, fromEnum } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { RadialBaseView } from "./RadialBaseView";
import { List$1 } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { PolyLineSegment } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
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
*/
var RadialColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(RadialColumnSeries, _super);
function RadialColumnSeries() {
var _this = _super.call(this) || this;
_this.ab = RadialColumnSeries.$;
return _this;
}
RadialColumnSeries.prototype.bj = function () {
return new RadialColumnSeries();
};
RadialColumnSeries.prototype.get_ez = 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.cs = function () {
return new RadialColumnSeriesView(this);
};
RadialColumnSeries.prototype.q1 = function (a) {
_super.prototype.q1.call(this, a);
this.adp = a;
};
RadialColumnSeries.prototype.ac = function () {
_super.prototype.ac.call(this);
this.rr(false);
};
RadialColumnSeries.prototype.q9 = function (a, b, c, d) {
_super.prototype.q9.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.yz ? 2 : 0;
};
RadialColumnSeries.prototype.o5 = function (a, b) {
_super.prototype.o5.call(this, a, b);
var c = b;
if (a) {
c.c6.count = 0;
}
};
RadialColumnSeries.prototype.get_ed = function () {
return true;
};
RadialColumnSeries.prototype.iw = function () {
return this.yz.k8(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
};
RadialColumnSeries.prototype.abc = function (a, b) {
_super.prototype.abc.call(this, a, b);
var c = a.f;
var d = b.by;
var e = b.bx;
var f = this.getEffectiveViewport1(b);
var g = this.wj(b);
var h = this.y5.k5(e, d, f, g);
var i = b;
var j = this.y5;
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.yz.k8(d, e, f);
var n = Math.max(0.1 * this.y5.n7, k);
var o = this.y8.d(0, n, d, e, f);
var p = this.y8.e(0, n, d, e, f);
var q = this.y8.d(m, n, d, e, f);
var r = this.y8.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.ab8.count;
this.zg.a2(this, this.zx(), runOn(this, this.yn), this.z6(b), this.z7(b));
this.zg.r = this.adq;
this.zg.s = this.adr;
this.zg.k = this.adq;
this.zg.l = this.adr;
var v = false;
var w = this.zg.b;
if (w != null) {
v = true;
}
var x = this.yz;
var y = new ScalerParams(1, b.by, b.bx, x.ch);
y.c = this.getEffectiveViewport();
for (var z = 0; z < c.count; ++z) {
var aa = Math.min(a.f._inner[z][2], h.maxLength * 1.1);
var ab = this.y8.d(a.f._inner[z][0], aa, d, e, f);
var ac = this.y8.e(a.f._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.ac5(c, z, u, x, y, b.q);
}
var ag = this.zg.k;
var ah = this.zg.l;
var ai = a.f._inner[z][0] - (Math.PI / 2);
var aj = i.c6.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.zg.ad(aj, false, false, false, false);
}
i.c6.count = c.count;
this.adp.db();
};
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.y0 == 0) {
_super.prototype.p4.call(this, a, b, c);
return;
}
var d = this.cv.by;
var e = this.cv.bx;
var f = this.getEffectiveViewport1(this.cv);
var g = this.wj(this.cv);
var h = this.y5.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 = new Clipper(1, a.left, a.bottom, a.right, a.top, true);
var k = this.y5;
var l = Math.max(0, 0.5 * k.n6);
l = Math.max(l, h.minLength * 0.9);
var m = ViewportUtils.d(l, d, e, f);
var n = this.yz.k8(d, e, f);
var o = Math.max(0.1 * this.y5.n7, l);
var p = this.y8.d(0, o, d, e, f);
var q = this.y8.e(0, o, d, e, f);
var r = this.y8.d(n, o, d, e, f);
var s = this.y8.e(n, o, d, e, f);
var t = Math.sqrt((p - r) * (p - r) + (q - s) * (q - s));
var u = this.yz != null && this.yz.cl;
var _loop_1 = function (v) {
var w = typeCast(RadialBaseView.$, this_1.cv);
var x = w.cx.getBucket(v);
var y = Math.min(this_1.y8.b.od(x[2]), h.maxLength * 1.1);
var z = this_1.acj(this_1.yz, d, e, f);
if (u) {
z = this_1.aci(v, this_1.yz, d, e, f);
if (isNaN_(z)) {
z = 0;
}
}
x[0] = this_1.yz.getScaledAngle(x[0]) + z;
var aa = this_1.y8.d(x[0], y, d, e, f);
var ab = this_1.y8.e(x[0], y, d, e, f);
var ac = Math.sqrt((aa - i.x) * (aa - i.x) + (ab - i.y) * (ab - i.y));
var ad = ac;
var ae = m;
var af = x[0] - (Math.PI / 2);
var ag = 0 - (t / 2);
var ah = (t / 2);
var ai = Math.max(ae, ad);
var aj = Math.min(ae, ad);
var ak = Math.cos(af);
var al = Math.sin(af);
var am = { $type: Point_$type, x: i.x + (ag * ak - ai * al), y: i.y + (ag * al + ai * ak) };
var an = { $type: Point_$type, x: i.x + (ah * ak - ai * al), y: i.y + (ah * al + ai * ak) };
var ao = { $type: Point_$type, x: i.x + (ah * ak - aj * al), y: i.y + (ah * al + aj * ak) };
var ap = { $type: Point_$type, x: i.x + (ag * ak - aj * al), y: i.y + (ag * al + aj * ak) };
var aq = new List$1(Point_$type, 0);
j.i = aq;
j.j(am);
j.j(an);
j.j(ao);
j.j(ap);
j.i = null;
if (aq == null || aq.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.dn.item(v);
return $ret;
})()));
}
else {
b.add(((function () {
var $ret = new ChartSelection();
$ret.item = _this.dn.item(v);
$ret.series = _this;
return $ret;
})()));
}
};
var this_1 = this;
for (var v = 0; v < this.yz.lk; v++) {
var state_1 = _loop_1(v);
if (typeof state_1 === "object")
return state_1.value;
}
};
RadialColumnSeries.$t = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:adq:adu', [1, 0], 'RadiusY:adr:adv', [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.c5 = null;
_this.c6 = null;
_this.c7 = null;
_this.dd = new Path();
_this.c5 = a;
_this.c6 = ((function () {
var $ret = new Pool$1(Path.$);
$ret.create = runOn(_this, _this.de);
$ret.activate = runOn(_this, _this.c8);
$ret.disactivate = runOn(_this, _this.da);
$ret.destroy = runOn(_this, _this.c9);
return $ret;
})());
return _this;
}
RadialColumnSeriesView.prototype.au = function () {
_super.prototype.au.call(this);
this.c7 = new List$1(Path.$, 0);
if (!this.q) {
this.cw.xa = Defaults.c;
this.cw.jp = Defaults.i;
}
};
RadialColumnSeriesView.prototype.de = function () {
var a = new Path();
this.c7.add(a);
a._visibility = 1;
return a;
};
RadialColumnSeriesView.prototype.c8 = function (a) {
a._visibility = 0;
};
RadialColumnSeriesView.prototype.da = function (a) {
a._visibility = 1;
};
RadialColumnSeriesView.prototype.c9 = function (a) {
this.c7.remove(a);
};
RadialColumnSeriesView.prototype.dc = function (a, b, c, d, e, f) {
this.as();
};
RadialColumnSeriesView.prototype.bg = function (a, b) {
_super.prototype.bg.call(this, a, b);
var c = a;
};
RadialColumnSeriesView.prototype.bh = function (a, b) {
_super.prototype.bh.call(this, a, b);
var c = a;
};
RadialColumnSeriesView.prototype.ac = function (a) {
return this.c7._inner[a];
};
RadialColumnSeriesView.prototype.ab = function (a) {
var b = this.c7._inner[a];
this.dd._visibility = b._visibility;
this.dd.an = b.an;
var c = this.bs(a);
this.dd._fill = c;
this.dd._stroke = c;
this.dd.ad = this.e.ie + 3;
return this.dd;
};
RadialColumnSeriesView.prototype.a8 = function (a, b) {
_super.prototype.a8.call(this, a, b);
if (a.d) {
for (var c = 0; c < this.c7.count; c++) {
var d = this.aa(c, b);
this.bf(d, c, b);
a.t(d);
}
}
};
RadialColumnSeriesView.prototype.an = function (a) {
var e_1, _a;
_super.prototype.an.call(this, a);
var b = 0;
try {
for (var _b = __values(fromEnum(this.c6.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
this.e.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.db = function () {
this.as();
};
RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
return RadialColumnSeriesView;
}(AnchoredRadialSeriesView));
export { RadialColumnSeriesView };