igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
545 lines (544 loc) • 18.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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { Brush } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { runOn, delegateCombine, markType, markDep, fromEnum } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { Rect } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { ArrayExtension } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { ChartSelection } from "./ChartSelection";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_ } from "igniteui-angular-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { BrushUtil } from "igniteui-angular-core";
/**
* @hidden
*/
var WaterfallSeries = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(WaterfallSeries, _super);
function WaterfallSeries() {
var _this = _super.call(this) || this;
_this.ab = WaterfallSeries.$;
return _this;
}
WaterfallSeries.prototype.bj = function () {
return new WaterfallSeries();
};
WaterfallSeries.prototype.get_f6 = function () {
return true;
};
WaterfallSeries.prototype.get_fl = function () {
return true;
};
WaterfallSeries.prototype.ht = function () {
var a = _super.prototype.ht.call(this);
{
var b = ((function () {
var $ret = new SeriesLayerPropertyOverlay();
$ret.r = true;
$ret.ad = "NegativeBrush";
$ret.p = true;
$ret.q = true;
return $ret;
})());
b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.r0));
a.add(b);
}
{
var c = ((function () {
var $ret = new SeriesLayerPropertyOverlay();
$ret.r = true;
$ret.ad = "NegativeOutline";
$ret.p = true;
$ret.q = true;
return $ret;
})());
c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.r0));
a.add(c);
}
return a;
};
WaterfallSeries.prototype.jk = function () {
if (!isNaN_(this.jj)) {
return _super.prototype.jk.call(this);
}
return Defaults.h;
};
WaterfallSeries.prototype.get_fa = function () {
return true;
};
WaterfallSeries.prototype.cs = function () {
return new WaterfallSeriesView(this);
};
WaterfallSeries.prototype.q1 = function (a) {
_super.prototype.q1.call(this, a);
this.acw = a;
};
WaterfallSeries.prototype.preferredCategoryMode = function (a) {
return 2;
};
WaterfallSeries.prototype.get_fm = function () {
return true;
};
WaterfallSeries.prototype.r3 = function (a, b) {
_super.prototype.r3.call(this, a, b);
this.ac7 = a;
this.ac8 = b;
};
WaterfallSeries.prototype.vw = function () {
return this.ac7;
};
WaterfallSeries.prototype.vx = function () {
return this.ac8;
};
WaterfallSeries.prototype.cy = function () {
if (this.cz == 0) {
return 2;
}
return _super.prototype.cy.call(this);
};
WaterfallSeries.prototype.get_ed = function () {
return true;
};
WaterfallSeries.prototype.q9 = function (a, b, c, d) {
_super.prototype.q9.call(this, a, b, c, d);
switch (b) {
case WaterfallSeries.$$p[3]:
case WaterfallSeries.$$p[2]:
case WaterfallSeries.$$p[0]:
case WaterfallSeries.$$p[1]:
this.rr(false);
break;
}
};
WaterfallSeries.prototype.gw = function (a, b) {
if (this.gz(a, b)) {
return true;
}
if (this.xh(a, b)) {
return true;
}
return false;
};
WaterfallSeries.prototype.wn = function (a) {
var _this = this;
if (this.acw == null || this.acw.dg == null || this.acw.dg.count == 0 || this.xAxis == null) {
return Rect.empty;
}
var b = this.acw.dg;
var c = this.v7(a);
var d = -1;
var e = this.xAxis.ch;
var f = this.ws.right * 2;
if (e) {
d = ArrayExtension.binarySearch$1(Rectangle.$, b, function (g) {
var h = _this.acw.dn(g);
return (f - c.x) < (f - (h.left + h.width / 2)) ? -1 : ((f - c.x) > (f - (h.left + h.width / 2)) ? 1 : 0);
});
}
else {
d = ArrayExtension.binarySearch$1(Rectangle.$, b, function (g) {
var h = _this.acw.dn(g);
return c.x < (h.left + h.width / 2) ? -1 : (c.x > (h.left + h.width / 2) ? 1 : 0);
});
}
if (d < 0) {
d = ~d;
d--;
}
if (d < 0) {
d = 0;
}
if (d > b.count - 1) {
d = b.count - 1;
}
var g = d;
var h = d;
if (g < 0) {
g--;
}
if (h < b.count - 1) {
h++;
}
var i = this.ac9(g);
var j = this.ac9(d);
var k = this.ac9(h);
var l = i.left + i.width / 2;
var m = j.left + j.width / 2;
var n = k.left + k.width / 2;
var o = Math.abs(l - c.x);
var p = Math.abs(m - c.x);
var q = Math.abs(n - c.x);
var r = i.containsPoint(c);
var s = j.containsPoint(c);
var t = k.containsPoint(c);
if (p <= o && p <= q) {
if (!e && t) {
return k;
}
if (e && r) {
return i;
}
return j;
}
if (o <= p && o <= q) {
if (!e && s) {
return j;
}
return i;
}
if (q <= p && q <= o) {
if (e && s) {
return j;
}
return k;
}
return Rect.empty;
};
WaterfallSeries.prototype.ac9 = function (a) {
return this.acw.dm(a);
};
WaterfallSeries.prototype.y4 = function () {
return 1;
};
WaterfallSeries.prototype.o5 = function (a, b) {
_super.prototype.o5.call(this, a, b);
this.acw.dg.count = 0;
};
WaterfallSeries.prototype.get_abb = function () {
return 1;
};
WaterfallSeries.prototype.iw = function () {
return this.acd.k8(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
};
WaterfallSeries.prototype.aak = function (a, b) {
var c = b;
_super.prototype.aak.call(this, a, b);
var d = b.by;
var e = b.bx;
var f = this.getEffectiveViewport1(b);
var g = this.acd.k8(d, e, f);
var h = this.acx;
var i = this.acy;
var j;
var k = this.aa9(b);
var l = NaN;
var m = c.dg;
var n;
var o = 0;
this.y2.a2(this, this.zm(), runOn(this, this.ym), this.zv(b), this.zw(b));
this.y2.r = this.acx;
this.y2.s = this.acy;
this.y2.k = this.acx;
this.y2.l = this.acy;
var p = false;
var q = this.y2.b;
if (q != null) {
p = true;
}
var r = this.acd.cn;
var s = this.valueColumn.count;
var t = a.f;
var u = this.acd;
var v = new ScalerParams(0, d, e, this.acd.ch, f);
var w = this.u9;
var x = this.ac7;
var y = this.vd;
var z = this.ac8 || y;
if (a.f.count > 0) {
j = a.f._inner[0][0] - 0.5 * g;
var aa = a.f._inner[0][1];
if (!isNaN_(aa)) {
if (aa > k) {
n = m.item(o);
o++;
c.dl(n, j, k);
n.width = g;
n.height = Math.abs(k - aa);
this.y2.ak = x;
this.y2.ag = x;
this.y2.al = z;
this.y2.ah = z;
this.y2.f = true;
var ab = this.y2.aw(s, 0)[0];
if (r && a.m != null && 0 < a.m.count) {
ab = truncate(Math.round(a.m._inner[0]));
}
if (p) {
this.aag(t, 0, s, u, v, b.q, ab);
}
this.y2.ad(n, false, false, false, false);
n.ap = this.y2.k;
n.aq = this.y2.l;
}
else {
n = m.item(o);
o++;
c.dl(n, j, aa);
n.width = g;
n.height = Math.abs(aa - k);
this.y2.ak = w;
this.y2.ag = w;
this.y2.al = y;
this.y2.ah = y;
this.y2.f = false;
var ac = this.y2.aw(s, o)[0];
if (r && a.m != null && o >= 0 && o < a.m.count) {
ac = truncate(Math.round(a.m._inner[o]));
}
if (p) {
this.aag(t, 0, s, u, v, b.q, ac);
}
this.y2.ad(n, false, false, false, false);
n.ap = this.y2.k;
n.aq = this.y2.l;
}
l = aa;
}
else {
l = k;
}
}
for (var ad = 1; ad < a.f.count; ++ad) {
var ae = a.f._inner[ad];
j = a.f._inner[ad][0] - 0.5 * g;
var af = ae[1];
if (!isNaN_(af)) {
n = m.item(o);
o++;
c.dl(n, j, Math.min(l, af));
n.width = g;
n.height = Math.abs(l - af);
this.y2.ak = w;
this.y2.ag = w;
this.y2.al = y;
this.y2.ah = y;
this.y2.f = false;
var ag = this.y2.aw(s, o)[0];
if (r && a.m != null && o >= 0 && o < a.m.count) {
ag = truncate(Math.round(a.m._inner[o]));
}
if (l > af) {
if (p) {
this.aag(t, ad, s, u, v, b.q, ag);
}
}
else {
this.y2.ak = x;
this.y2.ag = x;
this.y2.al = z;
this.y2.ah = z;
this.y2.f = true;
if (p) {
this.aag(t, ad, s, u, v, b.q, ag);
}
}
this.y2.ad(n, false, false, false, false);
n.ap = this.y2.k;
n.aq = this.y2.l;
l = af;
}
}
m.count = o;
b.c3(a);
};
WaterfallSeries.prototype.p4 = function (a, b, c) {
this.aac(a, b, c, this.yt, 1);
};
WaterfallSeries.prototype.ak = function (a, b) {
var c = new List$1(ChartSelection.$, 0);
this.p4(a, c, b);
return c.toArray();
};
WaterfallSeries.prototype.aa4 = function (a, b, c) {
if (c == 0) {
return 0 < b && a < this.valueColumn.item(c);
}
else {
var d = this.valueColumn.item(c - 1);
var e = Math.min(d, this.valueColumn.item(c));
var f = Math.max(d, this.valueColumn.item(c));
return e < b && a < f;
}
};
Object.defineProperty(WaterfallSeries.prototype, "useHighMarkerFidelity", {
get: function () {
return this.zq;
},
enumerable: false,
configurable: true
});
WaterfallSeries.$t = markType(WaterfallSeries, 'WaterfallSeries', HorizontalAnchoredCategorySeries.$);
WaterfallSeries.$$p = markDep(DependencyProperty, PropertyMetadata, WaterfallSeries, 'raisePropertyChanged', ['NegativeBrush:ac7:ac3', [Brush.$, null], 'NegativeOutline:ac8:ac4', [Brush.$, null], 'RadiusX:acx:ac5', [1, 0], 'RadiusY:acy:ac6', [1, 0]]);
return WaterfallSeries;
}(HorizontalAnchoredCategorySeries));
export { WaterfallSeries };
/**
* @hidden
*/
var WaterfallSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(WaterfallSeriesView, _super);
function WaterfallSeriesView(a) {
var _this = _super.call(this, a) || this;
_this.df = null;
_this.dh = null;
_this.dp = new Rectangle();
_this.dg = null;
_this.df = a;
_this.dg = ((function () {
var $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(_this, _this.dq);
$ret.activate = runOn(_this, _this.di);
$ret.disactivate = runOn(_this, _this.dk);
$ret.destroy = runOn(_this, _this.dj);
return $ret;
})());
return _this;
}
WaterfallSeriesView.prototype.au = function () {
_super.prototype.au.call(this);
this.dh = new List$1(Rectangle.$, 0);
if (!this.q) {
this.df.xa = Defaults.c;
this.df.jp = Defaults.i;
this.df.ac7 = Defaults.ah;
this.df.ac8 = Defaults.ai;
}
};
WaterfallSeriesView.prototype.dq = function () {
var a = new Rectangle();
this.dh.add(a);
a._visibility = 1;
return a;
};
WaterfallSeriesView.prototype.di = function (a) {
a._visibility = 0;
};
WaterfallSeriesView.prototype.dk = function (a) {
a._visibility = 1;
};
WaterfallSeriesView.prototype.dj = function (a) {
this.dh.remove(a);
};
WaterfallSeriesView.prototype.dl = function (a, b, c) {
var d = false;
if (a.o != c) {
d = true;
a.o = c;
}
if (a.n != b) {
d = true;
a.n = b;
}
if (d) {
this.as();
}
};
WaterfallSeriesView.prototype.ac = function (a) {
return this.dh._inner[a];
};
WaterfallSeriesView.prototype.ab = function (a) {
var b = this.dh._inner[a];
this.dp._visibility = b._visibility;
this.dp.n = b.n;
this.dp.o = b.o;
this.dp.width = b.width;
this.dp.height = b.height;
var c = this.bs(a);
this.dp._fill = c;
this.dp._stroke = c;
this.dp.ad = this.e.ie + 3;
return this.dp;
};
WaterfallSeriesView.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);
}
}
};
WaterfallSeriesView.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;
var f = "Negative";
if (BrushUtil.d(e._fill, this.e.u9)) {
f = "Positive";
}
this.e.bc.exportRectangleData(a, e, "column" + b, ["Main", f]);
}
}
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++;
};
WaterfallSeriesView.prototype.dm = function (a) {
var b = this.dg.item(a);
return new Rect(0, b.n, b.o, b.width, b.height);
};
WaterfallSeriesView.prototype.dn = function (a) {
return new Rect(0, a.n, a.o, a.width, a.height);
};
WaterfallSeriesView.$t = markType(WaterfallSeriesView, 'WaterfallSeriesView', AnchoredCategorySeriesView.$);
return WaterfallSeriesView;
}(AnchoredCategorySeriesView));
export { WaterfallSeriesView };