igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
528 lines (527 loc) • 19.4 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.acx = null;
this.aak = null;
this.aaj = 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 acz() {
return new Thickness(1, this.aan, this.aap, this.aao, this.aam);
}
get ac0() {
return new Thickness(1, this.aat, this.aav, this.aau, this.aas);
}
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.aai;
let e = this.aah;
c.af.clear();
c.ag.clear();
c.ae.clear();
c.ah.clear();
AxisAnnotationFrameManager.b(c);
if (this.xn(this.aad)) {
this.abu(this.aad, c, d, e);
}
else {
for (let f of fromEnum(this.dc.series)) {
if (this.xn(f)) {
this.abu(f, c, d, e);
}
if (f.isStacked) {
f.p5((g) => {
if (this.xn(g)) {
this.abu(g, c, d, e);
}
if (g.ei) {
g.p3((h) => {
if (this.xn(h)) {
this.abu(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.p3((g) => {
if (this.xn(g)) {
this.abu(g, c, d, e);
}
return true;
});
}
}
}
}
xn(a) {
if (!super.xn(a)) {
return false;
}
if (this.aa3 != null) {
if (a.isFragment) {
let b = a.ne();
if (!Base.equalsStatic(this.aa3, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.aa3, 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.abv(this.xi, false);
}
else {
this.abv(this.xg, false);
}
}
w7() {
return 1;
}
xu() {
return 0.1;
}
xx() {
return -0.4;
}
xw() {
return 0.5;
}
zz() {
return this.w4 == 3 ? this.acy() : null;
}
z0() {
return this.w5 == 3 ? this.acy() : null;
}
acy() {
if (this.acx == null) {
this.acx = new DoubleCollection();
this.acx.add(DeviceUtils.g(5));
this.acx.add(DeviceUtils.g(5));
}
return this.acx;
}
abu(a, b, c, d) {
let e = this.yr(a);
if (!e.c) {
return;
}
let f = e.d;
f = a.wh(f, c, d);
let g = false;
let h = this.ve;
if (h == null) {
h = this.vk;
}
if (h == null) {
h = a.ve;
g = true;
}
let i = false;
let j = this.acr;
if (j == null) {
if (this.vk != null) {
j = this.vk;
}
else {
j = a.ve;
i = true;
}
}
let k = false;
let l = this.acu;
if (l == null) {
if (this.vk != null) {
l = this.vk;
}
else {
l = a.ve;
k = true;
}
}
let m = h;
let n = h;
let o = j;
let p = l;
if (this.acp != null) {
m = this.acp;
}
else if (g) {
switch (this.w4) {
case 0:
case 1:
m = this.aac.ck(m, this.xr);
break;
case 2:
m = this.aac.cm(m, this.xr);
break;
case 4:
m = this.aac.cl(m, this.xr);
break;
}
}
if (this.acq != null) {
n = this.acq;
}
else if (g) {
switch (this.w5) {
case 0:
case 1:
n = this.aac.ck(n, this.xt);
break;
case 2:
n = this.aac.cm(n, this.xt);
break;
case 4:
n = this.aac.cl(n, this.xt);
break;
}
}
if (i) {
switch (this.w5) {
case 1:
o = this.aac.ck(o, this.xt);
break;
case 2:
o = this.aac.cm(o, this.xt);
break;
}
}
if (k) {
switch (this.w4) {
case 1:
p = this.aac.ck(p, this.xr);
break;
case 2:
p = this.aac.cm(p, this.xr);
break;
}
}
b.ae.add(m);
b.ah.add(n);
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(), h, o, this.aal, this.act, this.acs, this.acz, this.aaq, p, this.aar, this.acw, this.acv, this.ac0, this.aaw, this.ac2 == 0, this.ac1 == 0);
}
}
abv(a, b) {
let c = false;
if (this.aaj == null) {
c = true;
this.aak = new List$1(Axis.$, 0);
this.aaj = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aaj, this.aak, b, this.aax, this.aay, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
abt(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.ac2 == 0;
let l = this.ac1 == 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.abt(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.abt(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.abv(this.xi, true);
}
else {
this.abv(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.aaj != null && this.aaj.count > 0) {
let e;
if (this.d4()) {
e = this.xi;
}
else {
e = this.xg;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aaj, this.aak, true, this.aax, this.aay, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.ru(true);
break;
case CrosshairLayer.$$p[8]:
this.ru(true);
break;
case CrosshairLayer.$$p[4]:
case CrosshairLayer.$$p[5]:
this.ru(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.ru(true);
break;
}
}
}
CrosshairLayer.$t = /*@__PURE__*/ markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:acp:abw', [Brush.$, null], 'HorizontalLineVisibility:ac1:abx', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aag:aby', [0, false], 'SkipUnknownValues:aah:abz', [0, true], 'TargetSeriesName:aa3:ab0', [2, null], 'TargetSeries:aad:ab1', [Series.$, null], 'UseInterpolation:aai:ab2', [0, true], 'VerticalLineStroke:acq:ab3', [Brush.$, null], 'VerticalLineVisibility:ac2:ab4', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aal:ab5', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'XAxisAnnotationBackground:acr:ab6', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:aax:ab7', [1, -1], 'XAxisAnnotationOutline:acs:ab8', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aam:ab9', [1, NaN], 'XAxisAnnotationPaddingLeft:aan:aca', [1, NaN], 'XAxisAnnotationPaddingRight:aao:acb', [1, NaN], 'XAxisAnnotationPaddingTop:aap:acc', [1, NaN], 'XAxisAnnotationStrokeThickness:aaq:acd', [1, NaN], 'XAxisAnnotationTextColor:act:ace', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:aar:acf', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'YAxisAnnotationBackground:acu:acg', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:aay:ach', [1, -1], 'YAxisAnnotationOutline:acv:aci', [Brush.$, null], 'YAxisAnnotationPaddingBottom:aas:acj', [1, NaN], 'YAxisAnnotationPaddingLeft:aat:ack', [1, NaN], 'YAxisAnnotationPaddingRight:aau:acl', [1, NaN], 'YAxisAnnotationPaddingTop:aav:acm', [1, NaN], 'YAxisAnnotationStrokeThickness:aaw:acn', [1, NaN], 'YAxisAnnotationTextColor:acw:aco', [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;
})();