igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
365 lines (364 loc) • 13.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 { FinancialOverlay } from "./FinancialOverlay";
import { DependencyProperty } from "igniteui-angular-core";
import { Series } from "./Series";
import { List$1 } from "igniteui-angular-core";
import { Number_$type, typeCast, runOn, markType, markDep, Point_$type, fromEnum } from "igniteui-angular-core";
import { CategoryFrame } from "./CategoryFrame";
import { MathUtil } from "igniteui-angular-core";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialBucketCalculator } from "./FinancialBucketCalculator";
import { Polyline } from "igniteui-angular-core";
import { Polygon } from "igniteui-angular-core";
import { RangeValueList } from "./RangeValueList";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { Flattener } from "igniteui-angular-core";
/**
* @hidden
*/
export let PriceChannelOverlay = /*@__PURE__*/ (() => {
class PriceChannelOverlay extends FinancialOverlay {
constructor() {
super();
this.abr = new List$1(Number_$type, 0);
this.abq = new List$1(Number_$type, 0);
this.ab = PriceChannelOverlay.$;
this.xu = new CategoryFrame(3);
this.xw = new CategoryFrame(3);
this.xs = new CategoryFrame(3);
}
bk() {
return new PriceChannelOverlay();
}
rp(a, b, c, d) {
switch (b) {
case "HighColumn":
case "LowColumn":
this.abk = false;
break;
}
super.rp(a, b, c, d);
switch (b) {
case PriceChannelOverlay.$$p[0]:
this.abk = false;
this.r7(false);
break;
}
}
hk(a, b, c) {
let d = super.hk(a, b, c);
if (this.yk == null || this.yl == null) {
d = false;
}
return d;
}
abl() {
this.abr.clear();
this.abq.clear();
let a = truncate(MathUtil.e(this.abs, 0, this.dp.count));
let b = Math.min(this.yk.count, this.yl.count);
let c = this.za(this.yk);
let d = this.za(this.yl);
for (let e = 0; e < b; e++) {
let f = Math.min(a, e);
let g = -1.7976931348623157E+308;
let h = 1.7976931348623157E+308;
for (let i = 0; i < f; i++) {
if (!isNaN_(c.item(e - i))) {
g = Math.max(g, c.item(e - i));
}
if (!isNaN_(d.item(e - i))) {
h = Math.min(h, d.item(e - i));
}
}
if (e == 0) {
h = d.item(0);
g = c.item(0);
}
this.abr.add(g);
this.abq.add(h);
}
return true;
}
aaw(a, b) {
super.aaw(a, b);
let c = b.ca;
let d = b.b9;
let e = this.getEffectiveViewport1(b);
let f = new ScalerParams(0, c, d, this.xq.dn, e);
let g = new ScalerParams(0, c, d, this.x9.dn, e);
g.b = this.i5();
let h = this.xq;
let i = this.x9;
a.k.clear();
a.s.clear();
a.v.clear();
let j = 0;
let k = typeCast(ISortingAxis_$type, this.xq);
if (k != null && k.i$b.count != this.dp.count) {
return;
}
j = this.zh(c, d, e);
if (!this.abk) {
this.abk = this.abl();
}
g.b = this.i5();
let l = this.xq.f8(2, f) - this.xq.f8(1, f);
for (let m = b.cd.c; m <= b.cd.d; ++m) {
let n;
if (k == null) {
n = b.cd.getBucket(m);
}
else {
let o = k.i$b._inner[m];
let p = k.i$d(o);
let q = this.abr._inner[m];
let r = this.abq._inner[m];
let s = q;
let t = r;
let u = p;
while (m < b.cd.d) {
o = k.i$b._inner[m + 1];
u = k.i$d(o);
if (u - p > l) {
break;
}
m++;
s = Math.max(q, this.abr._inner[m]);
t = Math.min(r, this.abq._inner[m]);
}
if (!isInfinity(t) && !isInfinity(s)) {
let v = NaN;
if (!isNaN_(p)) {
v = this.xq.f5(p, f);
}
n = [v, t, s];
}
else {
n = [NaN, NaN, NaN];
}
}
let w = Math.max(1, l);
if (!isNaN_(n[0]) && m * w >= this.abm) {
if (this.xq != null && typeCast(ISortingAxis_$type, this.xq) !== null) {
n[0] = n[0] + j;
}
else {
n[0] = h.f5(n[0], f) + j;
}
n[1] = i.f5(n[1], g);
n[2] = i.f5(n[2], g);
a.k.add(n);
}
}
}
ph(a, b) {
super.ph(a, b);
let c = b;
if (c != null) {
c.ck();
}
}
aay(a, b) {
super.aay(a, b);
let c = typeCast(PriceChannelOverlayView.$, b);
if (c == null) {
return;
}
let d = this.getEffectiveViewport1(b);
if (b.cg(a)) {
c.ck();
let e = a.k.count;
let f = (g) => a.k._inner[g][0];
let g = (h) => a.k._inner[e - 1 - h][0];
let h = (i) => a.k._inner[i][1];
let i = (j) => a.k._inner[e - 1 - j][2];
c.cl(e, f, g, h, i);
b.ci(a);
}
this.xz.a2(this, this.yy(), runOn(this, this.xi), this.zn(b), this.zp(b));
let j = false;
let k = this.xz.b;
let l = a.k;
let m = this.dp.count;
if (k != null) {
j = true;
}
if (j) {
let n = new ScalerParams(0, b.ca, b.b9, this.xq.dn, d);
this.aav(l, -1, m, this.xq, n, b.t, -1);
}
let o = c.cr;
let p = c.cs;
let q = c.cn;
this.xz.ad(o, true, false, true, true);
this.xz.ad(p, true, false, true, true);
this.xz.ad(q, false, true, false, false);
q._opacity = this.xz.j * this.ig;
}
ct() {
return new PriceChannelOverlayView(this);
}
rg(a) {
super.rg(a);
this.abp = typeCast(PriceChannelOverlayView.$, a);
}
jd(a, b, c) {
if (this.dc == null) {
return NaN;
}
let d = this.getEffectiveViewport1(this.cw);
let e = new ScalerParams(0, this.dc.yr, this.cw.b9, this.xq.dn, d);
let f = this.zh(this.dc.yr, this.cw.b9, d);
return this.jf(new RangeValueList(this.abr, this.abq), a, this.xq, e, f, runOn(this, this.zg), b, c);
}
kh(a, b) {
if (this.abr == null || this.abq == null) {
return super.kh(a, b);
}
return this.ki(a, b, this.xq, runOn(this, this.zg), new RangeValueList(this.abr, this.abq));
}
kj(a, b) {
if (this.abr == null || this.abq == null) {
return super.kj(a, b);
}
return this.kk(a, b, this.xq, runOn(this, this.zg), new RangeValueList(this.abr, this.abq));
}
i5() {
return Series.i7(this.abq, null);
}
}
PriceChannelOverlay.$t = markType(PriceChannelOverlay, 'PriceChannelOverlay', FinancialOverlay.$);
PriceChannelOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, PriceChannelOverlay, 'raisePropertyChanged', ['Period:abs:abu', [1, 14]]);
return PriceChannelOverlay;
})();
/**
* @hidden
*/
export let PriceChannelBucketCalculator = /*@__PURE__*/ (() => {
class PriceChannelBucketCalculator extends FinancialBucketCalculator {
constructor(a) {
super(a);
this.f = null;
this.f = a;
}
getBucket(a) {
let b = a * this.b;
let c = Math.min(b + this.b - 1, this.a.cf.dp.count - 1);
if (b <= c) {
let d = -1.7976931348623157E+308;
let e = 1.7976931348623157E+308;
let f = 0;
for (let g = b; g <= c; ++g) {
if (!isNaN_(this.f.cj.abr._inner[g]) && !isNaN_(this.f.cj.abq._inner[g])) {
d = Math.max(d, this.f.cj.abr._inner[g]);
e = Math.min(e, this.f.cj.abq._inner[g]);
++f;
}
}
if (f > 0 && e != 1.7976931348623157E+308 && d != -1.7976931348623157E+308) {
return [0.5 * (b + c), e, d];
}
}
return [NaN, NaN, NaN];
}
}
PriceChannelBucketCalculator.$t = markType(PriceChannelBucketCalculator, 'PriceChannelBucketCalculator', FinancialBucketCalculator.$);
return PriceChannelBucketCalculator;
})();
/**
* @hidden
*/
export let PriceChannelOverlayView = /*@__PURE__*/ (() => {
class PriceChannelOverlayView extends FinancialSeriesView {
constructor(a) {
super(a);
this.co = new Polygon();
this.ct = new Polyline();
this.cu = new Polyline();
this.cj = null;
this.cm = new Polygon();
this.cp = new Polyline();
this.cq = new Polyline();
this.cj = a;
}
get cn() {
return this.co;
}
get cr() {
return this.ct;
}
get cs() {
return this.cu;
}
a4() {
super.a4();
if (!this.t) {
}
}
ce() {
return new PriceChannelBucketCalculator(this);
}
ck() {
this.co.an.clear();
this.ct.an.clear();
this.cu.an.clear();
this.a2();
}
cl(a, b, c, d, e) {
for (let f of fromEnum(Flattener.d(a, b, d, this.f.ik))) {
this.co.an.add({ $type: Point_$type, x: b(f), y: d(f) });
this.ct.an.add({ $type: Point_$type, x: b(f), y: d(f) });
}
for (let g of fromEnum(Flattener.d(a, c, e, this.f.ik))) {
this.co.an.add({ $type: Point_$type, x: c(g), y: e(g) });
this.cu.an.add({ $type: Point_$type, x: c(g), y: e(g) });
}
this.a2();
}
bq() {
super.bq();
this.cm.an = this.co.an;
this.cp.an = this.ct.an;
this.cq.an = this.cu.an;
let a = this.b3();
this.cm._fill = a;
this.cm._opacity = 1;
this.cp._stroke = a;
this.cp.ad = this.f.il + 3;
this.cq._stroke = a;
this.cq.ad = this.f.il + 3;
}
bj(a, b) {
super.bj(a, b);
if (a.d) {
if (b) {
a.u(this.cm);
a.v(this.cp);
a.v(this.cq);
}
else {
a.u(this.co);
a.v(this.ct);
a.v(this.cu);
}
}
}
ax(a) {
super.ax(a);
this.f.bc.exportPolygonData(a, this.co, "fill", ["Fill"]);
this.f.bc.exportPolylineData(a, this.ct, "bottom", ["Lower", "Main"]);
this.f.bc.exportPolylineData(a, this.cu, "top", ["Upper"]);
}
}
PriceChannelOverlayView.$t = markType(PriceChannelOverlayView, 'PriceChannelOverlayView', FinancialSeriesView.$);
return PriceChannelOverlayView;
})();