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.adn = null;
this.aa6 = null;
this.aa5 = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.ko / 1000;
this.xz = a;
this.xy = b;
this.x0 = c;
this.ab = CrosshairLayer.$;
}
ct() {
return new CrosshairLayerView(this);
}
rj(a) {
super.rj(a);
this.aaw = a;
}
g2(a) {
if (this.aax == null) {
return true;
}
if (this.aax == a) {
return true;
}
return false;
}
aay() {
return this.xAxisAnnotationFormatLabel != null;
}
aaz() {
return this.yAxisAnnotationFormatLabel != null;
}
get adp() {
return new Thickness(1, this.aa9, this.abb, this.aba, this.aa8);
}
get adq() {
return new Thickness(1, this.abf, this.abh, this.abg, this.abe);
}
zf(a, b) {
if (this.aax == null || this.aax == a) {
if (!this.a1.c) {
this.sa(b);
}
}
}
zh(a, b) {
super.zh(a, b);
let c = a;
let d = this.aa4;
let 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 {
for (let f of fromEnum(this.dc.b9)) {
if (this.x6(f)) {
this.aci(f, c, d, e);
}
if (f.isStacked) {
f.qj((g) => {
if (this.x6(g)) {
this.aci(g, c, d, e);
}
if (g.ei) {
g.qh((h) => {
if (this.x6(h)) {
this.aci(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.qh((g) => {
if (this.x6(g)) {
this.aci(g, c, d, e);
}
return true;
});
}
}
}
}
x6(a) {
if (!super.x6(a)) {
return false;
}
if (this.abr != null) {
if (a.isFragment) {
let b = a.np();
if (!Base.equalsStatic(this.abr, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abr, a.name)) {
return false;
}
}
}
let c = this.o1(a, this.aar);
if (!c.c) {
return false;
}
return true;
}
q6() {
super.q6();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.acj(this.x0, false);
}
else {
this.acj(this.xy, false);
}
}
xp() {
return 1;
}
yd() {
return 0.1;
}
yg() {
return -0.4;
}
yf() {
return 0.5;
}
aaj() {
return this.xm == 3 ? this.ado() : null;
}
aak() {
return this.xn == 3 ? this.ado() : null;
}
ado() {
if (this.adn == null) {
this.adn = new DoubleCollection();
this.adn.add(DeviceUtils.g(5));
this.adn.add(DeviceUtils.g(5));
}
return this.adn;
}
aci(a, b, c, d) {
let e = this.o1(a, this.aar);
if (!e.c) {
return;
}
let f = e.d;
let 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);
let h = false;
let i = this.vv;
if (i == null) {
i = this.v1;
}
if (i == null) {
i = a.vv;
h = true;
}
let j = false;
let k = this.adh;
if (k == null) {
if (this.v1 != null) {
k = this.v1;
}
else {
k = a.vv;
j = true;
}
}
let l = false;
let m = this.adk;
if (m == null) {
if (this.v1 != null) {
m = this.v1;
}
else {
m = a.vv;
l = true;
}
}
let n = i;
let o = i;
let p = k;
let 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)) {
let 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);
}
}
acj(a, b) {
let 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);
}
ach(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.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);
}
zk(a, b) {
super.zk(a, b);
let c = this.aaw.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.ads == 0;
let l = this.adr == 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.ach(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.ach(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.acj(this.x0, true);
}
else {
this.acj(this.xy, false);
}
}
gi() {
return true;
}
rs(a, b, c, d) {
super.rs(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aa5 != null && this.aa5.count > 0) {
let e;
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 = /*@__PURE__*/ markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:adf:ack', [Brush.$, null], 'HorizontalLineVisibility:adr:acl', [Visibility_$type, /*@__PURE__*/ 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, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aa7:acv', [1, /*@__PURE__*/ 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, /*@__PURE__*/ 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;
})();
/**
* @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.j0 = 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;
})();