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.adn = null;
_this.aa6 = null;
_this.aa5 = null;
var a = new CrosshairLayerFrame();
var b = new CrosshairLayerFrame();
var c = new CrosshairLayerFrame();
var d = _this.ko / 1000;
_this.xz = a;
_this.xy = b;
_this.x0 = 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.rj = function (a) {
_super.prototype.rj.call(this, a);
this.aaw = a;
};
CrosshairLayer.prototype.g2 = function (a) {
if (this.aax == null) {
return true;
}
if (this.aax == a) {
return true;
}
return false;
};
CrosshairLayer.prototype.aay = function () {
return this.xAxisAnnotationFormatLabel != null;
};
CrosshairLayer.prototype.aaz = function () {
return this.yAxisAnnotationFormatLabel != null;
};
Object.defineProperty(CrosshairLayer.prototype, "adp", {
get: function () {
return new Thickness(1, this.aa9, this.abb, this.aba, this.aa8);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CrosshairLayer.prototype, "adq", {
get: function () {
return new Thickness(1, this.abf, this.abh, this.abg, this.abe);
},
enumerable: false,
configurable: true
});
CrosshairLayer.prototype.zf = function (a, b) {
if (this.aax == null || this.aax == a) {
if (!this.a1.c) {
this.sa(b);
}
}
};
CrosshairLayer.prototype.zh = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.zh.call(this, a, b);
var c = a;
var d = this.aa4;
var e = this.aa3;
c.a1.clear();
c.a2.clear();
c.a0.clear();
c.a3.clear();
AxisAnnotationFrameManager.b(c);
if (this.x6(this.aax)) {
this.aci(this.aax, 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.x6(f)) {
this.aci(f, c, d, e);
}
if (f.isStacked) {
f.qj(function (g) {
if (_this.x6(g)) {
_this.aci(g, c, d, e);
}
if (g.ei) {
g.qh(function (h) {
if (_this.x6(h)) {
_this.aci(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.qh(function (g) {
if (_this.x6(g)) {
_this.aci(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.x6 = function (a) {
if (!_super.prototype.x6.call(this, a)) {
return false;
}
if (this.abr != null) {
if (a.isFragment) {
var b = a.np();
if (!Base.equalsStatic(this.abr, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abr, a.name)) {
return false;
}
}
}
var c = this.o1(a, this.aar);
if (!c.c) {
return false;
}
return true;
};
CrosshairLayer.prototype.q6 = function () {
_super.prototype.q6.call(this);
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.acj(this.x0, false);
}
else {
this.acj(this.xy, false);
}
};
CrosshairLayer.prototype.xp = function () {
return 1;
};
CrosshairLayer.prototype.yd = function () {
return 0.1;
};
CrosshairLayer.prototype.yg = function () {
return -0.4;
};
CrosshairLayer.prototype.yf = function () {
return 0.5;
};
CrosshairLayer.prototype.aaj = function () {
return this.xm == 3 ? this.ado() : null;
};
CrosshairLayer.prototype.aak = function () {
return this.xn == 3 ? this.ado() : null;
};
CrosshairLayer.prototype.ado = function () {
if (this.adn == null) {
this.adn = new DoubleCollection();
this.adn.add(DeviceUtils.g(5));
this.adn.add(DeviceUtils.g(5));
}
return this.adn;
};
CrosshairLayer.prototype.aci = function (a, b, c, d) {
var e = this.o1(a, this.aar);
if (!e.c) {
return;
}
var f = e.d;
var g = a.jf(f, c, d);
if (this.aa1 && isNaN_(g)) {
return;
}
if (this.aa2 && a.isFragment && g == 0) {
return;
}
f = a.wy(f, c, d);
var h = false;
var i = this.vv;
if (i == null) {
i = this.v1;
}
if (i == null) {
i = a.vv;
h = true;
}
var j = false;
var k = this.adh;
if (k == null) {
if (this.v1 != null) {
k = this.v1;
}
else {
k = a.vv;
j = true;
}
}
var l = false;
var m = this.adk;
if (m == null) {
if (this.v1 != null) {
m = this.v1;
}
else {
m = a.vv;
l = true;
}
}
var n = i;
var o = i;
var p = k;
var q = m;
if (this.adf != null) {
n = this.adf;
}
else if (h) {
switch (this.xm) {
case 0:
case 1:
n = this.aaw.ck(n, this.ya);
break;
case 2:
n = this.aaw.cm(n, this.ya);
break;
case 4:
n = this.aaw.cl(n, this.ya);
break;
}
}
if (this.adg != null) {
o = this.adg;
}
else if (h) {
switch (this.xn) {
case 0:
case 1:
o = this.aaw.ck(o, this.yc);
break;
case 2:
o = this.aaw.cm(o, this.yc);
break;
case 4:
o = this.aaw.cl(o, this.yc);
break;
}
}
if (j) {
switch (this.xn) {
case 1:
p = this.aaw.ck(p, this.yc);
break;
case 2:
p = this.aaw.cm(p, this.yc);
break;
}
}
if (l) {
switch (this.xm) {
case 1:
q = this.aaw.ck(q, this.ya);
break;
case 2:
q = this.aaw.cm(q, this.ya);
break;
}
}
b.a0.add(n);
b.a3.add(o);
b.a1.add(f.y);
b.a2.add(f.x);
if (this.aa0 && !isNaN_(f.y)) {
var r = new AxisAnnotationFramePrepareSettings();
r.u = p;
r.y = this.adj;
r.x = this.adi;
r.g = this.aa7;
r.ae = this.adp;
r.l = this.abc;
r.c = this.ads == 0;
r.z = q;
r.ad = this.adm;
r.ac = this.adl;
r.m = this.abd;
r.af = this.adq;
r.r = this.abi;
r.d = this.adr == 0;
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), i, r);
}
};
CrosshairLayer.prototype.acj = function (a, b) {
var c = false;
if (this.aa5 == null) {
c = true;
this.aa6 = new List$1(Axis.$, 0);
this.aa5 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aa5, this.aa6, b, this.abj, this.abk, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
};
CrosshairLayer.prototype.ach = 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.io;
f.ai = e ? this.aah : this.aag;
f.am = this.wr;
f.al = this.wq;
f.ak = this.wq;
f.aj = this.wp;
f.ac = this.jr;
return new Tuple$2(Path.$, Number_$type, f, b);
};
CrosshairLayer.prototype.zk = function (a, b) {
_super.prototype.zk.call(this, a, b);
var c = this.aaw.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.ads == 0;
var l = this.adr == 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.ach(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.ach(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.acj(this.x0, true);
}
else {
this.acj(this.xy, false);
}
};
CrosshairLayer.prototype.gi = function () {
return true;
};
CrosshairLayer.prototype.rs = function (a, b, c, d) {
_super.prototype.rs.call(this, a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aa5 != null && this.aa5.count > 0) {
var e = void 0;
if (this.d4()) {
e = this.x0;
}
else {
e = this.xy;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aa5, this.aa6, true, this.abj, this.abk, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.sa(true);
break;
case CrosshairLayer.$$p[10]:
this.sa(true);
break;
case CrosshairLayer.$$p[6]:
case CrosshairLayer.$$p[7]:
this.sa(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.sa(true);
break;
}
};
CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:adf:ack', [Brush.$, null], 'HorizontalLineVisibility:adr:acl', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aa0:acm', [0, false], 'SkipAxisAnnotationOnInvalidData:aa1:acn', [0, false], 'SkipAxisAnnotationOnZeroValueFragments:aa2:aco', [0, false], 'SkipUnknownValues:aa3:acp', [0, true], 'TargetSeriesName:abr:acq', [2, null], 'TargetSeries:aax:acr', [Series.$, null], 'UseInterpolation:aa4:acs', [0, true], 'VerticalLineStroke:adg:act', [Brush.$, null], 'VerticalLineVisibility:ads:acu', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aa7:acv', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:adh:acw', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:abj:acx', [1, -1], 'XAxisAnnotationOutline:adi:acy', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aa8:acz', [1, NaN], 'XAxisAnnotationPaddingLeft:aa9:ac0', [1, NaN], 'XAxisAnnotationPaddingRight:aba:ac1', [1, NaN], 'XAxisAnnotationPaddingTop:abb:ac2', [1, NaN], 'XAxisAnnotationStrokeThickness:abc:ac3', [1, NaN], 'XAxisAnnotationTextColor:adj:ac4', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:abd:ac5', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:adk:ac6', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:abk:ac7', [1, -1], 'YAxisAnnotationOutline:adl:ac8', [Brush.$, null], 'YAxisAnnotationPaddingBottom:abe:ac9', [1, NaN], 'YAxisAnnotationPaddingLeft:abf:ada', [1, NaN], 'YAxisAnnotationPaddingRight:abg:adb', [1, NaN], 'YAxisAnnotationPaddingTop:abh:adc', [1, NaN], 'YAxisAnnotationStrokeThickness:abi:add', [1, NaN], 'YAxisAnnotationTextColor:adm:ade', [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.j0 = 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 };