igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,352 lines (1,351 loc) • 51.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 { FinancialSeries } from "./FinancialSeries";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { TrendLineType_$type } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { PriceDisplayType_$type } from "./PriceDisplayType";
import { CategoryCollisionMode_$type } from "./CategoryCollisionMode";
import { Series } from "./Series";
import { Defaults } from "./Defaults";
import { enumGetBox, EnumUtil, Number_$type, typeCast, fromEnum, runOn, Point_$type, markType, markDep } from "igniteui-angular-core";
import { CategoryFrame } from "./CategoryFrame";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { Rect } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { AxisRange } from "./AxisRange";
import { ScalerParams } from "./ScalerParams";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { GeometryGroup } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
import { RectangleGeometry } from "igniteui-angular-core";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { boxArray$1 } from "igniteui-angular-core";
import { round10N } from "igniteui-angular-core";
import { FinancialPriceBucketCalculator } from "./FinancialPriceBucketCalculator";
import { Extensions } from "igniteui-angular-core";
/**
* @hidden
*/
export let FinancialPriceSeries = /*@__PURE__*/ (() => {
class FinancialPriceSeries extends FinancialSeries {
constructor() {
super();
this.aa3 = true;
this.aa4 = 0;
this.aa5 = 0;
this.ab = FinancialPriceSeries.$;
this.w9 = new CategoryFrame(5);
this.xb = new CategoryFrame(5);
this.w7 = new CategoryFrame(5);
}
bj() {
return new FinancialPriceSeries();
}
get_e9() {
return true;
}
jj() {
if (!isNaN_(this.ji)) {
return super.jj();
}
return Defaults.k;
}
cs() {
return new FinancialPriceSeriesView(this);
}
q0(a) {
super.q0(a);
this.aa1 = a;
}
get ack() {
return this.c(FinancialPriceSeries.ab1);
}
set ack(a) {
this.h(FinancialPriceSeries.ab1, a);
}
pa(a, b, c, d) {
super.pa(a, b, c, d);
if (this.w5 != null && typeCast(ISortingAxis_$type, this.w5) !== null) {
this.w5.i$i();
}
this.aa1.b0.e(this.ic);
if (this.aa1.ca) {
this.aa1.b8.g$e(a, b, c, d);
}
if (this.xo != null) {
this.xo.c1();
}
this.rq(true);
if (a == 0 || a == 2 || a == 3 || a == 4) {
this.aa3 = true;
}
else if (a == 1) {
for (let e = b; e < b + c; e++) {
let f = 0;
f += this.xz.item(e);
f += this.x0.item(e);
f += this.xy.item(e);
this.aa4 += f / 3;
}
this.aa5 = this.aa4 / this.xz.count;
}
}
b2() {
if (this.b3 == 0) {
return 1;
}
else {
return super.b2();
}
}
wm(a) {
if (this.w7 == null || this.w7.f.count == 0) {
return Rect.empty;
}
let b = this.v6(a);
let c = this.cv.by;
let d = this.cv.bx;
let e = this.getEffectiveViewport1(this.cv);
let f = this.an(this.w5, this.w7.f, this.y2(this.cv), this.y4(this.cv), a, true);
let g = f[0];
let h = f[1];
let i = Math.abs(b.x - g[0]);
let j = Math.abs(b.x - h[0]);
let k = this.aa6(this.xm, e);
k = Math.max(k, 3);
let l = (k - 1) / 2;
if (i < j) {
let m = g[0] - l;
let n = g[0];
let o = g[0] + l;
let p = g[1];
let q = g[2];
let r = g[3];
let s = g[4];
let t = Math.min(Math.min(Math.min(p, q), r), s);
let u = Math.max(Math.max(Math.max(p, q), r), s);
return new Rect(0, m, t, Math.abs(o - m), u - t);
}
else {
let v = h[0] - l;
let w = h[0];
let x = h[0] + l;
let y = h[1];
let z = h[2];
let aa = h[3];
let ab = h[4];
let ac = Math.min(Math.min(Math.min(y, z), aa), ab);
let ad = Math.max(Math.max(Math.max(y, z), aa), ab);
return new Rect(0, v, ac, Math.abs(x - v), ad - ac);
}
}
aaz(a, b) {
let c = a[0] - b;
let d = a[0];
let e = a[0] + b;
let f = a[1];
let g = a[2];
let h = a[3];
let i = a[4];
let j = Math.min(Math.min(Math.min(f, g), h), i);
let k = Math.max(Math.max(Math.max(f, g), h), i);
let l = Math.min(g, h);
let m = Math.max(g, h);
let n = Math.min(f, i);
let o = Math.max(f, i);
if (this.aa2 == 1) {
let p = new Array(3);
let q = new Rect(0, c, f, b, 0);
let r = new Rect(0, d, i, b, 0);
let s = new Rect(0, d, l, 0, m - l);
p[0] = q;
p[1] = r;
p[2] = s;
return p;
}
else {
let t = new Array(2);
let u = new Rect(0, d, l, 0, m - l);
let v = new Rect(0, c, n, b * 2, o - n);
t[0] = u;
t[1] = v;
return t;
}
}
ao(a) {
let b = new List$1(Rect.$, 0);
let c = this.v6(a);
let d = this.cv.by;
let e = this.cv.bx;
let f = this.getEffectiveViewport1(this.cv);
let g = this.an(this.w5, this.w7.f, this.y2(this.cv), this.y4(this.cv), a, true);
let h = g[0];
let i = g[1];
let j = Math.abs(c.x - h[0]);
let k = Math.abs(c.x - i[0]);
let l = this.aa6(this.xm, f);
l = Math.max(l, 3);
let m = (l - 1) / 2;
if (j < k) {
return this.aaz(h, m);
}
else {
return this.aaz(i, m);
}
}
gv(a, b) {
if (this.gy(a, b)) {
return true;
}
return false;
}
gy(a, b) {
let c = this.wn(a);
if (c.isEmpty) {
return false;
}
let d = RectUtil.r(c, (this.id / 2) + this.it(b));
if (d.containsPoint(a)) {
let e = this.ap(a);
if (e != null) {
for (let f = 0; f < e.length; f++) {
let g = e[f];
let h = RectUtil.r(g, (this.id / 2) + this.it(b));
if (h.containsPoint(a)) {
return true;
}
}
}
}
return false;
}
q8(a, b, c, d) {
switch (b) {
case FinancialPriceSeries.$$p[4]:
case FinancialPriceSeries.$$p[5]:
case FinancialPriceSeries.$$p[6]:
case FinancialPriceSeries.$$p[7]:
case FinancialPriceSeries.$$p[1]:
case FinancialPriceSeries.$$p[2]:
case FinancialPriceSeries.$$p[9]:
case FinancialPriceSeries.$$p[10]:
this.qe();
break;
case FinancialSeries.$$p[14]:
this.aa1.cg();
if (this.db != null) {
this.db.n2();
}
break;
case "TrendLineType":
let e = EnumUtil.getEnumValue(TrendLineType_$type, d);
if (e != 0) {
this.aa1.b8 = CategoryTrendLineManagerFactory.a(this.aa1.b8, this.w5, this.su, this, this.dr);
}
break;
}
super.q8(a, b, c, d);
if (this.aa1.ca && this.aa1.b8 != null && this.aa1.b8.g$b(a, b, c, d)) {
this.rq(false);
this.qk();
}
switch (b) {
case FinancialPriceSeries.$$p[3]:
if (this.su != null) {
this.ab0();
this.sh();
this.w7.x();
this.aad(this.w7, this.aa1);
}
this.qk();
break;
case "ActualHighlightingMode":
case "ActualSelectionMode":
case "ActualFocusMode":
this.rq(true);
break;
case "TrendLineBrush":
this.re(b);
break;
case "TrendLineType":
this.qk();
break;
case FinancialSeries.$$p[10]:
case FinancialPriceSeries.$$p[8]:
this.q2();
break;
}
}
ab0() {
this.aa1.ck();
if (this.cu != null) {
this.cu.ck();
}
}
ay(a) {
if (a != null && a == this.xo && this.x0 != null && !isNaN_(this.x0.minimum) && this.xz != null && !isNaN_(this.xz.maximum)) {
return new AxisRange(this.x0.minimum, this.xz.maximum);
}
return null;
}
az(a) {
if (a.isEmpty && this.db != null) {
a = this.db.v4;
}
if (this.x0 == null || this.xz == null) {
return null;
}
let b = this.wi(this.cv);
let c = new ScalerParams(0, a, this.db.wk, this.w5.ch, this.getEffectiveViewport());
let d = (this.w5.eo(b.left, c));
let e = (this.w5.eo(b.right, c));
if (this.w5.ch) {
let f = d;
d = e;
e = f;
}
let g = null;
if (this.w5.cn) {
g = this.w5;
d = g.i$f(d);
e = g.i$f(e);
}
else {
d = Math.floor(d);
e = Math.ceil(e);
}
d = Math.max(0, Math.min(this.x0.count - 1, d));
e = Math.max(0, Math.min(this.x0.count - 1, e));
let h = 1.7976931348623157E+308;
let i = -1.7976931348623157E+308;
for (let j = truncate(d); j <= truncate(e); j++) {
let k = j;
if (g != null) {
k = g.i$b._inner[j];
}
let l = this.x0.item(k);
if (this.x0.mayContainUnknowns) {
if (isInfinity(l) || isNaN_(l)) {
continue;
}
}
let m = this.xz.item(k);
if (this.xz.mayContainUnknowns) {
if (isInfinity(m) || isNaN_(m)) {
continue;
}
}
h = Math.min(h, l);
i = Math.max(i, m);
}
let n = new AxisRange(h, i);
n = this.ax(n, this.xo, a);
return n;
}
ix() {
return Series.iy(this.x1, typeCast(ISortingAxis_$type, this.w5));
}
gc(a) {
let b = this.dn != null ? this.dn.indexOf(a) : -1;
let c = this.cv.by;
c = c.copy();
let d = this.cv.bx;
let e = new Rect(0, 0, 0, 1, 1);
let f = this.wk(this.cv);
if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
if (this.w5 != null) {
let g = new ScalerParams(0, e, e, this.w5.ch, f);
let h = this.w5.el(b, g);
if (h < c.left + 0.1 * c.width) {
h = h + 0.4 * c.width;
}
if (h > c.right - 0.1 * c.width) {
h = h - 0.4 * c.width;
}
c.x = h - 0.5 * c.width;
}
if (this.xo != null && this.x0 != null && this.xz != null && b < this.x0.count && b < this.xz.count) {
let i = new ScalerParams(0, e, e, this.xo.ch, f);
i.b = this.ix();
let j = this.xo.el(this.x0.item(b), i);
let k = this.xo.el(this.xz.item(b), i);
if (!isNaN_(j) && !isNaN_(k)) {
let l = Math.abs(j - k);
if (c.height < l) {
c.height = l;
c.y = Math.min(j, k);
}
else {
if (j < c.top + 0.1 * c.height) {
j = j + 0.4 * c.height;
}
if (j > c.bottom - 0.1 * c.height) {
j = j - 0.4 * c.height;
}
c.y = j - 0.5 * c.height;
}
}
}
this.c3.au(this.db, c, true);
}
return b >= 0;
}
hd(a, b, c) {
let d = super.hd(a, b, c);
if (this.x1 == null || this.xy == null || this.xz == null || this.x0 == null) {
d = false;
}
return d;
}
aab(a, b) {
super.aab(a, b);
let c = b.by;
let d = b.bx;
let e = this.getEffectiveViewport1(b);
let f = this.w5;
let g = this.xo;
let h = new ScalerParams(0, c, d, f.ch, e);
let i = ((() => {
let $ret = new ScalerParams(0, c, d, g.ch, e);
$ret.b = this.ix();
return $ret;
})());
let j = this.w5.ag();
let k = j[0];
let l = j[1];
a.f.clear();
if (a.m != null) {
a.m.clear();
}
a.n.clear();
a.q.clear();
let m = 0;
let n = typeCast(ISortingAxis_$type, this.w5);
if (n != null && (n.i$b == null || n.i$b.count != this.dn.count)) {
return;
}
m = this.yw(c, d, e);
let o = typeCast(FinancialPriceSeriesView.$, b);
let p = this.ic;
let q = b.b0.b;
if (this.trendLineType != 0) {
let r = new Array(this.dn.count);
let s = 0;
for (let t of fromEnum(this.yn)) {
r[s] = t;
s++;
}
if (this.aa1.ca) {
this.aa1.b8.prepareLineCore(a.q, this.trendLineType, boxArray$1(r), this.trendLinePeriod, (u) => this.w5.el(u, h), (u) => this.xo.el(u, i), ((() => {
let $ret = new TrendResolutionParams();
$ret.e = b.b0.b;
$ret.f = b.b0.c;
$ret.g = b.b0.d;
$ret.a = m;
$ret.d = p;
$ret.i = d;
$ret.h = e;
$ret.c = k;
$ret.b = l;
return $ret;
})()));
}
}
let u = this.w5.eo(2, h) - this.w5.eo(1, h);
for (let v = b.b0.c; v <= b.b0.d; ++v) {
let w;
let x = v * q;
if (n == null) {
w = b.b0.getBucket(v);
}
else {
let y = n.i$b._inner[v];
x = y;
let z = n.i$d(y);
let aa = this.x1.item(y);
let ab = this.xz.item(y);
let ac = this.x0.item(y);
let ad = this.xy.item(y);
let ae = aa;
let af = ab;
let ag = ac;
let ah = ad;
let ai = z;
while (v < b.b0.d) {
y = n.i$b._inner[v + 1];
ai = n.i$d(y);
if (ai - z > u * p) {
break;
}
x = y;
v++;
af = Math.max(af, this.xz.item(y));
ag = Math.min(ag, this.x0.item(y));
ah = this.xy.item(y);
}
let aj = NaN;
if (!isNaN_(z)) {
aj = this.w5.el(z, h);
}
w = [aj, ae, af, ag, ah];
}
if (!isNaN_(w[0])) {
if (n != null) {
w[0] = w[0] + m;
}
else {
w[0] = f.el(w[0], h) + m;
}
w[1] = g.el(w[1], i);
w[2] = g.el(w[2], i);
w[3] = g.el(w[3], i);
w[4] = g.el(w[4], i);
if (n != null) {
if (a.m == null) {
a.m = new List$1(Number_$type, 0);
}
a.m.add(x);
}
a.f.add(w);
}
}
return;
}
o4(a, b) {
super.o4(a, b);
let c = typeCast(FinancialPriceSeriesView.$, b);
c.ce();
if (a) {
c.b9.count = 0;
}
if (c.ca && c.b8 != null) {
c.b8.g$d();
}
}
sp(a, b) {
super.sp(a, b);
if (this.db != null) {
this.db.n2();
}
}
wu(a, b) {
if (this.w5 != null && this.w5.categoryMode == 0) {
let c = this.getEffectiveViewport1(this.cv);
let d = this.aa6(this.xm, c) / 2;
return new Thickness(1, d, 0, d, 0);
}
return super.wu(a, b);
}
get_ed() {
return true;
}
aad(a, b) {
super.aad(a, b);
if (this.w5 == null || this.xo == null) {
return;
}
let c = false;
if (b.b3(a)) {
c = true;
b.b5(a);
}
this.xe.a2(this, this.yd(), runOn(this, this.wx), this.y2(b), this.y4(b));
let d = false;
let e = this.xe.b;
if (e != null) {
d = true;
}
let f = typeCast(FinancialPriceSeriesView.$, b);
f.cd();
f.cb = false;
if (f.ca) {
f.b8.g$d();
}
if (this.trendLineType != 0) {
f.b8.g$g(a.q);
}
if (d) {
this.aby(a, b, c);
}
else {
f.b9.count = 0;
this.abx(a, b);
}
}
iv() {
let a = this.getEffectiveViewport1(this.cv);
return this.aa6(this.xm, a);
}
aby(a, b, c) {
let d = this.aa2;
let e = this.getEffectiveViewport1(b);
let f = this.aa6(b, e);
let g = (f - 1) / 2;
let h = typeCast(ISortingAxis_$type, this.w5) !== null;
let i = typeCast(FinancialPriceSeriesView.$, b);
i.cb = true;
let j = a.f;
let k = 0;
let l = this.dn.count;
let m = this.w5;
let n = new ScalerParams(0, b.by, b.bx, m.ch, e);
let o = this.u8;
let p = this.aav;
if (p == null) {
p = o;
}
let q = this.vc;
let r = this.acl;
if (r == null) {
r = q;
}
for (let s = 0; s < j.count; ++s) {
let t = j._inner[s][0] - g;
let u = j._inner[s][0];
let v = j._inner[s][0] + g;
let w = j._inner[s][1];
let x = j._inner[s][2];
let y = j._inner[s][3];
let z = j._inner[s][4];
if (isNaN_(w) || isNaN_(x) || isNaN_(y) || isNaN_(z)) {
continue;
}
let aa = i.b9.item(k);
k++;
let ab = w < z;
let ac = new PathGeometry();
if (c) {
switch (d) {
case 0:
if (ab) {
let ad = w;
w = z;
z = ad;
}
let ae = new PathFigure();
ae._startPoint = { $type: Point_$type, x: u, y: y };
ae._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: u, y: w };
return $ret;
})()));
let af = new PathFigure();
af._startPoint = { $type: Point_$type, x: t, y: z };
af._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: v, y: z };
return $ret;
})()));
af._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: v, y: w };
return $ret;
})()));
af._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: t, y: w };
return $ret;
})()));
af._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: t, y: z };
return $ret;
})()));
let ag = new PathFigure();
ag._startPoint = { $type: Point_$type, x: u, y: z };
ag._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: u, y: x };
return $ret;
})()));
ac.c.add(ae);
ac.c.add(af);
ac.c.add(ag);
break;
case 1:
let ah = new PathFigure();
ah._startPoint = { $type: Point_$type, x: t, y: w };
ah._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: u, y: w };
return $ret;
})()));
let ai = new PathFigure();
ai._startPoint = { $type: Point_$type, x: u, y: y };
ai._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: u, y: x };
return $ret;
})()));
let aj = new PathFigure();
aj._startPoint = { $type: Point_$type, x: u, y: z };
aj._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: v, y: z };
return $ret;
})()));
ac.c.add(ah);
ac.c.add(ai);
ac.c.add(aj);
break;
}
}
if (ab) {
this.xe.ak = p;
this.xe.ag = p;
this.xe.ah = r;
this.xe.al = r;
this.xe.f = true;
}
else {
this.xe.ak = o;
this.xe.ag = o;
this.xe.ah = q;
this.xe.al = q;
this.xe.f = false;
}
let ak = this.xe.aw(l, s)[0];
if (h && a.m != null && s >= 0 && s < a.m.count) {
ak = truncate(Math.round(a.m._inner[s]));
}
this.aaa(j, s, l, m, n, b.q, ak);
if (d == 1) {
this.xe.ad(aa, true, false, false, false);
}
else {
this.xe.ad(aa, false, false, false, false);
}
if (c) {
aa.an = ac;
}
}
i.b9.count = k;
i.cf();
}
aa6(a, b) {
let c = this.w5.k8(a.by, a.bx, b);
c = Math.max(c, this.ic * 0.9);
c = Math.max(c, 3);
return c;
}
abx(a, b) {
let c = this.aa2;
let d = this.getEffectiveViewport1(b);
let e = this.aa6(b, d);
let f = (e - 1) / 2;
let g = typeCast(FinancialPriceSeriesView.$, b);
let h = g.cn();
let i = g.cm();
let j = a.f;
for (let k = 0; k < j.count; ++k) {
let l = j._inner[k][0] - f;
let m = j._inner[k][0];
let n = j._inner[k][0] + f;
let o = j._inner[k][1];
let p = j._inner[k][2];
let q = j._inner[k][3];
let r = j._inner[k][4];
if (isNaN_(o) || isNaN_(p) || isNaN_(q) || isNaN_(r)) {
continue;
}
let s = o < r;
let t = s ? i : h;
switch (c) {
case 0:
if (s) {
let u = o;
o = r;
r = u;
}
t.d.add(((() => {
let $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: m, y: q };
$ret.c = { $type: Point_$type, x: m, y: o };
return $ret;
})()));
t.d.add(((() => {
let $ret = new RectangleGeometry();
$ret.e = new Rect(0, l, r, n - l, o - r);
return $ret;
})()));
t.d.add(((() => {
let $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: m, y: r };
$ret.c = { $type: Point_$type, x: m, y: p };
return $ret;
})()));
break;
case 1:
t.d.add(((() => {
let $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: l, y: o };
$ret.c = { $type: Point_$type, x: m, y: o };
return $ret;
})()));
t.d.add(((() => {
let $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: m, y: q };
$ret.c = { $type: Point_$type, x: m, y: p };
return $ret;
})()));
t.d.add(((() => {
let $ret = new LineGeometry();
$ret.d = { $type: Point_$type, x: m, y: r };
$ret.c = { $type: Point_$type, x: n, y: r };
return $ret;
})()));
break;
}
}
}
kw(a, b) {
if (this.aa1.ca && a == this.aa1.b8.g$j) {
return null;
}
return super.kw(a, b);
}
sg() {
super.sg();
if (this.index < 0) {
return;
}
this.aa1.cl();
}
py(a) {
super.py(a);
if (this.aa1.ca) {
this.bc.exportTrendlineData(this, a, this.aa1.b8.g$j);
}
}
vw() {
return this.acl;
}
r2(a, b) {
super.r2(a, b);
this.acl = b;
}
be(a) {
if (this.aa2 == 0) {
return 3;
}
else if (this.aa2 == 1) {
if (this.bd == 1) {
return 3;
}
return 2;
}
return a;
}
getDataLegendSeriesContextAt(a, b) {
let c = { $type: Point_$type, x: a, y: b };
let d = this.i2(c, false, false);
let e = this.i0(c, false, false);
let f = new DataLegendSeriesValueInfo();
f.a = 4;
f.l = this.yx(c, false, false);
f.q = "Close";
f.r = this.y9 != null ? this.y9 : "Close";
f.s = this.aba != null ? this.aba : "C:";
f.t = this.abc != null ? this.abc : "";
let g = new DataLegendSeriesValueInfo();
g.l = this.yy(c, false, false);
g.a = 3;
g.q = "Open";
g.r = this.zv != null ? this.zv : "Open";
g.s = this.abo != null ? this.abo : "O:";
g.t = this.abq != null ? this.abq : "";
g.k = true;
let h = new DataLegendSeriesValueInfo();
h.l = (f.l - g.l) / g.l * 100;
h.l = round10N(h.l, 1);
h.a = 9;
h.q = "Change";
h.r = "Change";
h.s = "";
h.v = "";
h.x = "+";
h.w = "%";
h.y = "%";
h.t = null;
h.c = false;
h.k = true;
h.e = false;
h.f = true;
h.h = false;
h.g = false;
h.d = false;
h.n = 1;
h.m = 1;
g.z = h.l >= 0 ? this.u8 : this.aav;
f.z = h.l >= 0 ? this.u8 : this.aav;
h.z = h.l >= 0 ? this.u8 : this.aav;
let i = new DataLegendSeriesValueInfo();
i.l = e > d ? d : e;
i.a = 1;
i.q = "Low";
i.r = this.zr != null ? this.zr : "Low";
i.s = this.abj != null ? this.abj : "L:";
i.t = this.abl != null ? this.abl : "";
i.k = true;
let j = new DataLegendSeriesValueInfo();
j.l = e > d ? e : d;
j.a = 2;
j.q = "High";
j.r = this.zm != null ? this.zm : "High";
j.s = this.abf != null ? this.abf : "H:";
j.t = this.abh != null ? this.abh : "";
j.k = true;
let k = new DataLegendSeriesValueInfo();
k.l = (j.l + i.l + f.l) / 3;
k.l = round10N(k.l, 2);
k.a = 5;
k.q = "TypicalPrice";
k.r = "TypicalPrice";
k.s = "TP:";
k.t = "";
k.k = true;
let l = new DataLegendSeriesValueInfo();
l.l = this.yz(c, false, false);
l.a = 8;
l.q = "Volume";
l.r = this.zz != null ? this.zz : "Volume";
l.s = "VOL:";
l.t = "";
l.k = true;
l.n = 0;
l.m = 0;
l.e = false;
l.f = false;
l.h = false;
let m = new List$1(DataLegendSeriesValueInfo.$, 0);
m.add(g);
m.add(j);
m.add(i);
m.add(f);
m.add(k);
m.add(h);
m.add(l);
let n = new DataLegendSeriesContext();
n.h = this.mb();
n.e = m;
return n;
}
abz() {
if (this.aa3) {
this.aa4 = 0;
for (let a = 0; a < this.xz.count; a++) {
let b = 0;
b += this.xz.item(a);
b += this.x0.item(a);
b += this.xy.item(a);
this.aa4 += b / 3;
}
this.aa5 = this.aa4 / this.xz.count;
this.aa3 = false;
}
}
aq(a) {
let b = NaN;
switch (a) {
case 2:
b = this.xz.maximum;
break;
case 1:
b = this.x0.minimum;
break;
case 3:
if (this.aa3) {
this.abz();
}
b = this.aa5;
break;
}
let c = this.xo;
if (c.cp) {
return [NaN, b];
}
else {
return [b, NaN];
}
}
we(a) {
let b = NaN;
switch (a) {
case 2:
b = this.xz.maximum;
break;
case 1:
b = this.x0.minimum;
break;
case 3:
if (this.aa3) {
this.abz();
}
b = this.aa5;
break;
}
if (isNaN_(b)) {
return { $type: Point_$type, x: NaN, y: NaN };
}
let c = this.xo;
let d = this.getEffectiveViewport1(this.cv);
let e = new ScalerParams(0, this.cv.by, this.cv.bx, c.ch, d);
if (c.cp) {
e.b = this.ix();
}
e.c = d;
if (c.cp) {
return { $type: Point_$type, x: NaN, y: c.el(b, e) };
}
else {
return { $type: Point_$type, x: c.el(b, e), y: NaN };
}
}
wf(a) {
let b = this.xo;
let c = this.getEffectiveViewport1(this.cv);
let d = new ScalerParams(0, this.cv.by, this.cv.bx, b.ch, c);
if (b.cp) {
d.b = this.ix();
}
d.c = c;
if (b.cp) {
return { $type: Point_$type, x: NaN, y: b.el(a[1], d) };
}
else {
return { $type: Point_$type, x: b.el(a[0], d), y: NaN };
}
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p3(a, c, b);
return c.toArray();
}
p3(a, b, c) {
let d = this.wq(a);
let e = this.xo;
let f = this.w5;
let g = this.wi(this.cv);
let h, i;
let j = this.abu(d, f, true, g, h, i);
h = j.p4;
i = j.p5;
if (this.aa0 == 0) {
this.abw(b, h, i, c);
}
else {
let k, l;
let m = this.abt(d, e, true, g, k, l);
k = m.p4;
l = m.p5;
this.abv(1, b, h, i, k, l, c);
}
}
abu(a, b, c, d, e, f) {
let g = new ScalerParams(0, a, this.db.wk, this.w5.ch, this.getEffectiveViewport());
let h = (this.w5.eo(d.left, g));
let i = (this.w5.eo(d.right, g));
if (this.w5.ch) {
let j = h;
h = i;
i = j;
}
if (this.w5.cn) {
let k = this.w5;
h = k.i$f(h);
i = k.i$f(i);
}
else {
h = Math.floor(h);
i = Math.ceil(i);
}
e = truncate(Math.max(0, Math.min(this.x0.count - 1, h)));
f = truncate(Math.max(0, Math.min(this.x0.count - 1, i)));
return {
p4: e,
p5: f
};
}
abt(a, b, c, d, e, f) {
let g = new ScalerParams(0, a, this.db.wk, b.ch, this.getEffectiveViewport());
let h = c ? (b.ch ? d.top : d.bottom) : (b.ch ? d.left : d.right);
let i = c ? (b.ch ? d.bottom : d.top) : (b.ch ? d.right : d.left);
e = b.eo(h, g);
f = b.eo(i, g);
return {
p4: e,
p5: f
};
}
abs(a, b, c) {
if (c == 2 || c == 1) {
a.add(((() => {
let $ret = new ChartSelection();
$ret.item = this.dn.item(b);
return $ret;
})()));
}
else {
a.add(((() => {
let $ret = new ChartSelection();
$ret.item = this.dn.item(b);
$ret.series = this;
return $ret;
})()));
}
}
abw(a, b, c, d) {
if (b == -1 || c == -1) {
return;
}
if (d == 7 || d == 6) {
a.add(((() => {
let $ret = new ChartSelection();
$ret.series = this;
return $ret;
})()));
return;
}
for (let e = b; e <= c; e++) {
this.abs(a, e, d);
}
}
abv(a, b, c, d, e, f, g) {
if (c == -1 || d == -1) {
return;
}
for (let h = c; h <= d; h++) {
let i = Math.min(this.x1.item(h), this.x0.item(h));
let j = Math.max(this.xy.item(h), this.xz.item(h));
let k = Math.min(i, j);
let l = Math.max(i, j);
if (k < f && e < l) {
if (g == 7 || g == 6) {
b.add(((() => {
let $ret = new ChartSelection();
$ret.series = this;
return $ret;
})()));
return;
}
this.abs(b, h, g);
}
}
}
}
FinancialPriceSeries.$t = markType(FinancialPriceSeries, 'FinancialPriceSeries', FinancialSeries.$, [ITrendLineSeries_$type]);
FinancialPriceSeries.ab1 = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialPriceSeries.$, new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
FinancialPriceSeries.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialPriceSeries, 'raisePropertyChanged', ['CategoryCollisionMode:aa0:ab2', [CategoryCollisionMode_$type, enumGetBox(CategoryCollisionMode_$type, 0)], 'CloseMemberAsLegendLabel:aba:ab3', [2, null], 'CloseMemberAsLegendUnit:abc:ab4', [2, null], 'DisplayType:aa2:ab5', [PriceDisplayType_$type, enumGetBox(PriceDisplayType_$type, 0)], 'HighMemberAsLegendLabel:abf:ab6', [2, null], 'HighMemberAsLegendUnit:abh:ab7', [2, null], 'LowMemberAsLegendLabel:abj:ab8', [2, null], 'LowMemberAsLegendUnit:abl:ab9', [2, null], 'NegativeOutline:acl:aca', [Brush.$, null], 'OpenMemberAsLegendLabel:abo:acb', [2, null], 'OpenMemberAsLegendUnit:abq:acc', [2, null], 'TrendLineType::aci', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ach', [1, 1.5], 'TrendLinePeriod::acg', [1, 7], 'TrendLineBrush::acd', [Brush.$, null], 'TrendLineZIndex:aa8:acj', [1, 1001], 'TrendLineDashArray:acm:ace', [DoubleCollection.$], 'TrendLineDashCap:acn:acf', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
return FinancialPriceSeries;
})();
/**
* @hidden
*/
export let FinancialPriceSeriesView = /*@__PURE__*/ (() => {
class FinancialPriceSeriesView extends FinancialSeriesView {
constructor(a) {
super(a);
this.b6 = null;
this.b9 = null;
this.cc = null;
this.cq = ((() => {
let $ret = new Path();
$ret.an = new GeometryGroup();
return $ret;
})());
this.cp = ((() => {
let $ret = new Path();
$ret.an = new GeometryGroup();
return $ret;
})());
this.b7 = null;
this.co = new Path();
this.cb = false;
this.b6 = a;
this.cc = new List$1(Path.$, 0);
this.b9 = ((() => {
let $ret = new Pool$1(Path.$);
$ret.create = runOn(this, this.cr);
$ret.activate = runOn(this, this.ch);
$ret.disactivate = runOn(this, this.cj);
$ret.destroy = runOn(this, this.ci);
return $ret;
})());
}
cr() {
let a = new Path();
this.cc.add(a);
a._visibility = 1;
return a;
}
ch(a) {
a._visibility = 0;
}
cj(a) {
a._visibility = 1;
}
ci(a) {
this.cc.remove(a);
}
b1() {
return new FinancialPriceBucketCalculator(this);
}
au() {
super.au();
if (!this.q) {
this.b6.aa2 = Defaults.g;
this.b6.aav = Defaults.ah;
this.b6.acl = Defaults.ai;
this.b6.jo = Defaults.l;
this.b6.vu = this.b6.vc;
}
}
get b8() {
if (this.b7 == null) {
this.b7 = CategoryTrendLineManagerFactory.a(this.b7, this.e.a0(), this.e.su, this.e, this.e.dr);
}
return this.b7;
}
set b8(a) {
this.b7 = a;
}
get ca() {
return this.b7 != null;
}
ck() {
if (this.b6.aa2 == 1) {
this.cq._stroke = this.e.u8;
}
else {
this.cq._stroke = this.e.vc;
}
if (this.b6.aa2 == 1) {
this.cp._stroke = this.b2.aav;
}
else {
this.cp._stroke = this.b6.acl;
}
}
ce() {
this.as();
this.b9.count = 0;
this.cd();
}
cd() {
let a = typeCast(GeometryGroup.$, this.cq.an);
let b = typeCast(GeometryGroup.$, this.cp.an);
Extensions.d(a);
Extensions.d(b);
}
cn() {
this.as();
return typeCast(GeometryGroup.$, this.cq.an);
}
cm() {
this.as();
return typeCast(GeometryGroup.$, this.cp.an);
}
cl() {
this.b6.ack = null;
if (this.b6.trendLineBrush != null) {
this.b6.ack = this.b6.trendLineBrush;
}
else {
this.b6.ack = this.b6.u8;
}
}
bd() {
super.bd();
this.cq.ad = this.e.id;
this.cq.ai = this.e.v1;
this.cq.aj = this.e.v2;
if (this.b6.aa2 == 1) {
this.cq._stroke = this.e.u8;
}
else {
this.cq._stroke = this.e.vc;
this.cq._fill = this.e.u8;
}
this.cp.ad = this.e.id;
this.cp.ai = this.e.v1;
this.cp.aj = this.e.v2;
if (this.b6.aa2 == 1) {
this.cp._stroke = this.b2.aav;
}
else {
this.cp._stroke = this.b6.acl;
this.cp._fill = this.b2.aav;
}
}
be() {
super.be();
let a = this.br();
this.cq.ad = this.e.id + 3;
if (this.b6.aa2 == 1) {
this.cq._stroke = a;
}
else {
this.cq._stroke = a;
this.cq._fill = a;
}
this.cp.ad = this.e.id + 3;
if (this.b6.aa2 == 1) {
this.cp._stroke = a;
}
else {
this.cp._stroke = a;
this.cp._fill = a;
}
}
ac(a) {
return this.cc._inner[a];
}
ab(a) {
let b = this.cc._inner[a];
this.co._visibility = b._visibility;
this.co.an = b.an;
let c = this.bs(a);
this.co._fill = c;
this.co._stroke = c;
this.co.ad = this.e.id + 3;
return this.co;
}
a8(a, b) {
super.a8(a, b);
if (a.d) {
if (this.cb) {
for (let c = 0; c < this.cc.count; c++) {
let d = this.aa(c, b);
if (d._visibility == 0) {
a.t(d);
}
}
}
else {
a.t(this.cq);
a.t(this.cp);
}
}
}
a7(a, b) {