igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
565 lines (564 loc) • 20.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 { 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 { 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.ac9 = null;
_this.aas = null;
_this.aar = null;
var a = new CrosshairLayerFrame();
var b = new CrosshairLayerFrame();
var c = new CrosshairLayerFrame();
var d = _this.kh / 1000;
_this.xn = a;
_this.xm = b;
_this.xo = c;
_this.ab = CrosshairLayer.$;
return _this;
}
CrosshairLayer.prototype.bk = function () {
return new CrosshairLayer();
};
CrosshairLayer.prototype.get_et = function () {
return true;
};
CrosshairLayer.prototype.get_er = function () {
return true;
};
CrosshairLayer.prototype.ct = function () {
return new CrosshairLayerView(this);
};
CrosshairLayer.prototype.q8 = function (a) {
_super.prototype.q8.call(this, a);
this.aai = a;
};
CrosshairLayer.prototype.gv = function (a) {
if (this.aaj == null) {
return true;
}
if (this.aaj == a) {
return true;
}
return false;
};
CrosshairLayer.prototype.aak = function () {
return this.xAxisAnnotationFormatLabel != null;
};
CrosshairLayer.prototype.aal = function () {
return this.yAxisAnnotationFormatLabel != null;
};
Object.defineProperty(CrosshairLayer.prototype, "adb", {
get: function () {
return new Thickness(1, this.aav, this.aax, this.aaw, this.aau);
},
enumerable: false,
configurable: true
});
Object.defineProperty(CrosshairLayer.prototype, "adc", {
get: function () {
return new Thickness(1, this.aa1, this.aa3, this.aa2, this.aa0);
},
enumerable: false,
configurable: true
});
CrosshairLayer.prototype.y2 = function (a, b) {
if (this.aaj == null || this.aaj == a) {
if (!this.a1.c) {
this.rz(b);
}
}
};
CrosshairLayer.prototype.y4 = function (a, b) {
var e_1, _a;
var _this = this;
_super.prototype.y4.call(this, a, b);
var c = a;
var d = this.aaq;
var e = this.aap;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
if (this.xt(this.aaj)) {
this.ab4(this.aaj, c, d, e);
}
else {
try {
for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var f = _c.value;
if (this.xt(f)) {
this.ab4(f, c, d, e);
}
if (f.isStacked) {
f.p9(function (g) {
if (_this.xt(g)) {
_this.ab4(g, c, d, e);
}
if (g.ei) {
g.p7(function (h) {
if (_this.xt(h)) {
_this.ab4(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.p7(function (g) {
if (_this.xt(g)) {
_this.ab4(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.xt = function (a) {
if (!_super.prototype.xt.call(this, a)) {
return false;
}
if (this.abd != null) {
if (a.isFragment) {
var b = a.nh();
if (!Base.equalsStatic(this.abd, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abd, a.name)) {
return false;
}
}
}
var c = this.yx(a);
if (!c.c) {
return false;
}
return true;
};
CrosshairLayer.prototype.qw = function () {
_super.prototype.qw.call(this);
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.ab5(this.xo, false);
}
else {
this.ab5(this.xm, false);
}
};
CrosshairLayer.prototype.xd = function () {
return 1;
};
CrosshairLayer.prototype.x0 = function () {
return 0.1;
};
CrosshairLayer.prototype.x3 = function () {
return -0.4;
};
CrosshairLayer.prototype.x2 = function () {
return 0.5;
};
CrosshairLayer.prototype.z5 = function () {
return this.xa == 3 ? this.ada() : null;
};
CrosshairLayer.prototype.z6 = function () {
return this.xb == 3 ? this.ada() : null;
};
CrosshairLayer.prototype.ada = function () {
if (this.ac9 == null) {
this.ac9 = new DoubleCollection();
this.ac9.add(DeviceUtils.g(5));
this.ac9.add(DeviceUtils.g(5));
}
return this.ac9;
};
CrosshairLayer.prototype.ab4 = function (a, b, c, d) {
var e = this.yx(a);
if (!e.c) {
return;
}
var f = e.d;
var g = a.i8(f, c, d);
if (this.aan && isNaN_(g)) {
return;
}
if (this.aao && a.isFragment && g == 0) {
return;
}
f = a.wn(f, c, d);
var h = false;
var i = this.vk;
if (i == null) {
i = this.vq;
}
if (i == null) {
i = a.vk;
h = true;
}
var j = false;
var k = this.ac3;
if (k == null) {
if (this.vq != null) {
k = this.vq;
}
else {
k = a.vk;
j = true;
}
}
var l = false;
var m = this.ac6;
if (m == null) {
if (this.vq != null) {
m = this.vq;
}
else {
m = a.vk;
l = true;
}
}
var n = i;
var o = i;
var p = k;
var q = m;
if (this.ac1 != null) {
n = this.ac1;
}
else if (h) {
switch (this.xa) {
case 0:
case 1:
n = this.aai.ck(n, this.xx);
break;
case 2:
n = this.aai.cm(n, this.xx);
break;
case 4:
n = this.aai.cl(n, this.xx);
break;
}
}
if (this.ac2 != null) {
o = this.ac2;
}
else if (h) {
switch (this.xb) {
case 0:
case 1:
o = this.aai.ck(o, this.xz);
break;
case 2:
o = this.aai.cm(o, this.xz);
break;
case 4:
o = this.aai.cl(o, this.xz);
break;
}
}
if (j) {
switch (this.xb) {
case 1:
p = this.aai.ck(p, this.xz);
break;
case 2:
p = this.aai.cm(p, this.xz);
break;
}
}
if (l) {
switch (this.xa) {
case 1:
q = this.aai.ck(q, this.xx);
break;
case 2:
q = this.aai.cm(q, this.xx);
break;
}
}
b.ae.add(n);
b.ah.add(o);
b.af.add(f.y);
b.ag.add(f.x);
if (this.aam && !isNaN_(f.y)) {
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), i, p, this.aat, this.ac5, this.ac4, this.adb, this.aay, q, this.aaz, this.ac8, this.ac7, this.adc, this.aa4, this.ade == 0, this.add == 0);
}
};
CrosshairLayer.prototype.ab5 = function (a, b) {
var c = false;
if (this.aar == null) {
c = true;
this.aas = new List$1(Axis.$, 0);
this.aar = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aar, this.aas, b, this.aa5, this.aa6, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
};
CrosshairLayer.prototype.ab3 = function (a, b, c, d, e) {
var f = a.item(b);
b++;
if (e) {
f._stroke = d.ah._inner[c];
f._fill = d.ah._inner[c];
}
else {
f._stroke = d.ae._inner[c];
f._fill = d.ae._inner[c];
}
f.ad = this.ig;
f.ai = e ? this.z3 : this.z2;
f.am = this.wg;
f.al = this.wf;
f.ak = this.wf;
f.aj = this.we;
f.ac = this.jk;
return new Tuple$2(Path.$, Number_$type, f, b);
};
CrosshairLayer.prototype.y7 = function (a, b) {
_super.prototype.y7.call(this, a, b);
var c = this.aai.co;
var d = a;
var e = d.af.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.ade == 0;
var l = this.add == 0;
for (var m = 0; m < e; m++) {
var n = Math.floor(d.af._inner[m]);
var o = Math.floor(d.ag._inner[m]);
var p = null;
if (k) {
if (isNaN_(n)) {
continue;
}
var q = this.ab3(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.ab3(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.ab5(this.xo, true);
}
else {
this.ab5(this.xm, false);
}
};
CrosshairLayer.prototype.gb = function () {
return true;
};
CrosshairLayer.prototype.rh = function (a, b, c, d) {
_super.prototype.rh.call(this, a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aar != null && this.aar.count > 0) {
var e = void 0;
if (this.d4()) {
e = this.xo;
}
else {
e = this.xm;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aar, this.aas, true, this.aa5, this.aa6, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.rz(true);
break;
case CrosshairLayer.$$p[10]:
this.rz(true);
break;
case CrosshairLayer.$$p[6]:
case CrosshairLayer.$$p[7]:
this.rz(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.rz(true);
break;
}
};
CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:ac1:ab6', [Brush.$, null], 'HorizontalLineVisibility:add:ab7', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aam:ab8', [0, false], 'SkipAxisAnnotationOnInvalidData:aan:ab9', [0, false], 'SkipAxisAnnotationOnZeroValueFragments:aao:aca', [0, false], 'SkipUnknownValues:aap:acb', [0, true], 'TargetSeriesName:abd:acc', [2, null], 'TargetSeries:aaj:acd', [Series.$, null], 'UseInterpolation:aaq:ace', [0, true], 'VerticalLineStroke:ac2:acf', [Brush.$, null], 'VerticalLineVisibility:ade:acg', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aat:ach', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:ac3:aci', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aa5:acj', [1, -1], 'XAxisAnnotationOutline:ac4:ack', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aau:acl', [1, NaN], 'XAxisAnnotationPaddingLeft:aav:acm', [1, NaN], 'XAxisAnnotationPaddingRight:aaw:acn', [1, NaN], 'XAxisAnnotationPaddingTop:aax:aco', [1, NaN], 'XAxisAnnotationStrokeThickness:aay:acp', [1, NaN], 'XAxisAnnotationTextColor:ac5:acq', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aaz:acr', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:ac6:acs', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aa6:act', [1, -1], 'YAxisAnnotationOutline:ac7:acu', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aa0:acv', [1, NaN], 'YAxisAnnotationPaddingLeft:aa1:acw', [1, NaN], 'YAxisAnnotationPaddingRight:aa2:acx', [1, NaN], 'YAxisAnnotationPaddingTop:aa3:acy', [1, NaN], 'YAxisAnnotationStrokeThickness:aa4:acz', [1, NaN], 'YAxisAnnotationTextColor:ac8:ac0', [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.jt = 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 };