igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
581 lines (580 loc) • 20.9 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 { AnnotationLayer } from "./AnnotationLayer";
import { Brush } from "igniteui-react-core";
import { DependencyProperty } from "igniteui-react-core";
import { Series } from "./Series";
import { Thickness } from "igniteui-react-core";
import { Visibility_$type } from "igniteui-react-core";
import { CrosshairLayerFrame } from "./CrosshairLayerFrame";
import { List$1 } from "igniteui-react-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { Base, Number_$type, enumGetBox, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-react-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { Tuple$2 } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { AxisAnnotationFramePrepareSettings } from "./AxisAnnotationFramePrepareSettings";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { Path } from "igniteui-react-core";
import { PathGeometry } from "igniteui-react-core";
import { PathFigure } from "igniteui-react-core";
import { LineSegment } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { Defaults } from "./Defaults";
import { TranslateTransform } from "igniteui-react-core";
import { LineGeometry } from "igniteui-react-core";
/**
* @hidden
*/
var CrosshairLayer = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CrosshairLayer, _super);
function CrosshairLayer() {
var _this = _super.call(this) || this;
_this.xAxisAnnotationFormatLabel = null;
_this.yAxisAnnotationFormatLabel = null;
_this.adl = null;
_this.aa4 = null;
_this.aa3 = null;
var a = new CrosshairLayerFrame();
var b = new CrosshairLayerFrame();
var c = new CrosshairLayerFrame();
var d = _this.km / 1000;
_this.xx = a;
_this.xw = b;
_this.xy = c;
_this.ab = CrosshairLayer.$;
return _this;
}
CrosshairLayer.prototype.bk = function () {
return new CrosshairLayer();
};
CrosshairLayer.prototype.get_eu = function () {
return true;
};
CrosshairLayer.prototype.get_er = function () {
return true;
};
CrosshairLayer.prototype.ct = function () {
return new CrosshairLayerView(this);
};
CrosshairLayer.prototype.rh = function (a) {
_super.prototype.rh.call(this, a);
this.aau = a;
};
CrosshairLayer.prototype.g0 = function (a) {
if (this.aav == null) {
return true;
}
if (this.aav == a) {
return true;
}
return false;
};
CrosshairLayer.prototype.aaw = function () {
return this.xAxisAnnotationFormatLabel != null;
};
CrosshairLayer.prototype.aax = function () {
return this.yAxisAnnotationFormatLabel != null;
};
Object.defineProperty(CrosshairLayer.prototype, "adn", {
get: function () {
return new Thickness(1, this.aa7, this.aa9, this.aa8, this.aa6);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CrosshairLayer.prototype, "ado", {
get: function () {
return new Thickness(1, this.abd, this.abf, this.abe, this.abc);
},
enumerable: false,
configurable: true
});
CrosshairLayer.prototype.zd = function (a, b) {
if (this.aav == null || this.aav == a) {
if (!this.a1.c) {
this.r8(b);
}
}
};
CrosshairLayer.prototype.zf = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.zf.call(this, a, b);
var c = a;
var d = this.aa2;
var e = this.aa1;
c.a1.clear();
c.a2.clear();
c.a0.clear();
c.a3.clear();
AxisAnnotationFrameManager.b(c);
if (this.x4(this.aav)) {
this.acg(this.aav, c, d, e);
}
else {
try {
for (var _b = __values(fromEnum(this.dc.b9)), _c = _b.next(); !_c.done; _c = _b.next()) {
var f = _c.value;
if (this.x4(f)) {
this.acg(f, c, d, e);
}
if (f.isStacked) {
f.qh(function (g) {
if (_this.x4(g)) {
_this.acg(g, c, d, e);
}
if (g.ei) {
g.qf(function (h) {
if (_this.x4(h)) {
_this.acg(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.qf(function (g) {
if (_this.x4(g)) {
_this.acg(g, c, d, e);
}
return true;
});
}
}
}
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;
}
}
}
};
CrosshairLayer.prototype.x4 = function (a) {
if (!_super.prototype.x4.call(this, a)) {
return false;
}
if (this.abp != null) {
if (a.isFragment) {
var b = a.nn();
if (!Base.equalsStatic(this.abp, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abp, a.name)) {
return false;
}
}
}
var c = this.oz(a, this.aap);
if (!c.c) {
return false;
}
return true;
};
CrosshairLayer.prototype.q4 = function () {
_super.prototype.q4.call(this);
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.ach(this.xy, false);
}
else {
this.ach(this.xw, false);
}
};
CrosshairLayer.prototype.xn = function () {
return 1;
};
CrosshairLayer.prototype.yb = function () {
return 0.1;
};
CrosshairLayer.prototype.ye = function () {
return -0.4;
};
CrosshairLayer.prototype.yd = function () {
return 0.5;
};
CrosshairLayer.prototype.aah = function () {
return this.xk == 3 ? this.adm() : null;
};
CrosshairLayer.prototype.aai = function () {
return this.xl == 3 ? this.adm() : null;
};
CrosshairLayer.prototype.adm = function () {
if (this.adl == null) {
this.adl = new DoubleCollection();
this.adl.add(DeviceUtils.g(5));
this.adl.add(DeviceUtils.g(5));
}
return this.adl;
};
CrosshairLayer.prototype.acg = function (a, b, c, d) {
var e = this.oz(a, this.aap);
if (!e.c) {
return;
}
var f = e.d;
var g = a.jd(f, c, d);
if (this.aaz && isNaN_(g)) {
return;
}
if (this.aa0 && a.isFragment && g == 0) {
return;
}
f = a.ww(f, c, d);
var h = false;
var i = this.vt;
if (i == null) {
i = this.vz;
}
if (i == null) {
i = a.vt;
h = true;
}
var j = false;
var k = this.adf;
if (k == null) {
if (this.vz != null) {
k = this.vz;
}
else {
k = a.vt;
j = true;
}
}
var l = false;
var m = this.adi;
if (m == null) {
if (this.vz != null) {
m = this.vz;
}
else {
m = a.vt;
l = true;
}
}
var n = i;
var o = i;
var p = k;
var q = m;
if (this.add != null) {
n = this.add;
}
else if (h) {
switch (this.xk) {
case 0:
case 1:
n = this.aau.ck(n, this.x8);
break;
case 2:
n = this.aau.cm(n, this.x8);
break;
case 4:
n = this.aau.cl(n, this.x8);
break;
}
}
if (this.ade != null) {
o = this.ade;
}
else if (h) {
switch (this.xl) {
case 0:
case 1:
o = this.aau.ck(o, this.ya);
break;
case 2:
o = this.aau.cm(o, this.ya);
break;
case 4:
o = this.aau.cl(o, this.ya);
break;
}
}
if (j) {
switch (this.xl) {
case 1:
p = this.aau.ck(p, this.ya);
break;
case 2:
p = this.aau.cm(p, this.ya);
break;
}
}
if (l) {
switch (this.xk) {
case 1:
q = this.aau.ck(q, this.x8);
break;
case 2:
q = this.aau.cm(q, this.x8);
break;
}
}
b.a0.add(n);
b.a3.add(o);
b.a1.add(f.y);
b.a2.add(f.x);
if (this.aay && !isNaN_(f.y)) {
var r = new AxisAnnotationFramePrepareSettings();
r.u = p;
r.y = this.adh;
r.x = this.adg;
r.g = this.aa5;
r.ae = this.adn;
r.l = this.aba;
r.c = this.adq == 0;
r.z = q;
r.ad = this.adk;
r.ac = this.adj;
r.m = this.abb;
r.af = this.ado;
r.r = this.abg;
r.d = this.adp == 0;
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), i, r);
}
};
CrosshairLayer.prototype.ach = function (a, b) {
var c = false;
if (this.aa3 == null) {
c = true;
this.aa4 = new List$1(Axis.$, 0);
this.aa3 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aa3, this.aa4, b, this.abh, this.abi, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
};
CrosshairLayer.prototype.acf = function (a, b, c, d, e) {
var f = a.item(b);
b++;
if (e) {
f._stroke = d.a3._inner[c];
f._fill = d.a3._inner[c];
}
else {
f._stroke = d.a0._inner[c];
f._fill = d.a0._inner[c];
}
f.ad = this.il;
f.ai = e ? this.aaf : this.aae;
f.am = this.wp;
f.al = this.wo;
f.ak = this.wo;
f.aj = this.wn;
f.ac = this.jp;
return new Tuple$2(Path.$, Number_$type, f, b);
};
CrosshairLayer.prototype.zi = function (a, b) {
_super.prototype.zi.call(this, a, b);
var c = this.aau.co;
var d = a;
var e = d.a1.count;
var f = 0;
var g = b.b9.left;
var h = b.b9.right;
var i = b.b9.top;
var j = b.b9.bottom;
var k = this.adq == 0;
var l = this.adp == 0;
for (var m = 0; m < e; m++) {
var n = Math.floor(d.a1._inner[m]);
var o = Math.floor(d.a2._inner[m]);
var p = null;
if (k) {
if (isNaN_(n)) {
continue;
}
var q = this.acf(c, f, m, d, true);
p = q.c;
f = q.d;
var r = new PathGeometry();
var s = new PathFigure();
s._startPoint = { $type: Point_$type, x: o, y: i };
var t = new LineSegment(1);
t.c = { $type: Point_$type, x: o, y: j };
s._segments.add(t);
r.c.add(s);
p.an = r;
}
if (l) {
if (isNaN_(n)) {
continue;
}
var u = this.acf(c, f, m, d, false);
p = u.c;
f = u.d;
var v = new PathGeometry();
var w = new PathFigure();
w._startPoint = { $type: Point_$type, x: g, y: n };
var x = new LineSegment(1);
x.c = { $type: Point_$type, x: h, y: n };
w._segments.add(x);
v.c.add(w);
p.an = v;
}
}
c.count = f;
if (this.d4()) {
this.ach(this.xy, true);
}
else {
this.ach(this.xw, false);
}
};
CrosshairLayer.prototype.gg = function () {
return true;
};
CrosshairLayer.prototype.rq = function (a, b, c, d) {
_super.prototype.rq.call(this, a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aa3 != null && this.aa3.count > 0) {
var e = void 0;
if (this.d4()) {
e = this.xy;
}
else {
e = this.xw;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aa3, this.aa4, true, this.abh, this.abi, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.r8(true);
break;
case CrosshairLayer.$$p[10]:
this.r8(true);
break;
case CrosshairLayer.$$p[6]:
case CrosshairLayer.$$p[7]:
this.r8(true);
break;
case CrosshairLayer.$$p[2]:
case CrosshairLayer.$$p[12]:
case CrosshairLayer.$$p[11]:
case CrosshairLayer.$$p[14]:
case CrosshairLayer.$$p[16]:
case CrosshairLayer.$$p[18]:
case CrosshairLayer.$$p[17]:
case CrosshairLayer.$$p[15]:
case CrosshairLayer.$$p[19]:
case CrosshairLayer.$$p[20]:
case CrosshairLayer.$$p[22]:
case CrosshairLayer.$$p[24]:
case CrosshairLayer.$$p[26]:
case CrosshairLayer.$$p[28]:
case CrosshairLayer.$$p[27]:
case CrosshairLayer.$$p[25]:
case CrosshairLayer.$$p[29]:
case CrosshairLayer.$$p[30]:
case CrosshairLayer.$$p[0]:
case CrosshairLayer.$$p[9]:
case CrosshairLayer.$$p[8]:
this.r8(true);
break;
}
};
CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:add:aci', [Brush.$, null], 'HorizontalLineVisibility:adp:acj', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aay:ack', [0, false], 'SkipAxisAnnotationOnInvalidData:aaz:acl', [0, false], 'SkipAxisAnnotationOnZeroValueFragments:aa0:acm', [0, false], 'SkipUnknownValues:aa1:acn', [0, true], 'TargetSeriesName:abp:aco', [2, null], 'TargetSeries:aav:acp', [Series.$, null], 'UseInterpolation:aa2:acq', [0, true], 'VerticalLineStroke:ade:acr', [Brush.$, null], 'VerticalLineVisibility:adq:acs', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aa5:act', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:adf:acu', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:abh:acv', [1, -1], 'XAxisAnnotationOutline:adg:acw', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aa6:acx', [1, NaN], 'XAxisAnnotationPaddingLeft:aa7:acy', [1, NaN], 'XAxisAnnotationPaddingRight:aa8:acz', [1, NaN], 'XAxisAnnotationPaddingTop:aa9:ac0', [1, NaN], 'XAxisAnnotationStrokeThickness:aba:ac1', [1, NaN], 'XAxisAnnotationTextColor:adh:ac2', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:abb:ac3', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:adi:ac4', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:abi:ac5', [1, -1], 'YAxisAnnotationOutline:adj:ac6', [Brush.$, null], 'YAxisAnnotationPaddingBottom:abc:ac7', [1, NaN], 'YAxisAnnotationPaddingLeft:abd:ac8', [1, NaN], 'YAxisAnnotationPaddingRight:abe:ac9', [1, NaN], 'YAxisAnnotationPaddingTop:abf:ada', [1, NaN], 'YAxisAnnotationStrokeThickness:abg:adb', [1, NaN], 'YAxisAnnotationTextColor:adk:adc', [Brush.$, null]]);
return CrosshairLayer;
}(AnnotationLayer));
export { CrosshairLayer };
/**
* @hidden
*/
var CrosshairLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(CrosshairLayerView, _super);
function CrosshairLayerView(a) {
var _this = _super.call(this, a) || this;
_this.cn = null;
_this.co = null;
_this.cp = null;
_this.cn = a;
_this.cp = new List$1(Path.$, 0);
return _this;
}
CrosshairLayerView.prototype.a4 = function () {
var _this = this;
_super.prototype.a4.call(this);
this.co = ((function () {
var $ret = new Pool$1(Path.$);
$ret.create = runOn(_this, _this.cu);
$ret.activate = runOn(_this, _this.cq);
$ret.disactivate = runOn(_this, _this.cs);
$ret.destroy = runOn(_this, _this.cr);
return $ret;
})());
this.cn.jy = Defaults.crosshairLineThickness;
};
CrosshairLayerView.prototype.cu = function () {
var a = new Path();
a.j = new TranslateTransform();
this.cp.add(a);
return a;
};
CrosshairLayerView.prototype.cq = function (a) {
a._visibility = 0;
};
CrosshairLayerView.prototype.cs = function (a) {
a._visibility = 1;
};
CrosshairLayerView.prototype.cr = function (a) {
this.cp.remove(a);
};
CrosshairLayerView.prototype.ct = function (a, b, c, d) {
if (a.an == null || a.an.c.x != d || a.an.d.x != c) {
var e = ((function () {
var $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: c, y: b };
$ret.c = { $type: Point_$type, x: d, y: b };
return $ret;
})());
a.an = e;
}
};
CrosshairLayerView.prototype.bj = function (a, b) {
_super.prototype.bj.call(this, a, b);
if (a.d && !b) {
for (var c = 0; c < this.cp.count; c++) {
var d = this.cp._inner[c];
if (d._visibility == 0) {
a.t(d);
}
}
}
};
CrosshairLayerView.prototype.ax = function (a) {
_super.prototype.ax.call(this, a);
for (var b = 0; b < this.cp.count; b++) {
this.f.bc.exportPathData(a, this.cp._inner[b], "crosshairLine", ["Main", "Crosshair"]);
}
};
CrosshairLayerView.$t = markType(CrosshairLayerView, 'CrosshairLayerView', AnnotationLayerView.$);
return CrosshairLayerView;
}(AnnotationLayerView));
export { CrosshairLayerView };