igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
535 lines (534 loc) • 19.7 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 { 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
*/
export let CrosshairLayer = /*@__PURE__*/ (() => {
class CrosshairLayer extends AnnotationLayer {
bk() {
return new CrosshairLayer();
}
get_et() {
return true;
}
get_er() {
return true;
}
constructor() {
super();
this.xAxisAnnotationFormatLabel = null;
this.yAxisAnnotationFormatLabel = null;
this.ac9 = null;
this.aas = null;
this.aar = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.kh / 1000;
this.xn = a;
this.xm = b;
this.xo = c;
this.ab = CrosshairLayer.$;
}
ct() {
return new CrosshairLayerView(this);
}
q8(a) {
super.q8(a);
this.aai = a;
}
gv(a) {
if (this.aaj == null) {
return true;
}
if (this.aaj == a) {
return true;
}
return false;
}
aak() {
return this.xAxisAnnotationFormatLabel != null;
}
aal() {
return this.yAxisAnnotationFormatLabel != null;
}
get adb() {
return new Thickness(1, this.aav, this.aax, this.aaw, this.aau);
}
get adc() {
return new Thickness(1, this.aa1, this.aa3, this.aa2, this.aa0);
}
y2(a, b) {
if (this.aaj == null || this.aaj == a) {
if (!this.a1.c) {
this.rz(b);
}
}
}
y4(a, b) {
super.y4(a, b);
let c = a;
let d = this.aaq;
let 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 {
for (let f of fromEnum(this.dc.series)) {
if (this.xt(f)) {
this.ab4(f, c, d, e);
}
if (f.isStacked) {
f.p9((g) => {
if (this.xt(g)) {
this.ab4(g, c, d, e);
}
if (g.ei) {
g.p7((h) => {
if (this.xt(h)) {
this.ab4(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.p7((g) => {
if (this.xt(g)) {
this.ab4(g, c, d, e);
}
return true;
});
}
}
}
}
xt(a) {
if (!super.xt(a)) {
return false;
}
if (this.abd != null) {
if (a.isFragment) {
let b = a.nh();
if (!Base.equalsStatic(this.abd, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abd, a.name)) {
return false;
}
}
}
let c = this.yx(a);
if (!c.c) {
return false;
}
return true;
}
qw() {
super.qw();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.ab5(this.xo, false);
}
else {
this.ab5(this.xm, false);
}
}
xd() {
return 1;
}
x0() {
return 0.1;
}
x3() {
return -0.4;
}
x2() {
return 0.5;
}
z5() {
return this.xa == 3 ? this.ada() : null;
}
z6() {
return this.xb == 3 ? this.ada() : null;
}
ada() {
if (this.ac9 == null) {
this.ac9 = new DoubleCollection();
this.ac9.add(DeviceUtils.g(5));
this.ac9.add(DeviceUtils.g(5));
}
return this.ac9;
}
ab4(a, b, c, d) {
let e = this.yx(a);
if (!e.c) {
return;
}
let f = e.d;
let 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);
let h = false;
let i = this.vk;
if (i == null) {
i = this.vq;
}
if (i == null) {
i = a.vk;
h = true;
}
let j = false;
let k = this.ac3;
if (k == null) {
if (this.vq != null) {
k = this.vq;
}
else {
k = a.vk;
j = true;
}
}
let l = false;
let m = this.ac6;
if (m == null) {
if (this.vq != null) {
m = this.vq;
}
else {
m = a.vk;
l = true;
}
}
let n = i;
let o = i;
let p = k;
let 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);
}
}
ab5(a, b) {
let 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);
}
ab3(a, b, c, d, e) {
let 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);
}
y7(a, b) {
super.y7(a, b);
let c = this.aai.co;
let d = a;
let e = d.af.count;
let f = 0;
let g = b.b9.left;
let h = b.b9.right;
let i = b.b9.top;
let j = b.b9.bottom;
let k = this.ade == 0;
let l = this.add == 0;
for (let m = 0; m < e; m++) {
let n = Math.floor(d.af._inner[m]);
let o = Math.floor(d.ag._inner[m]);
let p = null;
if (k) {
if (isNaN_(n)) {
continue;
}
let q = this.ab3(c, f, m, d, true);
p = q.c;
f = q.d;
let r = new PathGeometry();
let s = new PathFigure();
s._startPoint = { $type: Point_$type, x: o, y: i };
let 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;
}
let u = this.ab3(c, f, m, d, false);
p = u.c;
f = u.d;
let v = new PathGeometry();
let w = new PathFigure();
w._startPoint = { $type: Point_$type, x: g, y: n };
let 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);
}
}
gb() {
return true;
}
rh(a, b, c, d) {
super.rh(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aar != null && this.aar.count > 0) {
let e;
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 = /*@__PURE__*/ markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:ac1:ab6', [Brush.$, null], 'HorizontalLineVisibility:add:ab7', [Visibility_$type, /*@__PURE__*/ 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, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aat:ach', [1, /*@__PURE__*/ 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, /*@__PURE__*/ 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;
})();
/**
* @hidden
*/
export let CrosshairLayerView = /*@__PURE__*/ (() => {
class CrosshairLayerView extends AnnotationLayerView {
constructor(a) {
super(a);
this.cn = null;
this.co = null;
this.cp = null;
this.cn = a;
this.cp = new List$1(Path.$, 0);
}
a4() {
super.a4();
this.co = ((() => {
let $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;
}
cu() {
let a = new Path();
a.j = new TranslateTransform();
this.cp.add(a);
return a;
}
cq(a) {
a._visibility = 0;
}
cs(a) {
a._visibility = 1;
}
cr(a) {
this.cp.remove(a);
}
ct(a, b, c, d) {
if (a.an == null || a.an.c.x != d || a.an.d.x != c) {
let e = ((() => {
let $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;
}
}
bj(a, b) {
super.bj(a, b);
if (a.d && !b) {
for (let c = 0; c < this.cp.count; c++) {
let d = this.cp._inner[c];
if (d._visibility == 0) {
a.t(d);
}
}
}
}
ax(a) {
super.ax(a);
for (let b = 0; b < this.cp.count; b++) {
this.f.bc.exportPathData(a, this.cp._inner[b], "crosshairLine", ["Main", "Crosshair"]);
}
}
}
CrosshairLayerView.$t = /*@__PURE__*/ markType(CrosshairLayerView, 'CrosshairLayerView', AnnotationLayerView.$);
return CrosshairLayerView;
})();