igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
340 lines (339 loc) • 11.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 { DependencyProperty } from "igniteui-angular-core";
import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition";
import { Defaults } from "./Defaults";
import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { List$1 } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
* @hidden
*/
export let ColumnSeries = /*@__PURE__*/ (() => {
class ColumnSeries extends HorizontalAnchoredCategorySeries {
constructor() {
super();
this.ac1 = null;
this.acw = 0;
this.ab = ColumnSeries.$;
this.acf = 2;
}
bj() {
return new ColumnSeries();
}
get_ez() {
return true;
}
get_fk() {
return true;
}
jj() {
if (!isNaN_(this.ji)) {
return super.jj();
}
return Defaults.h;
}
cs() {
return new ColumnSeriesView(this);
}
q0(a) {
super.q0(a);
this.acv = a;
}
cy() {
if (this.cz == 0) {
return 2;
}
return super.cy();
}
y3() {
return 1;
}
get_ed() {
return true;
}
preferredCategoryMode(a) {
return this.acf;
}
wm(a) {
if (this.ac1 == null) {
this.ac1 = runOn(this, this.acy);
}
let b = this.aci != null ? this.aci : this.yAxis;
let c = this.acc;
return this.aaz.c$d(this, a, c, b, this.yt, this.zu(this.cv), this.zv(this.cv), this.ac1);
}
gv(a, b) {
if (this.gy(a, b)) {
return true;
}
if (this.xg(a, b)) {
return true;
}
return false;
}
o4(a, b) {
super.o4(a, b);
let c = b;
if (a && c.dg != null) {
c.dg.count = 0;
}
}
iv() {
return this.acc.k8(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p3(a, c, b);
return c.toArray();
}
p3(a, b, c) {
this.aab(a, b, c, this.ys, 1);
}
aaj(a, b) {
super.aaj(a, b);
let c = a.f;
if (!b.t()) {
return;
}
let d = b.by;
let e = b.bx;
let f = this.getEffectiveViewport1(b);
let g = new ScalerParams(0, d, e, this.aci.ch, f);
g.b = this.ix();
let h = new ScalerParams(0, d, e, this.acc.ch, f);
let i = this.aci;
let j = i.el(i.me, g);
let k = this.acc.k8(d, e, f);
let l = this.acc;
let m = b;
if (isNaN_(k) || isInfinity(k)) {
m.dg.count = 0;
return;
}
this.y1.a2(this, this.zl(), runOn(this, this.yl), this.zu(b), this.zv(b));
this.y1.r = this.acz;
this.y1.s = this.ac0;
this.y1.k = this.acz;
this.y1.l = this.ac0;
let n = false;
let o = this.y1.b;
if (o != null) {
n = true;
}
let p = this.acc.cn;
let q = p ? this.acc : null;
let r = this.valueColumn.count;
let s = this.zu(b);
let t = 0;
for (let u = 0; u < c.count; ++u) {
let v = c._inner[u][0] - 0.5 * k;
let w = this.acy(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.dg.item(t);
t++;
z.width = k;
z.height = y;
let aa = this.y1.aw(r, u)[0];
if (p && a.m != null && u >= 0 && u < a.m.count) {
aa = truncate(Math.round(a.m._inner[u]));
}
if (n) {
this.aaf(c, u, r, l, h, b.q, aa);
}
if (z.dataContext != null) {
let ab = z.dataContext;
if (s == 1) {
if (aa >= 0 && aa < this.dn.count) {
if (q != null && q.i$b != null && q.i$b.count > aa) {
aa = q.i$b._inner[aa];
}
ab.item = this.dn.item(aa);
}
}
else {
ab.item = null;
}
}
this.y1.ad(z, false, false, false, false);
z.ap = this.y1.k;
z.aq = this.y1.l;
m.dl(z, v, Math.min(x, w));
}
m.dg.count = t;
b.c3(a);
}
get acx() {
return this.acw;
}
set acx(a) {
if (this.acx != a) {
let b = this.acx;
this.acw = a;
this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.acx));
}
}
acy(a) {
if (a == null || a.length < 3) {
return NaN;
}
switch (this.acx) {
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.db.wl, this.db.wk, 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.db.wl, this.db.wk, 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.zp;
}
}
ColumnSeries.$t = markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
ColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:acz:ac5', [1, 0], 'RadiusY:ac0:ac6', [1, 0]]);
return ColumnSeries;
})();
/**
* @hidden
*/
export let ColumnSeriesView = /*@__PURE__*/ (() => {
class ColumnSeriesView extends AnchoredCategorySeriesView {
constructor(a) {
super(a);
this.df = null;
this.dh = null;
this.dm = new Rectangle();
this.dg = null;
this.df = a;
this.dg = ((() => {
let $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(this, this.dn);
$ret.activate = runOn(this, this.di);
$ret.disactivate = runOn(this, this.dk);
$ret.destroy = runOn(this, this.dj);
return $ret;
})());
}
au() {
super.au();
this.dh = new List$1(Rectangle.$, 0);
if (!this.q) {
this.df.jo = Defaults.i;
this.df.w9 = Defaults.c;
}
}
dn() {
let a = new Rectangle();
this.dh.add(a);
a._visibility = 1;
return a;
}
di(a) {
a._visibility = 0;
}
dk(a) {
a._visibility = 1;
}
dj(a) {
this.dh.remove(a);
}
dl(a, b, c) {
if (!this.isDirty) {
this.as();
}
a.o = c;
a.n = b;
}
ac(a) {
return this.dh._inner[a];
}
ab(a) {
let b = this.dh._inner[a];
this.dm._visibility = b._visibility;
this.dm.n = b.n;
this.dm.o = b.o;
this.dm.width = b.width;
this.dm.height = b.height;
let c = this.bs(a);
this.dm._fill = c;
this.dm._stroke = c;
this.dm.ad = this.e.id + 3;
return this.dm;
}
a8(a, b) {
super.a8(a, b);
if (a.d) {
for (let c = 0; c < this.dh.count; c++) {
let d = this.aa(c, b);
this.bf(d, c, b);
a.w(d);
}
}
}
an(a) {
super.an(a);
let b = 0;
let c = new List$1(Rectangle.$, 0);
for (let d of fromEnum(this.dg.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.e.bc.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]);
}
b++;
}
}
ColumnSeriesView.$t = markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$);
return ColumnSeriesView;
})();