igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
551 lines (550 loc) • 20.2 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 { 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
*/
export let CrosshairLayer = /*@__PURE__*/ (() => {
class CrosshairLayer extends AnnotationLayer {
bk() {
return new CrosshairLayer();
}
get_eu() {
return true;
}
get_er() {
return true;
}
constructor() {
super();
this.xAxisAnnotationFormatLabel = null;
this.yAxisAnnotationFormatLabel = null;
this.adm = null;
this.aa5 = null;
this.aa4 = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.kn / 1000;
this.xy = a;
this.xx = b;
this.xz = c;
this.ab = CrosshairLayer.$;
}
ct() {
return new CrosshairLayerView(this);
}
ri(a) {
super.ri(a);
this.aav = a;
}
g1(a) {
if (this.aaw == null) {
return true;
}
if (this.aaw == a) {
return true;
}
return false;
}
aax() {
return this.xAxisAnnotationFormatLabel != null;
}
aay() {
return this.yAxisAnnotationFormatLabel != null;
}
get ado() {
return new Thickness(1, this.aa8, this.aba, this.aa9, this.aa7);
}
get adp() {
return new Thickness(1, this.abe, this.abg, this.abf, this.abd);
}
ze(a, b) {
if (this.aaw == null || this.aaw == a) {
if (!this.a1.c) {
this.r9(b);
}
}
}
zg(a, b) {
super.zg(a, b);
let c = a;
let d = this.aa3;
let e = this.aa2;
c.a1.clear();
c.a2.clear();
c.a0.clear();
c.a3.clear();
AxisAnnotationFrameManager.b(c);
if (this.x5(this.aaw)) {
this.ach(this.aaw, c, d, e);
}
else {
for (let f of fromEnum(this.dc.b9)) {
if (this.x5(f)) {
this.ach(f, c, d, e);
}
if (f.isStacked) {
f.qi((g) => {
if (this.x5(g)) {
this.ach(g, c, d, e);
}
if (g.ei) {
g.qg((h) => {
if (this.x5(h)) {
this.ach(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.qg((g) => {
if (this.x5(g)) {
this.ach(g, c, d, e);
}
return true;
});
}
}
}
}
x5(a) {
if (!super.x5(a)) {
return false;
}
if (this.abq != null) {
if (a.isFragment) {
let b = a.no();
if (!Base.equalsStatic(this.abq, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abq, a.name)) {
return false;
}
}
}
let c = this.o0(a, this.aaq);
if (!c.c) {
return false;
}
return true;
}
q5() {
super.q5();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.aci(this.xz, false);
}
else {
this.aci(this.xx, false);
}
}
xo() {
return 1;
}
yc() {
return 0.1;
}
yf() {
return -0.4;
}
ye() {
return 0.5;
}
aai() {
return this.xl == 3 ? this.adn() : null;
}
aaj() {
return this.xm == 3 ? this.adn() : null;
}
adn() {
if (this.adm == null) {
this.adm = new DoubleCollection();
this.adm.add(DeviceUtils.g(5));
this.adm.add(DeviceUtils.g(5));
}
return this.adm;
}
ach(a, b, c, d) {
let e = this.o0(a, this.aaq);
if (!e.c) {
return;
}
let f = e.d;
let g = a.je(f, c, d);
if (this.aa0 && isNaN_(g)) {
return;
}
if (this.aa1 && a.isFragment && g == 0) {
return;
}
f = a.wx(f, c, d);
let h = false;
let i = this.vu;
if (i == null) {
i = this.v0;
}
if (i == null) {
i = a.vu;
h = true;
}
let j = false;
let k = this.adg;
if (k == null) {
if (this.v0 != null) {
k = this.v0;
}
else {
k = a.vu;
j = true;
}
}
let l = false;
let m = this.adj;
if (m == null) {
if (this.v0 != null) {
m = this.v0;
}
else {
m = a.vu;
l = true;
}
}
let n = i;
let o = i;
let p = k;
let q = m;
if (this.ade != null) {
n = this.ade;
}
else if (h) {
switch (this.xl) {
case 0:
case 1:
n = this.aav.ck(n, this.x9);
break;
case 2:
n = this.aav.cm(n, this.x9);
break;
case 4:
n = this.aav.cl(n, this.x9);
break;
}
}
if (this.adf != null) {
o = this.adf;
}
else if (h) {
switch (this.xm) {
case 0:
case 1:
o = this.aav.ck(o, this.yb);
break;
case 2:
o = this.aav.cm(o, this.yb);
break;
case 4:
o = this.aav.cl(o, this.yb);
break;
}
}
if (j) {
switch (this.xm) {
case 1:
p = this.aav.ck(p, this.yb);
break;
case 2:
p = this.aav.cm(p, this.yb);
break;
}
}
if (l) {
switch (this.xl) {
case 1:
q = this.aav.ck(q, this.x9);
break;
case 2:
q = this.aav.cm(q, this.x9);
break;
}
}
b.a0.add(n);
b.a3.add(o);
b.a1.add(f.y);
b.a2.add(f.x);
if (this.aaz && !isNaN_(f.y)) {
let r = new AxisAnnotationFramePrepareSettings();
r.u = p;
r.y = this.adi;
r.x = this.adh;
r.g = this.aa6;
r.ae = this.ado;
r.l = this.abb;
r.c = this.adr == 0;
r.z = q;
r.ad = this.adl;
r.ac = this.adk;
r.m = this.abc;
r.af = this.adp;
r.r = this.abh;
r.d = this.adq == 0;
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), i, r);
}
}
aci(a, b) {
let c = false;
if (this.aa4 == null) {
c = true;
this.aa5 = new List$1(Axis.$, 0);
this.aa4 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aa4, this.aa5, b, this.abi, this.abj, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
acg(a, b, c, d, e) {
let 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.im;
f.ai = e ? this.aag : this.aaf;
f.am = this.wq;
f.al = this.wp;
f.ak = this.wp;
f.aj = this.wo;
f.ac = this.jq;
return new Tuple$2(Path.$, Number_$type, f, b);
}
zj(a, b) {
super.zj(a, b);
let c = this.aav.co;
let d = a;
let e = d.a1.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.adr == 0;
let l = this.adq == 0;
for (let m = 0; m < e; m++) {
let n = Math.floor(d.a1._inner[m]);
let o = Math.floor(d.a2._inner[m]);
let p = null;
if (k) {
if (isNaN_(n)) {
continue;
}
let q = this.acg(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.acg(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.aci(this.xz, true);
}
else {
this.aci(this.xx, false);
}
}
gh() {
return true;
}
rr(a, b, c, d) {
super.rr(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aa4 != null && this.aa4.count > 0) {
let e;
if (this.d4()) {
e = this.xz;
}
else {
e = this.xx;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aa4, this.aa5, true, this.abi, this.abj, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.r9(true);
break;
case CrosshairLayer.$$p[10]:
this.r9(true);
break;
case CrosshairLayer.$$p[6]:
case CrosshairLayer.$$p[7]:
this.r9(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.r9(true);
break;
}
}
}
CrosshairLayer.$t = /*@__PURE__*/ markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:ade:acj', [Brush.$, null], 'HorizontalLineVisibility:adq:ack', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aaz:acl', [0, false], 'SkipAxisAnnotationOnInvalidData:aa0:acm', [0, false], 'SkipAxisAnnotationOnZeroValueFragments:aa1:acn', [0, false], 'SkipUnknownValues:aa2:aco', [0, true], 'TargetSeriesName:abq:acp', [2, null], 'TargetSeries:aaw:acq', [Series.$, null], 'UseInterpolation:aa3:acr', [0, true], 'VerticalLineStroke:adf:acs', [Brush.$, null], 'VerticalLineVisibility:adr:act', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aa6:acu', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'XAxisAnnotationBackground:adg:acv', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:abi:acw', [1, -1], 'XAxisAnnotationOutline:adh:acx', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aa7:acy', [1, NaN], 'XAxisAnnotationPaddingLeft:aa8:acz', [1, NaN], 'XAxisAnnotationPaddingRight:aa9:ac0', [1, NaN], 'XAxisAnnotationPaddingTop:aba:ac1', [1, NaN], 'XAxisAnnotationStrokeThickness:abb:ac2', [1, NaN], 'XAxisAnnotationTextColor:adi:ac3', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:abc:ac4', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'YAxisAnnotationBackground:adj:ac5', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:abj:ac6', [1, -1], 'YAxisAnnotationOutline:adk:ac7', [Brush.$, null], 'YAxisAnnotationPaddingBottom:abd:ac8', [1, NaN], 'YAxisAnnotationPaddingLeft:abe:ac9', [1, NaN], 'YAxisAnnotationPaddingRight:abf:ada', [1, NaN], 'YAxisAnnotationPaddingTop:abg:adb', [1, NaN], 'YAxisAnnotationStrokeThickness:abh:adc', [1, NaN], 'YAxisAnnotationTextColor:adl:add', [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.jz = 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;
})();