igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
528 lines (527 loc) • 19.3 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_es() {
return true;
}
get_eq() {
return true;
}
constructor() {
super();
this.xAxisAnnotationFormatLabel = null;
this.yAxisAnnotationFormatLabel = null;
this.acu = null;
this.aah = null;
this.aag = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.kd / 1000;
this.xe = a;
this.xd = b;
this.xf = c;
this.ab = CrosshairLayer.$;
}
ct() {
return new CrosshairLayerView(this);
}
q1(a) {
super.q1(a);
this.z9 = a;
}
gu(a) {
if (this.aaa == null) {
return true;
}
if (this.aaa == a) {
return true;
}
return false;
}
aab() {
return this.xAxisAnnotationFormatLabel != null;
}
aac() {
return this.yAxisAnnotationFormatLabel != null;
}
get acw() {
return new Thickness(1, this.aak, this.aam, this.aal, this.aaj);
}
get acx() {
return new Thickness(1, this.aaq, this.aas, this.aar, this.aap);
}
yt(a, b) {
if (this.aaa == null || this.aaa == a) {
if (!this.a1.c) {
this.rs(b);
}
}
}
yv(a, b) {
super.yv(a, b);
let c = a;
let d = this.aaf;
let e = this.aae;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
if (this.xk(this.aaa)) {
this.abr(this.aaa, c, d, e);
}
else {
for (let f of fromEnum(this.dc.series)) {
if (this.xk(f)) {
this.abr(f, c, d, e);
}
if (f.isStacked) {
f.p3((g) => {
if (this.xk(g)) {
this.abr(g, c, d, e);
}
if (g.eh) {
g.p1((h) => {
if (this.xk(h)) {
this.abr(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.eh) {
f.p1((g) => {
if (this.xk(g)) {
this.abr(g, c, d, e);
}
return true;
});
}
}
}
}
xk(a) {
if (!super.xk(a)) {
return false;
}
if (this.aa0 != null) {
if (a.isFragment) {
let b = a.nc();
if (!Base.equalsStatic(this.aa0, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aa0, a.name)) {
return false;
}
}
}
let c = this.yo(a);
if (!c.c) {
return false;
}
return true;
}
qp() {
super.qp();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.abs(this.xf, false);
}
else {
this.abs(this.xd, false);
}
}
w4() {
return 1;
}
xr() {
return 0.1;
}
xu() {
return -0.4;
}
xt() {
return 0.5;
}
zw() {
return this.w1 == 3 ? this.acv() : null;
}
zx() {
return this.w2 == 3 ? this.acv() : null;
}
acv() {
if (this.acu == null) {
this.acu = new DoubleCollection();
this.acu.add(DeviceUtils.g(5));
this.acu.add(DeviceUtils.g(5));
}
return this.acu;
}
abr(a, b, c, d) {
let e = this.yo(a);
if (!e.c) {
return;
}
let f = e.d;
f = a.we(f, c, d);
let g = false;
let h = this.vb;
if (h == null) {
h = this.vh;
}
if (h == null) {
h = a.vb;
g = true;
}
let i = false;
let j = this.aco;
if (j == null) {
if (this.vh != null) {
j = this.vh;
}
else {
j = a.vb;
i = true;
}
}
let k = false;
let l = this.acr;
if (l == null) {
if (this.vh != null) {
l = this.vh;
}
else {
l = a.vb;
k = true;
}
}
let m = h;
let n = h;
let o = j;
let p = l;
if (this.acm != null) {
m = this.acm;
}
else if (g) {
switch (this.w1) {
case 0:
case 1:
m = this.z9.cb(m, this.xo);
break;
case 2:
m = this.z9.cd(m, this.xo);
break;
case 4:
m = this.z9.cc(m, this.xo);
break;
}
}
if (this.acn != null) {
n = this.acn;
}
else if (g) {
switch (this.w2) {
case 0:
case 1:
n = this.z9.cb(n, this.xq);
break;
case 2:
n = this.z9.cd(n, this.xq);
break;
case 4:
n = this.z9.cc(n, this.xq);
break;
}
}
if (i) {
switch (this.w2) {
case 1:
o = this.z9.cb(o, this.xq);
break;
case 2:
o = this.z9.cd(o, this.xq);
break;
}
}
if (k) {
switch (this.w1) {
case 1:
p = this.z9.cb(p, this.xo);
break;
case 2:
p = this.z9.cd(p, this.xo);
break;
}
}
b.ae.add(m);
b.ah.add(n);
b.af.add(f.y);
b.ag.add(f.x);
if (this.aad && !isNaN_(f.y)) {
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), h, o, this.aai, this.acq, this.acp, this.acw, this.aan, p, this.aao, this.act, this.acs, this.acx, this.aat, this.acz == 0, this.acy == 0);
}
}
abs(a, b) {
let c = false;
if (this.aag == null) {
c = true;
this.aah = new List$1(Axis.$, 0);
this.aag = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aag, this.aah, b, this.aau, this.aav, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
abq(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.ie;
f.ai = e ? this.zu : this.zt;
f.am = this.v7;
f.al = this.v6;
f.ak = this.v6;
f.aj = this.v5;
f.ac = this.jh;
return new Tuple$2(Path.$, Number_$type, f, b);
}
yy(a, b) {
super.yy(a, b);
let c = this.z9.cf;
let d = a;
let e = d.af.count;
let f = 0;
let g = b.b1.left;
let h = b.b1.right;
let i = b.b1.top;
let j = b.b1.bottom;
let k = this.acz == 0;
let l = this.acy == 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.abq(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.abq(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.abs(this.xf, true);
}
else {
this.abs(this.xd, false);
}
}
ga() {
return true;
}
ra(a, b, c, d) {
super.ra(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aag != null && this.aag.count > 0) {
let e;
if (this.d4()) {
e = this.xf;
}
else {
e = this.xd;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aag, this.aah, true, this.aau, this.aav, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.rs(true);
break;
case CrosshairLayer.$$p[8]:
this.rs(true);
break;
case CrosshairLayer.$$p[4]:
case CrosshairLayer.$$p[5]:
this.rs(true);
break;
case CrosshairLayer.$$p[2]:
case CrosshairLayer.$$p[10]:
case CrosshairLayer.$$p[9]:
case CrosshairLayer.$$p[12]:
case CrosshairLayer.$$p[14]:
case CrosshairLayer.$$p[16]:
case CrosshairLayer.$$p[15]:
case CrosshairLayer.$$p[13]:
case CrosshairLayer.$$p[17]:
case CrosshairLayer.$$p[18]:
case CrosshairLayer.$$p[20]:
case CrosshairLayer.$$p[22]:
case CrosshairLayer.$$p[24]:
case CrosshairLayer.$$p[26]:
case CrosshairLayer.$$p[25]:
case CrosshairLayer.$$p[23]:
case CrosshairLayer.$$p[27]:
case CrosshairLayer.$$p[28]:
case CrosshairLayer.$$p[0]:
case CrosshairLayer.$$p[7]:
case CrosshairLayer.$$p[6]:
this.rs(true);
break;
}
}
}
CrosshairLayer.$t = /*@__PURE__*/ markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acm:abt', [Brush.$, null], 'HorizontalLineVisibility:acy:abu', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aad:abv', [0, false], 'SkipUnknownValues:aae:abw', [0, true], 'TargetSeriesName:aa0:abx', [2, null], 'TargetSeries:aaa:aby', [Series.$, null], 'UseInterpolation:aaf:abz', [0, true], 'VerticalLineStroke:acn:ab0', [Brush.$, null], 'VerticalLineVisibility:acz:ab1', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aai:ab2', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'XAxisAnnotationBackground:aco:ab3', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aau:ab4', [1, -1], 'XAxisAnnotationOutline:acp:ab5', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aaj:ab6', [1, NaN], 'XAxisAnnotationPaddingLeft:aak:ab7', [1, NaN], 'XAxisAnnotationPaddingRight:aal:ab8', [1, NaN], 'XAxisAnnotationPaddingTop:aam:ab9', [1, NaN], 'XAxisAnnotationStrokeThickness:aan:aca', [1, NaN], 'XAxisAnnotationTextColor:acq:acb', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aao:acc', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'YAxisAnnotationBackground:acr:acd', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aav:ace', [1, -1], 'YAxisAnnotationOutline:acs:acf', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aap:acg', [1, NaN], 'YAxisAnnotationPaddingLeft:aaq:ach', [1, NaN], 'YAxisAnnotationPaddingRight:aar:aci', [1, NaN], 'YAxisAnnotationPaddingTop:aas:acj', [1, NaN], 'YAxisAnnotationStrokeThickness:aat:ack', [1, NaN], 'YAxisAnnotationTextColor:act:acl', [Brush.$, null]]);
return CrosshairLayer;
})();
/**
* @hidden
*/
export let CrosshairLayerView = /*@__PURE__*/ (() => {
class CrosshairLayerView extends AnnotationLayerView {
constructor(a) {
super(a);
this.ce = null;
this.cf = null;
this.cg = null;
this.ce = a;
this.cg = new List$1(Path.$, 0);
}
ax() {
super.ax();
this.cf = ((() => {
let $ret = new Pool$1(Path.$);
$ret.create = runOn(this, this.cl);
$ret.activate = runOn(this, this.ch);
$ret.disactivate = runOn(this, this.cj);
$ret.destroy = runOn(this, this.ci);
return $ret;
})());
this.ce.jp = Defaults.j;
}
cl() {
let a = new Path();
a.j = new TranslateTransform();
this.cg.add(a);
return a;
}
ch(a) {
a._visibility = 0;
}
cj(a) {
a._visibility = 1;
}
ci(a) {
this.cg.remove(a);
}
ck(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;
}
}
bc(a, b) {
super.bc(a, b);
if (a.d && !b) {
for (let c = 0; c < this.cg.count; c++) {
let d = this.cg._inner[c];
if (d._visibility == 0) {
a.t(d);
}
}
}
}
aq(a) {
super.aq(a);
for (let b = 0; b < this.cg.count; b++) {
this.f.bc.exportPathData(a, this.cg._inner[b], "crosshairLine", ["Main", "Crosshair"]);
}
}
}
CrosshairLayerView.$t = /*@__PURE__*/ markType(CrosshairLayerView, 'CrosshairLayerView', AnnotationLayerView.$);
return CrosshairLayerView;
})();