igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
384 lines (383 loc) • 12.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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { DependencyProperty } from "igniteui-react-core";
import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition";
import { Defaults } from "./Defaults";
import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
import { ChartSelection } from "./ChartSelection";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
* @hidden
*/
var ColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ColumnSeries, _super);
function ColumnSeries() {
var _this = _super.call(this) || this;
_this.adp = null;
_this.adk = 0;
_this.ab = ColumnSeries.$;
_this.ac3 = 2;
return _this;
}
ColumnSeries.prototype.bk = function () {
return new ColumnSeries();
};
ColumnSeries.prototype.get_e2 = function () {
return true;
};
ColumnSeries.prototype.get_fo = function () {
return true;
};
ColumnSeries.prototype.js = function () {
if (!isNaN_(this.jr)) {
return _super.prototype.js.call(this);
}
return Defaults.h;
};
ColumnSeries.prototype.ct = function () {
return new ColumnSeriesView(this);
};
ColumnSeries.prototype.rh = function (a) {
_super.prototype.rh.call(this, a);
this.adj = a;
};
ColumnSeries.prototype.cz = function () {
if (this.c0 == 0) {
return 2;
}
return _super.prototype.cz.call(this);
};
ColumnSeries.prototype.zp = function () {
return 1;
};
ColumnSeries.prototype.get_ef = function () {
return true;
};
ColumnSeries.prototype.preferredCategoryMode = function (a) {
return this.ac3;
};
ColumnSeries.prototype.w8 = function (a) {
if (this.adp == null) {
this.adp = runOn(this, this.adm);
}
var b = this.ac6 != null ? this.ac6 : this.yAxis;
var c = this.ac0;
return this.abn.c$d(this, a, c, b, this.zf, this.aag(this.cw), this.aah(this.cw), this.adp);
};
ColumnSeries.prototype.g2 = function (a, b) {
if (this.g5(a, b)) {
return true;
}
if (this.x2(a, b)) {
return true;
}
return false;
};
ColumnSeries.prototype.pi = function (a, b) {
_super.prototype.pi.call(this, a, b);
var c = b;
if (a && c.du != null) {
c.du.count = 0;
}
};
ColumnSeries.prototype.i3 = function () {
return this.ac0.pz(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
};
ColumnSeries.prototype.ak = function (a, b) {
var c = new List$1(ChartSelection.$, 0);
this.qi(a, c, b);
return c.toArray();
};
ColumnSeries.prototype.qi = function (a, b, c) {
this.aa0(a, b, c, this.ze, 1);
};
ColumnSeries.prototype.aa8 = function (a, b) {
_super.prototype.aa8.call(this, a, b);
var c = a.k;
if (!b.w()) {
return;
}
var d = b.ca;
var e = b.b9;
var f = this.getEffectiveViewport1(b);
var g = new ScalerParams(0, d, e, this.ac6.dn, f);
g.b = this.i5();
var h = new ScalerParams(0, d, e, this.ac0.dn, f);
var i = this.ac6;
var j = i.f6(i.rb, g);
var k = this.ac0.pz(d, e, f);
var l = this.ac0;
var m = b;
if (isNaN_(k) || isInfinity(k)) {
m.du.count = 0;
return;
}
this.zn.a2(this, this.z7(), runOn(this, this.y7), this.aag(b), this.aah(b));
this.zn.r = this.adn;
this.zn.s = this.ado;
this.zn.k = this.adn;
this.zn.l = this.ado;
var n = false;
var o = this.zn.b;
if (o != null) {
n = true;
}
var p = this.ac0.dv;
var q = p ? this.ac0 : null;
var r = this.valueColumn.count;
var s = this.aag(b);
var t = 0;
for (var u = 0; u < c.count; ++u) {
var v = c._inner[u][0] - 0.5 * k;
var w = this.adm(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.du.item(t);
t++;
z.width = k;
z.height = y;
var aa = this.zn.aw(r, u)[0];
if (p && a.r != null && u >= 0 && u < a.r.count) {
aa = truncate(Math.round(a.r._inner[u]));
}
if (n) {
this.aa4(c, u, r, l, h, b.t, aa);
}
if (z.dataContext != null) {
var ab = z.dataContext;
if (s == 1) {
if (aa >= 0 && aa < this.dp.count) {
if (q != null && q.i$b != null && q.i$b.count > aa) {
aa = q.i$b._inner[aa];
}
ab.item = this.dp.item(aa);
}
}
else {
ab.item = null;
}
}
this.zn.ad(z, false, false, false, false);
z.ap = this.zn.k;
z.aq = this.zn.l;
m.dz(z, v, Math.min(x, w));
}
m.du.count = t;
b.dg(a);
};
Object.defineProperty(ColumnSeries.prototype, "adl", {
get: function () {
return this.adk;
},
set: function (a) {
if (this.adl != a) {
var b = this.adl;
this.adk = a;
this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.adl));
}
},
enumerable: false,
configurable: true
});
ColumnSeries.prototype.adm = function (a) {
if (a == null || a.length < 3) {
return NaN;
}
switch (this.adl) {
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.f9(b, new ScalerParams(1, this.dc.za, this.dc.y9, this.yAxis.dn));
if (c < this.yAxis.rb) {
return a[2];
}
else {
return a[1];
}
case 4:
var d = (a[1] + a[2]) / 2;
var e = this.yAxis.f9(d, new ScalerParams(1, this.dc.za, this.dc.y9, this.yAxis.dn));
if (this.yAxis == null) {
return d;
}
if (e < this.yAxis.rb) {
return a[1];
}
else {
return a[2];
}
default: return (a[1] + a[2]) / 2;
}
};
Object.defineProperty(ColumnSeries.prototype, "useHighMarkerFidelity", {
get: function () {
return this.aab;
},
enumerable: false,
configurable: true
});
ColumnSeries.$t = markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
ColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:adn:adt', [1, 0], 'RadiusY:ado:adu', [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.dt = null;
_this.dv = null;
_this.d0 = new Rectangle();
_this.du = null;
_this.dt = a;
_this.du = ((function () {
var $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(_this, _this.d1);
$ret.activate = runOn(_this, _this.dw);
$ret.disactivate = runOn(_this, _this.dy);
$ret.destroy = runOn(_this, _this.dx);
return $ret;
})());
return _this;
}
ColumnSeriesView.prototype.a4 = function () {
_super.prototype.a4.call(this);
this.dv = new List$1(Rectangle.$, 0);
if (!this.t) {
this.dt.jy = Defaults.i;
this.dt.xv = Defaults.c;
}
};
ColumnSeriesView.prototype.d1 = function () {
var a = new Rectangle();
this.dv.add(a);
a._visibility = 1;
return a;
};
ColumnSeriesView.prototype.dw = function (a) {
a._visibility = 0;
};
ColumnSeriesView.prototype.dy = function (a) {
a._visibility = 1;
};
ColumnSeriesView.prototype.dx = function (a) {
this.dv.remove(a);
};
ColumnSeriesView.prototype.dz = function (a, b, c) {
if (!this.isDirty) {
this.a2();
}
a.o = c;
a.n = b;
};
ColumnSeriesView.prototype.ak = function (a) {
return this.dv._inner[a];
};
ColumnSeriesView.prototype.aj = function (a) {
var b = this.dv._inner[a];
this.d0._visibility = b._visibility;
this.d0.n = b.n;
this.d0.o = b.o;
this.d0.width = b.width;
this.d0.height = b.height;
var c = this.b4(a);
this.d0._fill = c;
this.d0._stroke = c;
this.d0.ad = this.f.il + 3;
return this.d0;
};
ColumnSeriesView.prototype.bj = function (a, b) {
_super.prototype.bj.call(this, a, b);
if (a.d) {
for (var c = 0; c < this.dv.count; c++) {
var d = this.ai(c, b);
this.br(d, c, b);
a.w(d);
}
}
};
ColumnSeriesView.prototype.ax = function (a) {
var e_1, _a, e_2, _b;
_super.prototype.ax.call(this, a);
var b = 0;
var c = new List$1(Rectangle.$, 0);
try {
for (var _c = __values(fromEnum(this.du.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.f.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 };