igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
340 lines (339 loc) • 11.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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { DependencyProperty } from "igniteui-react-core";
import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition";
import { Defaults } from "./Defaults";
import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
import { ChartSelection } from "./ChartSelection";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
* @hidden
*/
export let ColumnSeries = /*@__PURE__*/ (() => {
class ColumnSeries extends HorizontalAnchoredCategorySeries {
bk() {
return new ColumnSeries();
}
get_e0() {
return true;
}
get_fl() {
return true;
}
jk() {
if (!isNaN_(this.jj)) {
return super.jk();
}
return Defaults.h;
}
ct() {
return new ColumnSeriesView(this);
}
q1(a) {
super.q1(a);
this.acx = a;
}
cz() {
if (this.c0 == 0) {
return 2;
}
return super.cz();
}
y6() {
return 1;
}
constructor() {
super();
this.ac3 = null;
this.acy = 0;
this.ab = ColumnSeries.$;
this.ach = 2;
}
get_ee() {
return true;
}
preferredCategoryMode(a) {
return this.ach;
}
wp(a) {
if (this.ac3 == null) {
this.ac3 = runOn(this, this.ac0);
}
let b = this.ack != null ? this.ack : this.yAxis;
let c = this.ace;
return this.aa1.c$d(this, a, c, b, this.yw, this.zx(this.cw), this.zy(this.cw), this.ac3);
}
gw(a, b) {
if (this.gz(a, b)) {
return true;
}
if (this.xj(a, b)) {
return true;
}
return false;
}
o5(a, b) {
super.o5(a, b);
let c = b;
if (a && c.dk != null) {
c.dk.count = 0;
}
}
iw() {
return this.ace.k8(this.cw.b2, this.cw.b1, this.getEffectiveViewport1(this.cw));
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p4(a, c, b);
return c.toArray();
}
p4(a, b, c) {
this.aae(a, b, c, this.yv, 1);
}
aam(a, b) {
super.aam(a, b);
let c = a.h;
if (!b.u()) {
return;
}
let d = b.b2;
let e = b.b1;
let f = this.getEffectiveViewport1(b);
let g = new ScalerParams(0, d, e, this.ack.ch, f);
g.b = this.iy();
let h = new ScalerParams(0, d, e, this.ace.ch, f);
let i = this.ack;
let j = i.el(i.me, g);
let k = this.ace.k8(d, e, f);
let l = this.ace;
let m = b;
if (isNaN_(k) || isInfinity(k)) {
m.dk.count = 0;
return;
}
this.y4.a2(this, this.zo(), runOn(this, this.yo), this.zx(b), this.zy(b));
this.y4.r = this.ac1;
this.y4.s = this.ac2;
this.y4.k = this.ac1;
this.y4.l = this.ac2;
let n = false;
let o = this.y4.b;
if (o != null) {
n = true;
}
let p = this.ace.cn;
let q = p ? this.ace : null;
let r = this.valueColumn.count;
let s = this.zx(b);
let t = 0;
for (let u = 0; u < c.count; ++u) {
let v = c._inner[u][0] - 0.5 * k;
let w = this.ac0(c._inner[u]);
let x = j;
w = Math.max(w, -100);
x = Math.min(x, e.bottom + 100);
let y = Math.abs(x - w);
if (isInfinity(y) || isNaN_(y)) {
continue;
}
let z = m.dk.item(t);
t++;
z.width = k;
z.height = y;
let aa = this.y4.aw(r, u)[0];
if (p && a.o != null && u >= 0 && u < a.o.count) {
aa = truncate(Math.round(a.o._inner[u]));
}
if (n) {
this.aai(c, u, r, l, h, b.r, aa);
}
if (z.dataContext != null) {
let ab = z.dataContext;
if (s == 1) {
if (aa >= 0 && aa < this.dp.count) {
if (q != null && q.i$b != null && q.i$b.count > aa) {
aa = q.i$b._inner[aa];
}
ab.item = this.dp.item(aa);
}
}
else {
ab.item = null;
}
}
this.y4.ad(z, false, false, false, false);
z.ap = this.y4.k;
z.aq = this.y4.l;
m.dq(z, v, Math.min(x, w));
}
m.dk.count = t;
b.c7(a);
}
get acz() {
return this.acy;
}
set acz(a) {
if (this.acz != a) {
let b = this.acz;
this.acy = a;
this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.acz));
}
}
ac0(a) {
if (a == null || a.length < 3) {
return NaN;
}
switch (this.acz) {
case 0: return a[1];
case 1: return a[2];
case 2: return (a[1] + a[2]) / 2;
case 3:
let b = (a[1] + a[2]) / 2;
if (this.yAxis == null) {
return b;
}
let c = this.yAxis.eo(b, new ScalerParams(1, this.dc.wo, this.dc.wn, this.yAxis.ch));
if (c < this.yAxis.me) {
return a[2];
}
else {
return a[1];
}
case 4:
let d = (a[1] + a[2]) / 2;
let e = this.yAxis.eo(d, new ScalerParams(1, this.dc.wo, this.dc.wn, this.yAxis.ch));
if (this.yAxis == null) {
return d;
}
if (e < this.yAxis.me) {
return a[1];
}
else {
return a[2];
}
default: return (a[1] + a[2]) / 2;
}
}
get useHighMarkerFidelity() {
return this.zs;
}
}
ColumnSeries.$t = /*@__PURE__*/ markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
ColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:ac1:ac7', [1, 0], 'RadiusY:ac2:ac8', [1, 0]]);
return ColumnSeries;
})();
/**
* @hidden
*/
export let ColumnSeriesView = /*@__PURE__*/ (() => {
class ColumnSeriesView extends AnchoredCategorySeriesView {
ax() {
super.ax();
this.dl = new List$1(Rectangle.$, 0);
if (!this.r) {
this.dj.jp = Defaults.i;
this.dj.xc = Defaults.c;
}
}
constructor(a) {
super(a);
this.dj = null;
this.dl = null;
this.dr = new Rectangle();
this.dk = null;
this.dj = a;
this.dk = ((() => {
let $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(this, this.ds);
$ret.activate = runOn(this, this.dm);
$ret.disactivate = runOn(this, this.dp);
$ret.destroy = runOn(this, this.dn);
return $ret;
})());
}
ds() {
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) {
if (!this.isDirty) {
this.av();
}
a.o = c;
a.n = b;
}
af(a) {
return this.dl._inner[a];
}
ae(a) {
let b = this.dl._inner[a];
this.dr._visibility = b._visibility;
this.dr.n = b.n;
this.dr.o = b.o;
this.dr.width = b.width;
this.dr.height = b.height;
let c = this.bw(a);
this.dr._fill = c;
this.dr._stroke = c;
this.dr.ad = this.f.ie + 3;
return this.dr;
}
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)) {
this.f.bc.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]);
}
b++;
}
}
ColumnSeriesView.$t = /*@__PURE__*/ markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$);
return ColumnSeriesView;
})();