igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
384 lines (383 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 { __extends, __values } from "tslib";
import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { DependencyProperty } from "igniteui-angular-core";
import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition";
import { Defaults } from "./Defaults";
import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { List$1 } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
* @hidden
*/
var ColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ColumnSeries, _super);
function ColumnSeries() {
var _this = _super.call(this) || this;
_this.ac2 = null;
_this.acx = 0;
_this.ab = ColumnSeries.$;
_this.acg = 2;
return _this;
}
ColumnSeries.prototype.bj = function () {
return new ColumnSeries();
};
ColumnSeries.prototype.get_ez = function () {
return true;
};
ColumnSeries.prototype.get_fl = function () {
return true;
};
ColumnSeries.prototype.jk = function () {
if (!isNaN_(this.jj)) {
return _super.prototype.jk.call(this);
}
return Defaults.h;
};
ColumnSeries.prototype.cs = function () {
return new ColumnSeriesView(this);
};
ColumnSeries.prototype.q1 = function (a) {
_super.prototype.q1.call(this, a);
this.acw = a;
};
ColumnSeries.prototype.cy = function () {
if (this.cz == 0) {
return 2;
}
return _super.prototype.cy.call(this);
};
ColumnSeries.prototype.y4 = function () {
return 1;
};
ColumnSeries.prototype.get_ed = function () {
return true;
};
ColumnSeries.prototype.preferredCategoryMode = function (a) {
return this.acg;
};
ColumnSeries.prototype.wn = function (a) {
if (this.ac2 == null) {
this.ac2 = runOn(this, this.acz);
}
var b = this.acj != null ? this.acj : this.yAxis;
var c = this.acd;
return this.aa0.c$d(this, a, c, b, this.yu, this.zv(this.cv), this.zw(this.cv), this.ac2);
};
ColumnSeries.prototype.gw = function (a, b) {
if (this.gz(a, b)) {
return true;
}
if (this.xh(a, b)) {
return true;
}
return false;
};
ColumnSeries.prototype.o5 = function (a, b) {
_super.prototype.o5.call(this, a, b);
var c = b;
if (a && c.dg != null) {
c.dg.count = 0;
}
};
ColumnSeries.prototype.iw = function () {
return this.acd.k8(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
};
ColumnSeries.prototype.ak = function (a, b) {
var c = new List$1(ChartSelection.$, 0);
this.p4(a, c, b);
return c.toArray();
};
ColumnSeries.prototype.p4 = function (a, b, c) {
this.aac(a, b, c, this.yt, 1);
};
ColumnSeries.prototype.aak = function (a, b) {
_super.prototype.aak.call(this, a, b);
var c = a.f;
if (!b.t()) {
return;
}
var d = b.by;
var e = b.bx;
var f = this.getEffectiveViewport1(b);
var g = new ScalerParams(0, d, e, this.acj.ch, f);
g.b = this.iy();
var h = new ScalerParams(0, d, e, this.acd.ch, f);
var i = this.acj;
var j = i.el(i.me, g);
var k = this.acd.k8(d, e, f);
var l = this.acd;
var m = b;
if (isNaN_(k) || isInfinity(k)) {
m.dg.count = 0;
return;
}
this.y2.a2(this, this.zm(), runOn(this, this.ym), this.zv(b), this.zw(b));
this.y2.r = this.ac0;
this.y2.s = this.ac1;
this.y2.k = this.ac0;
this.y2.l = this.ac1;
var n = false;
var o = this.y2.b;
if (o != null) {
n = true;
}
var p = this.acd.cn;
var q = p ? this.acd : null;
var r = this.valueColumn.count;
var s = this.zv(b);
var t = 0;
for (var u = 0; u < c.count; ++u) {
var v = c._inner[u][0] - 0.5 * k;
var w = this.acz(c._inner[u]);
var x = j;
w = Math.max(w, -100);
x = Math.min(x, e.bottom + 100);
var y = Math.abs(x - w);
if (isInfinity(y) || isNaN_(y)) {
continue;
}
var z = m.dg.item(t);
t++;
z.width = k;
z.height = y;
var aa = this.y2.aw(r, u)[0];
if (p && a.m != null && u >= 0 && u < a.m.count) {
aa = truncate(Math.round(a.m._inner[u]));
}
if (n) {
this.aag(c, u, r, l, h, b.q, aa);
}
if (z.dataContext != null) {
var ab = z.dataContext;
if (s == 1) {
if (aa >= 0 && aa < this.dn.count) {
if (q != null && q.i$b != null && q.i$b.count > aa) {
aa = q.i$b._inner[aa];
}
ab.item = this.dn.item(aa);
}
}
else {
ab.item = null;
}
}
this.y2.ad(z, false, false, false, false);
z.ap = this.y2.k;
z.aq = this.y2.l;
m.dl(z, v, Math.min(x, w));
}
m.dg.count = t;
b.c3(a);
};
Object.defineProperty(ColumnSeries.prototype, "acy", {
get: function () {
return this.acx;
},
set: function (a) {
if (this.acy != a) {
var b = this.acy;
this.acx = a;
this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.acy));
}
},
enumerable: false,
configurable: true
});
ColumnSeries.prototype.acz = function (a) {
if (a == null || a.length < 3) {
return NaN;
}
switch (this.acy) {
case 0: return a[1];
case 1: return a[2];
case 2: return (a[1] + a[2]) / 2;
case 3:
var b = (a[1] + a[2]) / 2;
if (this.yAxis == null) {
return b;
}
var c = this.yAxis.eo(b, new ScalerParams(1, this.db.wl, this.db.wk, this.yAxis.ch));
if (c < this.yAxis.me) {
return a[2];
}
else {
return a[1];
}
case 4:
var d = (a[1] + a[2]) / 2;
var e = this.yAxis.eo(d, new ScalerParams(1, this.db.wl, this.db.wk, this.yAxis.ch));
if (this.yAxis == null) {
return d;
}
if (e < this.yAxis.me) {
return a[1];
}
else {
return a[2];
}
default: return (a[1] + a[2]) / 2;
}
};
Object.defineProperty(ColumnSeries.prototype, "useHighMarkerFidelity", {
get: function () {
return this.zq;
},
enumerable: false,
configurable: true
});
ColumnSeries.$t = markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
ColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:ac0:ac6', [1, 0], 'RadiusY:ac1:ac7', [1, 0]]);
return ColumnSeries;
}(HorizontalAnchoredCategorySeries));
export { ColumnSeries };
/**
* @hidden
*/
var ColumnSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ColumnSeriesView, _super);
function ColumnSeriesView(a) {
var _this = _super.call(this, a) || this;
_this.df = null;
_this.dh = null;
_this.dm = new Rectangle();
_this.dg = null;
_this.df = a;
_this.dg = ((function () {
var $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(_this, _this.dn);
$ret.activate = runOn(_this, _this.di);
$ret.disactivate = runOn(_this, _this.dk);
$ret.destroy = runOn(_this, _this.dj);
return $ret;
})());
return _this;
}
ColumnSeriesView.prototype.au = function () {
_super.prototype.au.call(this);
this.dh = new List$1(Rectangle.$, 0);
if (!this.q) {
this.df.jp = Defaults.i;
this.df.xa = Defaults.c;
}
};
ColumnSeriesView.prototype.dn = function () {
var a = new Rectangle();
this.dh.add(a);
a._visibility = 1;
return a;
};
ColumnSeriesView.prototype.di = function (a) {
a._visibility = 0;
};
ColumnSeriesView.prototype.dk = function (a) {
a._visibility = 1;
};
ColumnSeriesView.prototype.dj = function (a) {
this.dh.remove(a);
};
ColumnSeriesView.prototype.dl = function (a, b, c) {
if (!this.isDirty) {
this.as();
}
a.o = c;
a.n = b;
};
ColumnSeriesView.prototype.ac = function (a) {
return this.dh._inner[a];
};
ColumnSeriesView.prototype.ab = function (a) {
var b = this.dh._inner[a];
this.dm._visibility = b._visibility;
this.dm.n = b.n;
this.dm.o = b.o;
this.dm.width = b.width;
this.dm.height = b.height;
var c = this.bs(a);
this.dm._fill = c;
this.dm._stroke = c;
this.dm.ad = this.e.ie + 3;
return this.dm;
};
ColumnSeriesView.prototype.a8 = function (a, b) {
_super.prototype.a8.call(this, a, b);
if (a.d) {
for (var c = 0; c < this.dh.count; c++) {
var d = this.aa(c, b);
this.bf(d, c, b);
a.w(d);
}
}
};
ColumnSeriesView.prototype.an = function (a) {
var e_1, _a, e_2, _b;
_super.prototype.an.call(this, a);
var b = 0;
var c = new List$1(Rectangle.$, 0);
try {
for (var _c = __values(fromEnum(this.dg.a)), _d = _c.next(); !_d.done; _d = _c.next()) {
var d = _d.value;
c.add(d);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _c.return))
_a.call(_c);
}
finally {
if (e_1)
throw e_1.error;
}
}
c.aa(function (e, f) {
if (e.n < f.n) {
return -1;
}
else if (e.n > f.n) {
return 1;
}
else {
return 0;
}
});
try {
for (var _e = __values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
var e = _f.value;
this.e.bc.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]);
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_f && !_f.done && (_b = _e.return))
_b.call(_e);
}
finally {
if (e_2)
throw e_2.error;
}
}
b++;
};
ColumnSeriesView.$t = markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$);
return ColumnSeriesView;
}(AnchoredCategorySeriesView));
export { ColumnSeriesView };