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.ac2 = null;
this.acx = 0;
this.ab = ColumnSeries.$;
this.acg = 2;
}
bj() {
return new ColumnSeries();
}
get_ez() {
return true;
}
get_fl() {
return true;
}
jk() {
if (!isNaN_(this.jj)) {
return super.jk();
}
return Defaults.h;
}
cs() {
return new ColumnSeriesView(this);
}
q1(a) {
super.q1(a);
this.acw = a;
}
cy() {
if (this.cz == 0) {
return 2;
}
return super.cy();
}
y4() {
return 1;
}
get_ed() {
return true;
}
preferredCategoryMode(a) {
return this.acg;
}
wn(a) {
if (this.ac2 == null) {
this.ac2 = runOn(this, this.acz);
}
let b = this.acj != null ? this.acj : this.yAxis;
let c = this.acd;
return this.aa0.c$d(this, a, c, b, this.yu, this.zv(this.cv), this.zw(this.cv), this.ac2);
}
gw(a, b) {
if (this.gz(a, b)) {
return true;
}
if (this.xh(a, b)) {
return true;
}
return false;
}
o5(a, b) {
super.o5(a, b);
let c = b;
if (a && c.dg != null) {
c.dg.count = 0;
}
}
iw() {
return this.acd.k8(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.p4(a, c, b);
return c.toArray();
}
p4(a, b, c) {
this.aac(a, b, c, this.yt, 1);
}
aak(a, b) {
super.aak(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.acj.ch, f);
g.b = this.iy();
let h = new ScalerParams(0, d, e, this.acd.ch, f);
let i = this.acj;
let j = i.el(i.me, g);
let k = this.acd.k8(d, e, f);
let l = this.acd;
let m = b;
if (isNaN_(k) || isInfinity(k)) {
m.dg.count = 0;
return;
}
this.y2.a2(this, this.zm(), runOn(this, this.ym), this.zv(b), this.zw(b));
this.y2.r = this.ac0;
this.y2.s = this.ac1;
this.y2.k = this.ac0;
this.y2.l = this.ac1;
let n = false;
let o = this.y2.b;
if (o != null) {
n = true;
}
let p = this.acd.cn;
let q = p ? this.acd : null;
let r = this.valueColumn.count;
let s = this.zv(b);
let t = 0;
for (let u = 0; u < c.count; ++u) {
let v = c._inner[u][0] - 0.5 * k;
let w = this.acz(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.y2.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.aag(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.y2.ad(z, false, false, false, false);
z.ap = this.y2.k;
z.aq = this.y2.l;
m.dl(z, v, Math.min(x, w));
}
m.dg.count = t;
b.c3(a);
}
get acy() {
return this.acx;
}
set acy(a) {
if (this.acy != a) {
let b = this.acy;
this.acx = a;
this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.acy));
}
}
acz(a) {
if (a == null || a.length < 3) {
return NaN;
}
switch (this.acy) {
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.zq;
}
}
ColumnSeries.$t = markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
ColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:ac0:ac6', [1, 0], 'RadiusY:ac1:ac7', [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.jp = Defaults.i;
this.df.xa = 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.ie + 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;
})();