igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
443 lines (442 loc) • 15.2 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 } from "tslib";
import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Point_$type, Array_$type, runOn, markType } from "igniteui-react-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { ChartSelection } from "./ChartSelection";
import { intDivide, isNaN_ } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { Defaults } from "./Defaults";
import { Color } from "igniteui-react-core";
/**
* @hidden
*/
var StepLineSeries = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(StepLineSeries, _super);
function StepLineSeries() {
var _this = _super.call(this) || this;
_this.adk = null;
_this.adk = new CategoryLineRasterizer();
_this.ab = StepLineSeries.$;
return _this;
}
StepLineSeries.prototype.bk = function () {
return new StepLineSeries();
};
StepLineSeries.prototype.get_fn = function () {
return true;
};
StepLineSeries.prototype.get_f4 = function () {
return true;
};
StepLineSeries.prototype.get_fo = function () {
return true;
};
StepLineSeries.prototype.ct = function () {
return new StepLineSeriesView(this);
};
StepLineSeries.prototype.z9 = function () {
return true;
};
StepLineSeries.prototype.rh = function (a) {
_super.prototype.rh.call(this, a);
this.adl = a;
};
StepLineSeries.prototype.ac = function () {
_super.prototype.ac.call(this);
};
StepLineSeries.prototype.preferredCategoryMode = function (a) {
return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
};
StepLineSeries.prototype.get_ey = function () {
return true;
};
StepLineSeries.prototype.pi = function (a, b) {
_super.prototype.pi.call(this, a, b);
var c = b;
c.du();
};
StepLineSeries.prototype.g2 = function (a, b) {
if (this.g1(a, b)) {
return true;
}
if (this.x2(a, b)) {
return true;
}
return false;
};
StepLineSeries.prototype.aj = function (a) {
var b = this.adj(a);
if (b == null) {
return null;
}
var c = new Array(1);
if (b.length == 4) {
var d = new Array(4);
d[0] = { $type: Point_$type, x: b[0][0], y: b[0][1] };
d[1] = { $type: Point_$type, x: b[1][0], y: b[1][1] };
d[2] = { $type: Point_$type, x: b[2][0], y: b[2][1] };
d[3] = { $type: Point_$type, x: b[3][0], y: b[3][1] };
c[0] = d;
}
else {
var e = new Array(2);
e[0] = { $type: Point_$type, x: b[0][0], y: b[0][1] };
e[1] = { $type: Point_$type, x: b[1][0], y: b[1][1] };
c[0] = e;
}
return c;
};
StepLineSeries.prototype.adj = function (a) {
var b = this.am(this.xAxis, this.zf.k, this.aag(this.cw), this.aah(this.cw), this.w2(a), true);
if (b == null) {
return null;
}
var c = this.zg();
var d = b[0];
var e = b[1];
if (d < 0 && e < 0) {
return null;
}
if (d > c.k.count - 1 && e > c.k.count - 1) {
return null;
}
if (d < 0) {
d = 0;
}
if (e < 0) {
e = 0;
}
if (e > c.k.count - 1) {
e = c.k.count - 1;
}
if (d > c.k.count - 1) {
d = c.k.count - 1;
}
var f = this.cw.ca;
var g = this.cw.b9;
var h = this.getEffectiveViewport1(this.cw);
var i = typeCast(ISortingAxis_$type, this.ac0) != null;
var j = this.ac0.dn;
var k = 0;
if (this.ac0 != null) {
k = 0.5 * this.ac0.getCategorySize(f, g, h);
}
var l = new Array(4);
var m = new Array(4);
var n = new Array(4);
var o = new Array(4);
if (!this.ac0.dn) {
var p = d * 2;
l[0] = this.adm(p, false, c, k, j, i);
l[1] = c.k._inner[(intDivide(p, 2))][1];
l[2] = this.adm(p, false, c, k, j, i);
l[3] = c.k._inner[(intDivide(p, 2))][2];
p++;
m[0] = this.adm(p, false, c, k, j, i);
m[1] = c.k._inner[(intDivide(p, 2))][1];
m[2] = this.adm(p, false, c, k, j, i);
m[3] = c.k._inner[(intDivide(p, 2))][2];
p = e * 2;
n[0] = this.adm(p, false, c, k, j, i);
n[1] = c.k._inner[(intDivide(p, 2))][1];
n[2] = this.adm(p, false, c, k, j, i);
n[3] = c.k._inner[(intDivide(p, 2))][2];
p++;
o[0] = this.adm(p, false, c, k, j, i);
o[1] = c.k._inner[(intDivide(p, 2))][1];
o[2] = this.adm(p, false, c, k, j, i);
o[3] = c.k._inner[(intDivide(p, 2))][2];
}
else {
var q = d * 2;
l[0] = this.adm(q, true, c, k, j, i);
l[1] = c.k._inner[(intDivide(q, 2))][1];
l[2] = this.adm(q, true, c, k, j, i);
l[3] = c.k._inner[(intDivide(q, 2))][2];
q++;
m[0] = this.adm(q, true, c, k, j, i);
m[1] = c.k._inner[(intDivide(q, 2))][1];
m[2] = this.adm(q, true, c, k, j, i);
m[3] = c.k._inner[(intDivide(q, 2))][2];
q = e * 2;
n[0] = this.adm(q, true, c, k, j, i);
n[1] = c.k._inner[(intDivide(q, 2))][1];
n[2] = this.adm(q, true, c, k, j, i);
n[3] = c.k._inner[(intDivide(q, 2))][2];
q++;
o[0] = this.adm(q, true, c, k, j, i);
o[1] = c.k._inner[(intDivide(q, 2))][1];
o[2] = this.adm(q, true, c, k, j, i);
o[3] = c.k._inner[(intDivide(q, 2))][2];
}
if (d == e) {
return [l, m];
}
return [l, m, n, o];
};
StepLineSeries.prototype.al = function (a) {
var b = this.adj(a);
if (b == null) {
return null;
}
var c = new Array(1);
if (b.length == 4) {
var d = new Array(4);
d[0] = { $type: Point_$type, x: b[0][2], y: b[0][3] };
d[1] = { $type: Point_$type, x: b[1][2], y: b[1][3] };
d[2] = { $type: Point_$type, x: b[2][2], y: b[2][3] };
d[3] = { $type: Point_$type, x: b[3][2], y: b[3][3] };
c[0] = d;
}
else {
var e = new Array(2);
e[0] = { $type: Point_$type, x: b[0][2], y: b[0][3] };
e[1] = { $type: Point_$type, x: b[1][2], y: b[1][3] };
c[0] = e;
}
return c;
};
StepLineSeries.prototype.i2 = function (a, b, c, d, e, f, g, h) {
var i = NaN;
if (c >= 0 && c < b.count) {
i = b.item(c);
}
var j = NaN;
if (d >= 0 && d < b.count) {
j = b.item(d);
}
if (f == 0) {
return j;
}
if (e == b.count - 1) {
return i;
}
if (isNaN_(j) && g != 0 && a <= 0.5 && !h) {
return i;
}
if (isNaN_(i) && g != 0 && a >= 0.5 && !h) {
return j;
}
if (a > 0.5) {
return j;
}
return i;
};
StepLineSeries.prototype.adm = function (a, b, c, d, e, f) {
var g;
if (b) {
if (f) {
g = (a & 1) == 0;
if (g || (intDivide(a, 2)) + 1 < 0) {
return c.k._inner[(intDivide(a, 2))][0];
}
if (c.k.count == (intDivide(a, 2)) + 1) {
return c.k._inner[(intDivide(a, 2))][0];
}
return c.k._inner[(intDivide(a, 2)) + 1][0];
}
g = (a & 1) == 0;
return c.k._inner[(intDivide(a, 2))][0] + (g ? d : -d);
}
if (f) {
g = (a & 1) == 0;
if (g || ((intDivide(a, 2)) + 1) >= c.k.count) {
return c.k._inner[(intDivide(a, 2))][0];
}
if (c.k.count == (intDivide(a, 2)) + 1) {
return c.k._inner[(intDivide(a, 2))][0];
}
return c.k._inner[(intDivide(a, 2)) + 1][0];
}
g = (a & 1) == 0;
return c.k._inner[(intDivide(a, 2))][0] + (g ? -d : d);
};
StepLineSeries.prototype.aa8 = function (a, b) {
_super.prototype.aa8.call(this, a, b);
var c = b.ca;
var d = b.b9;
var e = this.getEffectiveViewport1(b);
var f = typeCast(ISortingAxis_$type, this.ac0) != null;
var g = this.ac0.dn;
var h = 0;
if (this.ac0 != null) {
h = 0.5 * this.ac0.getCategorySize(c, d, e);
}
var i = a.k;
var j = 2 * i.count;
var k = new List$1(Array_$type, 2, j);
if (!this.ac0.dn) {
for (var l = 0; l < j; l++) {
var m = new Array(4);
m[0] = this.adm(l, false, a, h, g, f);
m[1] = a.k._inner[(intDivide(l, 2))][1];
m[2] = this.adm(l, false, a, h, g, f);
m[3] = a.k._inner[(intDivide(l, 2))][2];
k.add(m);
}
}
else {
for (var n = 0; n < j; n++) {
var o = new Array(4);
o[0] = this.adm(n, true, a, h, g, f);
o[1] = a.k._inner[(intDivide(n, 2))][1];
o[2] = this.adm(n, true, a, h, g, f);
o[3] = a.k._inner[(intDivide(n, 2))][2];
k.add(o);
}
}
var p = typeCast(StepLineSeriesView.$, b);
var q = p.c9.d;
this.zn.a2(this, this.z7(), runOn(this, this.y7), this.aag(b), this.aah(b));
var r = false;
var s = this.zn.b;
if (s != null) {
r = true;
}
if (r) {
var t = new ScalerParams(0, b.ca, b.b9, this.ac0.dn, e);
this.aa4(i, -1, this.valueColumn.count, this.ac0, t, b.t, -1);
}
var u = p.d0;
var v = p.d1;
var w = p.dz;
this.zn.ad(u, true, false, true, false);
this.zn.ad(v, true, false, true, false);
this.zn.ad(w, false, true, false, false);
w._opacity = 0.75 * this.zn.j;
if (b.dd(a)) {
p.dv(j, k, false, 1, this.abg(k, j - 1, b.b9, b.ca), q, this.ik);
b.dg(a);
}
};
StepLineSeries.prototype.qi = function (a, b, c) {
this.aa0(a, b, c, this.ze, 0);
};
StepLineSeries.prototype.ak = function (a, b) {
var c = new List$1(ChartSelection.$, 0);
this.qi(a, c, b);
return c.toArray();
};
Object.defineProperty(StepLineSeries.prototype, "useHighMarkerFidelity", {
get: function () {
return this.aab;
},
enumerable: false,
configurable: true
});
StepLineSeries.$t = markType(StepLineSeries, 'StepLineSeries', HorizontalAnchoredCategorySeries.$);
return StepLineSeries;
}(HorizontalAnchoredCategorySeries));
export { StepLineSeries };
/**
* @hidden
*/
var StepLineSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(StepLineSeriesView, _super);
function StepLineSeriesView(a) {
var _this = _super.call(this, a) || this;
_this.dt = null;
_this.d3 = new Path();
_this.d2 = new Path();
_this.d4 = new Path();
_this.dy = new Path();
_this.dx = new Path();
_this.dw = new Path();
_this.dt = a;
return _this;
}
StepLineSeriesView.prototype.a4 = function () {
_super.prototype.a4.call(this);
if (!this.t) {
this.dt.xv = Defaults.c;
}
};
Object.defineProperty(StepLineSeriesView.prototype, "d0", {
get: function () {
return this.d3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StepLineSeriesView.prototype, "d1", {
get: function () {
return this.d4;
},
enumerable: false,
configurable: true
});
Object.defineProperty(StepLineSeriesView.prototype, "dz", {
get: function () {
return this.d2;
},
enumerable: false,
configurable: true
});
StepLineSeriesView.prototype.du = function () {
this.d2.an = null;
this.d3.an = null;
this.d4.an = null;
this.a2();
};
StepLineSeriesView.prototype.dv = function (a, b, c, d, e, f, g) {
this.dt.adk.a = typeCast(ISortingAxis_$type, this.db.fetchXAxis()) !== null ? true : false;
this.dt.adk.m(this.d3, this.d2, this.d4, a, b, c, d, e, f, g);
this.a2();
};
StepLineSeriesView.prototype.bq = function () {
_super.prototype.bq.call(this);
this.dx.an = this.d3.an;
this.dy.an = this.d4.an;
this.dw.an = this.d2.an;
var a = this.b3();
this.dx._stroke = a;
this.dx.ad = this.f.il + 3;
this.dy._stroke = a;
this.dy.ad = this.f.il + 3;
this.dw._fill = a;
this.dw._opacity = 1;
};
StepLineSeriesView.prototype.bj = function (a, b) {
_super.prototype.bj.call(this, a, b);
if (a.d) {
if (b) {
a.t(this.dw);
a.t(this.dx);
a.t(this.dy);
}
else {
a.t(this.d2);
a.t(this.d3);
a.t(this.d4);
}
}
};
StepLineSeriesView.prototype.ax = function (a) {
_super.prototype.ax.call(this, a);
this.f.bc.exportPathData(a, this.d3, "lowerShape", ["Lower", "Main"]);
this.f.bc.exportPathData(a, this.d4, "upperShape", ["Upper"]);
this.f.bc.exportPathData(a, this.d2, "translucentShape", ["Translucent"]);
};
StepLineSeriesView.prototype.an = function () {
var a = new Color();
a.colorString = "rgba(95,95,95,0.5)";
this.f.wl = a;
this.f.jv = 3;
this.f.jw = 1;
this.f.jx = 4;
this.f.hi = false;
};
StepLineSeriesView.$t = markType(StepLineSeriesView, 'StepLineSeriesView', AnchoredCategorySeriesView.$);
return StepLineSeriesView;
}(AnchoredCategorySeriesView));
export { StepLineSeriesView };