igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
504 lines (503 loc) • 16.5 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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { Brush } from "igniteui-react-core";
import { DependencyProperty } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { runOn, delegateCombine, markType, markDep, fromEnum } from "igniteui-react-core";
import { Defaults } from "./Defaults";
import { Rect } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
import { ArrayExtension } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { ChartSelection } from "./ChartSelection";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_ } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { BrushUtil } from "igniteui-react-core";
/**
* @hidden
*/
export let WaterfallSeries = /*@__PURE__*/ (() => {
class WaterfallSeries extends HorizontalAnchoredCategorySeries {
bk() {
return new WaterfallSeries();
}
get_f6() {
return true;
}
get_fl() {
return true;
}
ht() {
let a = super.ht();
{
let b = ((() => {
let $ret = new SeriesLayerPropertyOverlay();
$ret.r = true;
$ret.ad = "NegativeBrush";
$ret.p = true;
$ret.q = true;
return $ret;
})());
b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.r2));
a.add(b);
}
{
let c = ((() => {
let $ret = new SeriesLayerPropertyOverlay();
$ret.r = true;
$ret.ad = "NegativeOutline";
$ret.p = true;
$ret.q = true;
return $ret;
})());
c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.r2));
a.add(c);
}
return a;
}
jk() {
if (!isNaN_(this.jj)) {
return super.jk();
}
return Defaults.h;
}
get_fb() {
return true;
}
ct() {
return new WaterfallSeriesView(this);
}
q1(a) {
super.q1(a);
this.acx = a;
}
constructor() {
super();
this.ab = WaterfallSeries.$;
}
preferredCategoryMode(a) {
return 2;
}
get_fm() {
return true;
}
r5(a, b) {
super.r5(a, b);
this.ac8 = a;
this.ac9 = b;
}
vy() {
return this.ac8;
}
vz() {
return this.ac9;
}
cz() {
if (this.c0 == 0) {
return 2;
}
return super.cz();
}
get_ee() {
return true;
}
ra(a, b, c, d) {
super.ra(a, b, c, d);
switch (b) {
case WaterfallSeries.$$p[3]:
case WaterfallSeries.$$p[2]:
case WaterfallSeries.$$p[0]:
case WaterfallSeries.$$p[1]:
this.rs(false);
break;
}
}
gw(a, b) {
if (this.gz(a, b)) {
return true;
}
if (this.xj(a, b)) {
return true;
}
return false;
}
wp(a) {
if (this.acx == null || this.acx.dk == null || this.acx.dk.count == 0 || this.xAxis == null) {
return Rect.empty;
}
let b = this.acx.dk;
let c = this.v9(a);
let d = -1;
let e = this.xAxis.ch;
let f = this.wu.right * 2;
if (e) {
d = ArrayExtension.binarySearch$1(Rectangle.$, b, (g) => {
let h = this.acx.ds(g);
return (f - c.x) < (f - (h.left + h.width / 2)) ? -1 : ((f - c.x) > (f - (h.left + h.width / 2)) ? 1 : 0);
});
}
else {
d = ArrayExtension.binarySearch$1(Rectangle.$, b, (g) => {
let h = this.acx.ds(g);
return c.x < (h.left + h.width / 2) ? -1 : (c.x > (h.left + h.width / 2) ? 1 : 0);
});
}
if (d < 0) {
d = ~d;
d--;
}
if (d < 0) {
d = 0;
}
if (d > b.count - 1) {
d = b.count - 1;
}
let g = d;
let h = d;
if (g < 0) {
g--;
}
if (h < b.count - 1) {
h++;
}
let i = this.ada(g);
let j = this.ada(d);
let k = this.ada(h);
let l = i.left + i.width / 2;
let m = j.left + j.width / 2;
let n = k.left + k.width / 2;
let o = Math.abs(l - c.x);
let p = Math.abs(m - c.x);
let q = Math.abs(n - c.x);
let r = i.containsPoint(c);
let s = j.containsPoint(c);
let t = k.containsPoint(c);
if (p <= o && p <= q) {
if (!e && t) {
return k;
}
if (e && r) {
return i;
}
return j;
}
if (o <= p && o <= q) {
if (!e && s) {
return j;
}
return i;
}
if (q <= p && q <= o) {
if (e && s) {
return j;
}
return k;
}
return Rect.empty;
}
ada(a) {
return this.acx.dr(a);
}
y6() {
return 1;
}
o5(a, b) {
super.o5(a, b);
this.acx.dk.count = 0;
}
get_abc() {
return 1;
}
iw() {
return this.ace.k8(this.cw.b2, this.cw.b1, this.getEffectiveViewport1(this.cw));
}
aam(a, b) {
let c = b;
super.aam(a, b);
let d = b.b2;
let e = b.b1;
let f = this.getEffectiveViewport1(b);
let g = this.ace.k8(d, e, f);
let h = this.acy;
let i = this.acz;
let j;
let k = this.aba(b);
let l = NaN;
let m = c.dk;
let n;
let o = 0;
this.y4.a2(this, this.zo(), runOn(this, this.yo), this.zx(b), this.zy(b));
this.y4.r = this.acy;
this.y4.s = this.acz;
this.y4.k = this.acy;
this.y4.l = this.acz;
let p = false;
let q = this.y4.b;
if (q != null) {
p = true;
}
let r = this.ace.cn;
let s = this.valueColumn.count;
let t = a.h;
let u = this.ace;
let v = new ScalerParams(0, d, e, this.ace.ch, f);
let w = this.vb;
let x = this.ac8;
let y = this.vf;
let z = this.ac9 || y;
if (a.h.count > 0) {
j = a.h._inner[0][0] - 0.5 * g;
let aa = a.h._inner[0][1];
if (!isNaN_(aa)) {
if (aa > k) {
n = m.item(o);
o++;
c.dq(n, j, k);
n.width = g;
n.height = Math.abs(k - aa);
this.y4.ak = x;
this.y4.ag = x;
this.y4.al = z;
this.y4.ah = z;
this.y4.f = true;
let ab = this.y4.aw(s, 0)[0];
if (r && a.o != null && 0 < a.o.count) {
ab = truncate(Math.round(a.o._inner[0]));
}
if (p) {
this.aai(t, 0, s, u, v, b.r, ab);
}
this.y4.ad(n, false, false, false, false);
n.ap = this.y4.k;
n.aq = this.y4.l;
}
else {
n = m.item(o);
o++;
c.dq(n, j, aa);
n.width = g;
n.height = Math.abs(aa - k);
this.y4.ak = w;
this.y4.ag = w;
this.y4.al = y;
this.y4.ah = y;
this.y4.f = false;
let ac = this.y4.aw(s, o)[0];
if (r && a.o != null && o >= 0 && o < a.o.count) {
ac = truncate(Math.round(a.o._inner[o]));
}
if (p) {
this.aai(t, 0, s, u, v, b.r, ac);
}
this.y4.ad(n, false, false, false, false);
n.ap = this.y4.k;
n.aq = this.y4.l;
}
l = aa;
}
else {
l = k;
}
}
for (let ad = 1; ad < a.h.count; ++ad) {
let ae = a.h._inner[ad];
j = a.h._inner[ad][0] - 0.5 * g;
let af = ae[1];
if (!isNaN_(af)) {
n = m.item(o);
o++;
c.dq(n, j, Math.min(l, af));
n.width = g;
n.height = Math.abs(l - af);
this.y4.ak = w;
this.y4.ag = w;
this.y4.al = y;
this.y4.ah = y;
this.y4.f = false;
let ag = this.y4.aw(s, o)[0];
if (r && a.o != null && o >= 0 && o < a.o.count) {
ag = truncate(Math.round(a.o._inner[o]));
}
if (l > af) {
if (p) {
this.aai(t, ad, s, u, v, b.r, ag);
}
}
else {
this.y4.ak = x;
this.y4.ag = x;
this.y4.al = z;
this.y4.ah = z;
this.y4.f = true;
if (p) {
this.aai(t, ad, s, u, v, b.r, ag);
}
}
this.y4.ad(n, false, false, false, false);
n.ap = this.y4.k;
n.aq = this.y4.l;
l = af;
}
}
m.count = o;
b.c7(a);
}
p4(a, b, c) {
this.aae(a, b, c, this.yv, 1);
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p4(a, c, b);
return c.toArray();
}
aa5(a, b, c) {
if (c == 0) {
return 0 < b && a < this.valueColumn.item(c);
}
else {
let d = this.valueColumn.item(c - 1);
let e = Math.min(d, this.valueColumn.item(c));
let f = Math.max(d, this.valueColumn.item(c));
return e < b && a < f;
}
}
get useHighMarkerFidelity() {
return this.zs;
}
}
WaterfallSeries.$t = /*@__PURE__*/ markType(WaterfallSeries, 'WaterfallSeries', HorizontalAnchoredCategorySeries.$);
WaterfallSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, WaterfallSeries, 'raisePropertyChanged', ['NegativeBrush:ac8:ac4', [Brush.$, null], 'NegativeOutline:ac9:ac5', [Brush.$, null], 'RadiusX:acy:ac6', [1, 0], 'RadiusY:acz:ac7', [1, 0]]);
return WaterfallSeries;
})();
/**
* @hidden
*/
export let WaterfallSeriesView = /*@__PURE__*/ (() => {
class WaterfallSeriesView extends AnchoredCategorySeriesView {
ax() {
super.ax();
this.dl = new List$1(Rectangle.$, 0);
if (!this.r) {
this.dj.xc = Defaults.c;
this.dj.jp = Defaults.i;
this.dj.ac8 = Defaults.ah;
this.dj.ac9 = Defaults.ai;
}
}
constructor(a) {
super(a);
this.dj = null;
this.dl = null;
this.dt = new Rectangle();
this.dk = null;
this.dj = a;
this.dk = ((() => {
let $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(this, this.du);
$ret.activate = runOn(this, this.dm);
$ret.disactivate = runOn(this, this.dp);
$ret.destroy = runOn(this, this.dn);
return $ret;
})());
}
du() {
let a = new Rectangle();
this.dl.add(a);
a._visibility = 1;
return a;
}
dm(a) {
a._visibility = 0;
}
dp(a) {
a._visibility = 1;
}
dn(a) {
this.dl.remove(a);
}
dq(a, b, c) {
let d = false;
if (a.o != c) {
d = true;
a.o = c;
}
if (a.n != b) {
d = true;
a.n = b;
}
if (d) {
this.av();
}
}
af(a) {
return this.dl._inner[a];
}
ae(a) {
let b = this.dl._inner[a];
this.dt._visibility = b._visibility;
this.dt.n = b.n;
this.dt.o = b.o;
this.dt.width = b.width;
this.dt.height = b.height;
let c = this.bw(a);
this.dt._fill = c;
this.dt._stroke = c;
this.dt.ad = this.f.ie + 3;
return this.dt;
}
bc(a, b) {
super.bc(a, b);
if (a.d) {
for (let c = 0; c < this.dl.count; c++) {
let d = this.ad(c, b);
this.bj(d, c, b);
a.w(d);
}
}
}
aq(a) {
super.aq(a);
let b = 0;
let c = new List$1(Rectangle.$, 0);
for (let d of fromEnum(this.dk.a)) {
c.add(d);
}
c.aa((e, f) => {
if (e.n < f.n) {
return -1;
}
else if (e.n > f.n) {
return 1;
}
else {
return 0;
}
});
for (let e of fromEnum(c)) {
let f = "Negative";
if (BrushUtil.d(e._fill, this.f.vb)) {
f = "Positive";
}
this.f.bc.exportRectangleData(a, e, "column" + b, ["Main", f]);
}
b++;
}
dr(a) {
let b = this.dk.item(a);
return new Rect(0, b.n, b.o, b.width, b.height);
}
ds(a) {
return new Rect(0, a.n, a.o, a.width, a.height);
}
}
WaterfallSeriesView.$t = /*@__PURE__*/ markType(WaterfallSeriesView, 'WaterfallSeriesView', AnchoredCategorySeriesView.$);
return WaterfallSeriesView;
})();