igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
551 lines (550 loc) • 20.6 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-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { Series } from "./Series";
import { Thickness } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { CrosshairLayerFrame } from "./CrosshairLayerFrame";
import { List$1 } from "igniteui-angular-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { Base, Number_$type, enumGetBox, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-angular-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { Tuple$2 } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { AxisAnnotationFramePrepareSettings } from "./AxisAnnotationFramePrepareSettings";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { Path } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { TranslateTransform } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
/**
* @hidden
*/
export let CrosshairLayer = /*@__PURE__*/ (() => {
class CrosshairLayer extends AnnotationLayer {
constructor() {
super();
this.xAxisAnnotationFormatLabel = null;
this.yAxisAnnotationFormatLabel = null;
this.adl = null;
this.aa4 = null;
this.aa3 = null;
let a = new CrosshairLayerFrame();
let b = new CrosshairLayerFrame();
let c = new CrosshairLayerFrame();
let d = this.km / 1000;
this.xw = a;
this.xv = b;
this.xx = c;
this.ab = CrosshairLayer.$;
}
bk() {
return new CrosshairLayer();
}
get_eu() {
return true;
}
get_er() {
return true;
}
ct() {
return new CrosshairLayerView(this);
}
rg(a) {
super.rg(a);
this.aau = a;
}
g0(a) {
if (this.aav == null) {
return true;
}
if (this.aav == a) {
return true;
}
return false;
}
aaw() {
return this.xAxisAnnotationFormatLabel != null;
}
aax() {
return this.yAxisAnnotationFormatLabel != null;
}
get adn() {
return new Thickness(1, this.aa7, this.aa9, this.aa8, this.aa6);
}
get ado() {
return new Thickness(1, this.abd, this.abf, this.abe, this.abc);
}
zd(a, b) {
if (this.aav == null || this.aav == a) {
if (!this.a1.c) {
this.r7(b);
}
}
}
zf(a, b) {
super.zf(a, b);
let c = a;
let d = this.aa2;
let e = this.aa1;
c.a1.clear();
c.a2.clear();
c.a0.clear();
c.a3.clear();
AxisAnnotationFrameManager.b(c);
if (this.x3(this.aav)) {
this.acg(this.aav, c, d, e);
}
else {
for (let f of fromEnum(this.dc.b9)) {
if (this.x3(f)) {
this.acg(f, c, d, e);
}
if (f.isStacked) {
f.qg((g) => {
if (this.x3(g)) {
this.acg(g, c, d, e);
}
if (g.ei) {
g.qe((h) => {
if (this.x3(h)) {
this.acg(h, c, d, e);
}
return true;
});
}
return true;
});
}
if (f.ei) {
f.qe((g) => {
if (this.x3(g)) {
this.acg(g, c, d, e);
}
return true;
});
}
}
}
}
x3(a) {
if (!super.x3(a)) {
return false;
}
if (this.abp != null) {
if (a.isFragment) {
let b = a.nn();
if (!Base.equalsStatic(this.abp, b)) {
return false;
}
}
else {
if (!Base.equalsStatic(this.abp, a.name)) {
return false;
}
}
}
let c = this.y8(a);
if (!c.c) {
return false;
}
return true;
}
q3() {
super.q3();
if (!this.a1.c && !this.d4()) {
return;
}
if (this.d4()) {
this.ach(this.xx, false);
}
else {
this.ach(this.xv, false);
}
}
xm() {
return 1;
}
ya() {
return 0.1;
}
yd() {
return -0.4;
}
yc() {
return 0.5;
}
aah() {
return this.xj == 3 ? this.adm() : null;
}
aai() {
return this.xk == 3 ? this.adm() : null;
}
adm() {
if (this.adl == null) {
this.adl = new DoubleCollection();
this.adl.add(DeviceUtils.g(5));
this.adl.add(DeviceUtils.g(5));
}
return this.adl;
}
acg(a, b, c, d) {
let e = this.y8(a);
if (!e.c) {
return;
}
let f = e.d;
let g = a.jd(f, c, d);
if (this.aaz && isNaN_(g)) {
return;
}
if (this.aa0 && a.isFragment && g == 0) {
return;
}
f = a.wv(f, c, d);
let h = false;
let i = this.vs;
if (i == null) {
i = this.vy;
}
if (i == null) {
i = a.vs;
h = true;
}
let j = false;
let k = this.adf;
if (k == null) {
if (this.vy != null) {
k = this.vy;
}
else {
k = a.vs;
j = true;
}
}
let l = false;
let m = this.adi;
if (m == null) {
if (this.vy != null) {
m = this.vy;
}
else {
m = a.vs;
l = true;
}
}
let n = i;
let o = i;
let p = k;
let q = m;
if (this.add != null) {
n = this.add;
}
else if (h) {
switch (this.xj) {
case 0:
case 1:
n = this.aau.ck(n, this.x7);
break;
case 2:
n = this.aau.cm(n, this.x7);
break;
case 4:
n = this.aau.cl(n, this.x7);
break;
}
}
if (this.ade != null) {
o = this.ade;
}
else if (h) {
switch (this.xk) {
case 0:
case 1:
o = this.aau.ck(o, this.x9);
break;
case 2:
o = this.aau.cm(o, this.x9);
break;
case 4:
o = this.aau.cl(o, this.x9);
break;
}
}
if (j) {
switch (this.xk) {
case 1:
p = this.aau.ck(p, this.x9);
break;
case 2:
p = this.aau.cm(p, this.x9);
break;
}
}
if (l) {
switch (this.xj) {
case 1:
q = this.aau.ck(q, this.x7);
break;
case 2:
q = this.aau.cm(q, this.x7);
break;
}
}
b.a0.add(n);
b.a3.add(o);
b.a1.add(f.y);
b.a2.add(f.x);
if (this.aay && !isNaN_(f.y)) {
let r = new AxisAnnotationFramePrepareSettings();
r.u = p;
r.y = this.adh;
r.x = this.adg;
r.g = this.aa5;
r.ae = this.adn;
r.l = this.aba;
r.c = this.adq == 0;
r.z = q;
r.ad = this.adk;
r.ac = this.adj;
r.m = this.abb;
r.af = this.ado;
r.r = this.abg;
r.d = this.adp == 0;
AxisAnnotationFrameManager.c(b, f, a, this.dc, this.getEffectiveViewport(), i, r);
}
}
ach(a, b) {
let c = false;
if (this.aa3 == null) {
c = true;
this.aa4 = new List$1(Axis.$, 0);
this.aa3 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
}
AxisAnnotationFrameManager.d(this, a, c, this.aa3, this.aa4, b, this.abh, this.abi, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
acf(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.il;
f.ai = e ? this.aaf : this.aae;
f.am = this.wo;
f.al = this.wn;
f.ak = this.wn;
f.aj = this.wm;
f.ac = this.jp;
return new Tuple$2(Path.$, Number_$type, f, b);
}
zi(a, b) {
super.zi(a, b);
let c = this.aau.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.adq == 0;
let l = this.adp == 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.acf(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.acf(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.ach(this.xx, true);
}
else {
this.ach(this.xv, false);
}
}
gg() {
return true;
}
rp(a, b, c, d) {
super.rp(a, b, c, d);
switch (b) {
case "SeriesViewer":
if (d == null) {
if (this.aa3 != null && this.aa3.count > 0) {
let e;
if (this.d4()) {
e = this.xx;
}
else {
e = this.xv;
}
AxisAnnotationFrameManager.b(e);
AxisAnnotationFrameManager.d(this, e, true, this.aa3, this.aa4, true, this.abh, this.abi, this.xAxisAnnotationFormatLabel, this.yAxisAnnotationFormatLabel);
}
}
break;
case CrosshairLayer.$$p[1]:
this.r7(true);
break;
case CrosshairLayer.$$p[10]:
this.r7(true);
break;
case CrosshairLayer.$$p[6]:
case CrosshairLayer.$$p[7]:
this.r7(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.r7(true);
break;
}
}
}
CrosshairLayer.$t = markType(CrosshairLayer, 'CrosshairLayer', AnnotationLayer.$);
CrosshairLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CrosshairLayer, 'raisePropertyChanged', ['HorizontalLineStroke:add:aci', [Brush.$, null], 'HorizontalLineVisibility:adp:acj', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsAxisAnnotationEnabled:aay:ack', [0, false], 'SkipAxisAnnotationOnInvalidData:aaz:acl', [0, false], 'SkipAxisAnnotationOnZeroValueFragments:aa0:acm', [0, false], 'SkipUnknownValues:aa1:acn', [0, true], 'TargetSeriesName:abp:aco', [2, null], 'TargetSeries:aav:acp', [Series.$, null], 'UseInterpolation:aa2:acq', [0, true], 'VerticalLineStroke:ade:acr', [Brush.$, null], 'VerticalLineVisibility:adq:acs', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'XAxisAnnotationBackgroundCornerRadius:aa5:act', [1, DeviceUtils.g(3)], 'XAxisAnnotationBackground:adf:acu', [Brush.$, null], 'XAxisAnnotationInterpolatedValuePrecision:abh:acv', [1, -1], 'XAxisAnnotationOutline:adg:acw', [Brush.$, null], 'XAxisAnnotationPaddingBottom:aa6:acx', [1, NaN], 'XAxisAnnotationPaddingLeft:aa7:acy', [1, NaN], 'XAxisAnnotationPaddingRight:aa8:acz', [1, NaN], 'XAxisAnnotationPaddingTop:aa9:ac0', [1, NaN], 'XAxisAnnotationStrokeThickness:aba:ac1', [1, NaN], 'XAxisAnnotationTextColor:adh:ac2', [Brush.$, null], 'YAxisAnnotationBackgroundCornerRadius:abb:ac3', [1, DeviceUtils.g(3)], 'YAxisAnnotationBackground:adi:ac4', [Brush.$, null], 'YAxisAnnotationInterpolatedValuePrecision:abi:ac5', [1, -1], 'YAxisAnnotationOutline:adj:ac6', [Brush.$, null], 'YAxisAnnotationPaddingBottom:abc:ac7', [1, NaN], 'YAxisAnnotationPaddingLeft:abd:ac8', [1, NaN], 'YAxisAnnotationPaddingRight:abe:ac9', [1, NaN], 'YAxisAnnotationPaddingTop:abf:ada', [1, NaN], 'YAxisAnnotationStrokeThickness:abg:adb', [1, NaN], 'YAxisAnnotationTextColor:adk:adc', [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.jy = 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 = markType(CrosshairLayerView, 'CrosshairLayerView', AnnotationLayerView.$);
return CrosshairLayerView;
})();