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.ac3 = null;
this.aam = null;
this.aal = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.ke / 1000;
this.xh = a;
this.xg = b;
this.xi = c;
this.ab = CrosshairLayer.$;
}
ct() {
return new CrosshairLayerView(this);
}
q3(a) {
super.q3(a);
this.aac = a;
}
gv(a) {
if (this.aad == null) {
return true;
}
if (this.aad == a) {
return true;
}
return false;
}
aae() {
return this.xAxisAnnotationFormatLabel != null;
}
aaf() {
return this.yAxisAnnotationFormatLabel != null;
}
get ac5() {
return new Thickness(1, this.aap, this.aar, this.aaq, this.aao);
}
get ac6() {
return new Thickness(1, this.aav, this.aax, this.aaw, this.aau);
}
yw(a, b) {
if (this.aad == null || this.aad == a) {
if (!this.a1.c) {
this.ru(b);
}
}
}
yy(a, b) {
super.yy(a, b);
let c = a;
let d = this.aak;
let e = this.aaj;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
if (this.xn(this.aad)) {
this.aby(this.aad, c, d, e);
}
else {
for (let f of fromEnum(this.dc.series)) {
if (this.xn(f)) {
this.aby(f, c, d, e);
}
if (f.isStacked) {
f.p5((g) => {
if (this.xn(g)) {
this.aby(g, c, d, e);
}
if (g.ei) {
g.p3((h) => {
if (this.xn(h)) {
this.aby(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.p3((g) => {
if (this.xn(g)) {
this.aby(g, c, d, e);
}
return true;
});
}
}
}
}
xn(a) {
if (!super.xn(a)) {
return false;
}
if (this.aa7 != null) {
if (a.isFragment) {
let b = a.ne();
if (!Base.equalsStatic(this.aa7, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aa7, a.name)) {
return false;
}
}
}
let c = this.yr(a);
if (!c.c) {
return false;
}
return true;
}
qr() {
super.qr();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.abz(this.xi, false);
}
else {
this.abz(this.xg, false);
}
}
w7() {
return 1;
}
xu() {
return 0.1;
}
xx() {
return -0.4;
}
xw() {
return 0.5;
}
zz() {
return this.w4 == 3 ? this.ac4() : null;
}
z0() {
return this.w5 == 3 ? this.ac4() : null;
}
ac4() {
if (this.ac3 == null) {
this.ac3 = new DoubleCollection();
this.ac3.add(DeviceUtils.g(5));
this.ac3.add(DeviceUtils.g(5));
}
return this.ac3;
}
aby(a, b, c, d) {
let e = this.yr(a);
if (!e.c) {
return;
}
let f = e.d;
let g = a.i6(f, c, d);
if (this.aah && isNaN_(g)) {
return;
}
if (this.aai && a.isFragment && g == 0) {
return;
}
f = a.wh(f, c, d);
let h = false;
let i = this.ve;
if (i == null) {
i = this.vk;
}
if (i == null) {
i = a.ve;
h = true;
}
let j = false;
let k = this.acx;
if (k == null) {
if (this.vk != null) {
k = this.vk;
}
else {
k = a.ve;
j = true;
}
}
let l = false;
let m = this.ac0;
if (m == null) {
if (this.vk != null) {
m = this.vk;
}
else {
m = a.ve;
l = true;
}
}
let n = i;
let o = i;
let p = k;
let q = m;
if (this.acv != null) {
n = this.acv;
}
else if (h) {
switch (this.w4) {
case 0:
case 1:
n = this.aac.ck(n, this.xr);
break;
case 2:
n = this.aac.cm(n, this.xr);
break;
case 4:
n = this.aac.cl(n, this.xr);
break;
}
}
if (this.acw != null) {
o = this.acw;
}
else if (h) {
switch (this.w5) {
case 0:
case 1:
o = this.aac.ck(o, this.xt);
break;
case 2:
o = this.aac.cm(o, this.xt);
break;
case 4:
o = this.aac.cl(o, this.xt);
break;
}
}
if (j) {
switch (this.w5) {
case 1:
p = this.aac.ck(p, this.xt);
break;
case 2:
p = this.aac.cm(p, this.xt);
break;
}
}
if (l) {
switch (this.w4) {
case 1:
q = this.aac.ck(q, this.xr);
break;
case 2:
q = this.aac.cm(q, this.xr);
break;
}
}
b.ae.add(n);
b.ah.add(o);
b.af.add(f.y);
b.ag.add(f.x);
if (this.aag && !isNaN_(f.y)) {
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), i, p, this.aan, this.acz, this.acy, this.ac5, this.aas, q, this.aat, this.ac2, this.ac1, this.ac6, this.aay, this.ac8 == 0, this.ac7 == 0);
}
}
abz(a, b) {
let c = false;
if (this.aal == null) {
c = true;
this.aam = new List$1(Axis.$, 0);
this.aal = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aal, this.aam, b, this.aaz, this.aa0, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
abx(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.zx : this.zw;
f.am = this.wa;
f.al = this.v9;
f.ak = this.v9;
f.aj = this.v8;
f.ac = this.ji;
return new Tuple$2(Path.$, Number_$type, f, b);
}
y1(a, b) {
super.y1(a, b);
let c = this.aac.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.ac8 == 0;
let l = this.ac7 == 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.abx(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.abx(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.abz(this.xi, true);
}
else {
this.abz(this.xg, false);
}
}
gb() {
return true;
}
rc(a, b, c, d) {
super.rc(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aal != null && this.aal.count > 0) {
let e;
if (this.d4()) {
e = this.xi;
}
else {
e = this.xg;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aal, this.aam, true, this.aaz, this.aa0, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.ru(true);
break;
case CrosshairLayer.$$p[10]:
this.ru(true);
break;
case CrosshairLayer.$$p[6]:
case CrosshairLayer.$$p[7]:
this.ru(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.ru(true);
break;
}
}
}
CrosshairLayer.$t = /*@__PURE__*/ markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acv:ab0', [Brush.$, null], 'HorizontalLineVisibility:ac7:ab1', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aag:ab2', [0, false], 'SkipAxisAnnotationOnInvalidData:aah:ab3', [0, false], 'SkipAxisAnnotationOnZeroValueFragments:aai:ab4', [0, false], 'SkipUnknownValues:aaj:ab5', [0, true], 'TargetSeriesName:aa7:ab6', [2, null], 'TargetSeries:aad:ab7', [Series.$, null], 'UseInterpolation:aak:ab8', [0, true], 'VerticalLineStroke:acw:ab9', [Brush.$, null], 'VerticalLineVisibility:ac8:aca', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aan:acb', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'XAxisAnnotationBackground:acx:acc', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aaz:acd', [1, -1], 'XAxisAnnotationOutline:acy:ace', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aao:acf', [1, NaN], 'XAxisAnnotationPaddingLeft:aap:acg', [1, NaN], 'XAxisAnnotationPaddingRight:aaq:ach', [1, NaN], 'XAxisAnnotationPaddingTop:aar:aci', [1, NaN], 'XAxisAnnotationStrokeThickness:aas:acj', [1, NaN], 'XAxisAnnotationTextColor:acz:ack', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aat:acl', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'YAxisAnnotationBackground:ac0:acm', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aa0:acn', [1, -1], 'YAxisAnnotationOutline:ac1:aco', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aau:acp', [1, NaN], 'YAxisAnnotationPaddingLeft:aav:acq', [1, NaN], 'YAxisAnnotationPaddingRight:aaw:acr', [1, NaN], 'YAxisAnnotationPaddingTop:aax:acs', [1, NaN], 'YAxisAnnotationStrokeThickness:aay:act', [1, NaN], 'YAxisAnnotationTextColor:ac2:acu', [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.jq = 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;
})();