igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
365 lines (364 loc) • 13.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 { FinancialOverlay } from "./FinancialOverlay";
import { DependencyProperty } from "igniteui-react-core";
import { Series } from "./Series";
import { List$1 } from "igniteui-react-core";
import { Number_$type, typeCast, runOn, markType, markDep, Point_$type, fromEnum } from "igniteui-react-core";
import { CategoryFrame } from "./CategoryFrame";
import { MathUtil } from "igniteui-react-core";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialBucketCalculator } from "./FinancialBucketCalculator";
import { Polyline } from "igniteui-react-core";
import { Polygon } from "igniteui-react-core";
import { RangeValueList } from "./RangeValueList";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { Flattener } from "igniteui-react-core";
/**
* @hidden
*/
export let PriceChannelOverlay = /*@__PURE__*/ (() => {
class PriceChannelOverlay extends FinancialOverlay {
bk() {
return new PriceChannelOverlay();
}
constructor() {
super();
this.aa9 = new List$1(Number_$type, 0);
this.aa8 = new List$1(Number_$type, 0);
this.ab = PriceChannelOverlay.$;
this.xc = new CategoryFrame(3);
this.xe = new CategoryFrame(3);
this.xa = new CategoryFrame(3);
}
ra(a, b, c, d) {
switch (b) {
case "HighColumn":
case "LowColumn":
this.aa2 = false;
break;
}
super.ra(a, b, c, d);
switch (b) {
case PriceChannelOverlay.$$p[0]:
this.aa2 = false;
this.rs(false);
break;
}
}
he(a, b, c) {
let d = super.he(a, b, c);
if (this.x2 == null || this.x3 == null) {
d = false;
}
return d;
}
aa3() {
this.aa9.clear();
this.aa8.clear();
let a = truncate(MathUtil.d(this.aba, 0, this.dp.count));
let b = Math.min(this.x2.count, this.x3.count);
let c = this.ys(this.x2);
let d = this.ys(this.x3);
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.aa9.add(g);
this.aa8.add(h);
}
return true;
}
aae(a, b) {
super.aae(a, b);
let c = b.b2;
let d = b.b1;
let e = this.getEffectiveViewport1(b);
let f = new ScalerParams(0, c, d, this.w8.ch, e);
let g = new ScalerParams(0, c, d, this.xr.ch, e);
g.b = this.iy();
let h = this.w8;
let i = this.xr;
a.h.clear();
a.p.clear();
a.s.clear();
let j = 0;
let k = typeCast(ISortingAxis_$type, this.w8);
if (k != null && k.i$b.count != this.dp.count) {
return;
}
j = this.yz(c, d, e);
if (!this.aa2) {
this.aa2 = this.aa3();
}
g.b = this.iy();
let l = this.w8.eo(2, f) - this.w8.eo(1, f);
for (let m = b.b4.c; m <= b.b4.d; ++m) {
let n;
if (k == null) {
n = b.b4.getBucket(m);
}
else {
let o = k.i$b._inner[m];
let p = k.i$d(o);
let q = this.aa9._inner[m];
let r = this.aa8._inner[m];
let s = q;
let t = r;
let u = p;
while (m < b.b4.d) {
o = k.i$b._inner[m + 1];
u = k.i$d(o);
if (u - p > l) {
break;
}
m++;
s = Math.max(q, this.aa9._inner[m]);
t = Math.min(r, this.aa8._inner[m]);
}
if (!isInfinity(t) && !isInfinity(s)) {
let v = NaN;
if (!isNaN_(p)) {
v = this.w8.el(p, f);
}
n = [v, t, s];
}
else {
n = [NaN, NaN, NaN];
}
}
let w = Math.max(1, l);
if (!isNaN_(n[0]) && m * w >= this.aa4) {
if (this.w8 != null && typeCast(ISortingAxis_$type, this.w8) !== null) {
n[0] = n[0] + j;
}
else {
n[0] = h.el(n[0], f) + j;
}
n[1] = i.el(n[1], g);
n[2] = i.el(n[2], g);
a.h.add(n);
}
}
}
o5(a, b) {
super.o5(a, b);
let c = b;
if (c != null) {
c.cb();
}
}
aag(a, b) {
super.aag(a, b);
let c = typeCast(PriceChannelOverlayView.$, b);
if (c == null) {
return;
}
let d = this.getEffectiveViewport1(b);
if (b.b7(a)) {
c.cb();
let e = a.h.count;
let f = (g) => a.h._inner[g][0];
let g = (h) => a.h._inner[e - 1 - h][0];
let h = (i) => a.h._inner[i][1];
let i = (j) => a.h._inner[e - 1 - j][2];
c.cc(e, f, g, h, i);
b.b9(a);
}
this.xh.a2(this, this.yg(), runOn(this, this.w0), this.y5(b), this.y7(b));
let j = false;
let k = this.xh.b;
let l = a.h;
let m = this.dp.count;
if (k != null) {
j = true;
}
if (j) {
let n = new ScalerParams(0, b.b2, b.b1, this.w8.ch, d);
this.aad(l, -1, m, this.w8, n, b.r, -1);
}
let o = c.ci;
let p = c.cj;
let q = c.ce;
this.xh.ad(o, true, false, true, true);
this.xh.ad(p, true, false, true, true);
this.xh.ad(q, false, true, false, false);
q._opacity = this.xh.j * this.h9;
}
ct() {
return new PriceChannelOverlayView(this);
}
q1(a) {
super.q1(a);
this.aa7 = typeCast(PriceChannelOverlayView.$, a);
}
i5(a, b, c) {
if (this.dc == null) {
return NaN;
}
let d = this.getEffectiveViewport1(this.cw);
let e = new ScalerParams(0, this.dc.v5, this.cw.b1, this.w8.ch, d);
let f = this.yz(this.dc.v5, this.cw.b1, d);
return this.i7(new RangeValueList(this.aa9, this.aa8), a, this.w8, e, f, runOn(this, this.yy), b, c);
}
j8(a, b) {
if (this.aa9 == null || this.aa8 == null) {
return super.j8(a, b);
}
return this.j9(a, b, this.w8, runOn(this, this.yy), new RangeValueList(this.aa9, this.aa8));
}
ka(a, b) {
if (this.aa9 == null || this.aa8 == null) {
return super.ka(a, b);
}
return this.kb(a, b, this.w8, runOn(this, this.yy), new RangeValueList(this.aa9, this.aa8));
}
iy() {
return Series.i0(this.aa8, null);
}
}
PriceChannelOverlay.$t = /*@__PURE__*/ markType(PriceChannelOverlay, 'PriceChannelOverlay', FinancialOverlay.$);
PriceChannelOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, PriceChannelOverlay, 'raisePropertyChanged', ['Period:aba:abc', [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.b6.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.ca.aa9._inner[g]) && !isNaN_(this.f.ca.aa8._inner[g])) {
d = Math.max(d, this.f.ca.aa9._inner[g]);
e = Math.min(e, this.f.ca.aa8._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 = /*@__PURE__*/ markType(PriceChannelBucketCalculator, 'PriceChannelBucketCalculator', FinancialBucketCalculator.$);
return PriceChannelBucketCalculator;
})();
/**
* @hidden
*/
export let PriceChannelOverlayView = /*@__PURE__*/ (() => {
class PriceChannelOverlayView extends FinancialSeriesView {
get ce() {
return this.cf;
}
get ci() {
return this.ck;
}
get cj() {
return this.cl;
}
constructor(a) {
super(a);
this.cf = new Polygon();
this.ck = new Polyline();
this.cl = new Polyline();
this.ca = null;
this.cd = new Polygon();
this.cg = new Polyline();
this.ch = new Polyline();
this.ca = a;
}
ax() {
super.ax();
if (!this.r) {
}
}
b5() {
return new PriceChannelBucketCalculator(this);
}
cb() {
this.cf.an.clear();
this.ck.an.clear();
this.cl.an.clear();
this.av();
}
cc(a, b, c, d, e) {
for (let f of fromEnum(Flattener.d(a, b, d, this.f.id))) {
this.cf.an.add({ $type: Point_$type, x: b(f), y: d(f) });
this.ck.an.add({ $type: Point_$type, x: b(f), y: d(f) });
}
for (let g of fromEnum(Flattener.d(a, c, e, this.f.id))) {
this.cf.an.add({ $type: Point_$type, x: c(g), y: e(g) });
this.cl.an.add({ $type: Point_$type, x: c(g), y: e(g) });
}
this.av();
}
bi() {
super.bi();
this.cd.an = this.cf.an;
this.cg.an = this.ck.an;
this.ch.an = this.cl.an;
let a = this.bv();
this.cd._fill = a;
this.cd._opacity = 1;
this.cg._stroke = a;
this.cg.ad = this.f.ie + 3;
this.ch._stroke = a;
this.ch.ad = this.f.ie + 3;
}
bc(a, b) {
super.bc(a, b);
if (a.d) {
if (b) {
a.u(this.cd);
a.v(this.cg);
a.v(this.ch);
}
else {
a.u(this.cf);
a.v(this.ck);
a.v(this.cl);
}
}
}
aq(a) {
super.aq(a);
this.f.bc.exportPolygonData(a, this.cf, "fill", ["Fill"]);
this.f.bc.exportPolylineData(a, this.ck, "bottom", ["Lower", "Main"]);
this.f.bc.exportPolylineData(a, this.cl, "top", ["Upper"]);
}
}
PriceChannelOverlayView.$t = /*@__PURE__*/ markType(PriceChannelOverlayView, 'PriceChannelOverlayView', FinancialSeriesView.$);
return PriceChannelOverlayView;
})();