igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
418 lines (417 loc) • 13 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 { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Point_$type, Array_$type, runOn, markType } from "igniteui-angular-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { ChartSelection } from "./ChartSelection";
import { intDivide, isNaN_ } from "igniteui-angular-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { Defaults } from "./Defaults";
import { Color } from "igniteui-angular-core";
/**
* @hidden
*/
export class StepLineSeries extends HorizontalAnchoredCategorySeries {
static { this.$t = markType(StepLineSeries, 'StepLineSeries', HorizontalAnchoredCategorySeries.$); }
bk() {
return new StepLineSeries();
}
get_fo() {
return true;
}
get_f5() {
return true;
}
get_fp() {
return true;
}
ct() {
return new StepLineSeriesView(this);
}
aa0() {
return true;
}
rj(a) {
super.rj(a);
this.aec = a;
}
constructor() {
super();
this.aeb = null;
this.aeb = new CategoryLineRasterizer();
this.ab = StepLineSeries.$;
}
ac() {
super.ac();
}
preferredCategoryMode(a) {
return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
}
get_ey() {
return true;
}
pk(a, b) {
super.pk(a, b);
let c = b;
c.du();
}
g4(a, b) {
if (this.g3(a, b)) {
return true;
}
if (this.x5(a, b)) {
return true;
}
return false;
}
aj(a) {
let b = this.aea(a);
if (b == null) {
return null;
}
let c = new Array(1);
if (b.length == 4) {
let d = new Array(4);
d[0] = { $type: Point_$type, x: b[0][0], y: b[0][1] };
d[1] = { $type: Point_$type, x: b[1][0], y: b[1][1] };
d[2] = { $type: Point_$type, x: b[2][0], y: b[2][1] };
d[3] = { $type: Point_$type, x: b[3][0], y: b[3][1] };
c[0] = d;
}
else {
let e = new Array(2);
e[0] = { $type: Point_$type, x: b[0][0], y: b[0][1] };
e[1] = { $type: Point_$type, x: b[1][0], y: b[1][1] };
c[0] = e;
}
return c;
}
aea(a) {
let b = this.am(this.xAxis, this.z6.k, this.aa7(this.cw), this.aa8(this.cw), this.w4(a), true);
if (b == null) {
return null;
}
let c = this.z7();
let d = b[0];
let e = b[1];
if (d < 0 && e < 0) {
return null;
}
if (d > c.k.count - 1 && e > c.k.count - 1) {
return null;
}
if (d < 0) {
d = 0;
}
if (e < 0) {
e = 0;
}
if (e > c.k.count - 1) {
e = c.k.count - 1;
}
if (d > c.k.count - 1) {
d = c.k.count - 1;
}
let f = this.cw.ca;
let g = this.cw.b9;
let h = this.getEffectiveViewport1(this.cw);
let i = typeCast(ISortingAxis_$type, this.adr) != null;
let j = this.adr.dr;
let k = 0;
if (this.adr != null) {
k = 0.5 * this.adr.getCategorySize(f, g, h);
}
let l = new Array(4);
let m = new Array(4);
let n = new Array(4);
let o = new Array(4);
if (!this.adr.dr) {
let p = d * 2;
l[0] = this.aed(p, false, c, k, j, i);
l[1] = c.k._inner[(intDivide(p, 2))][1];
l[2] = this.aed(p, false, c, k, j, i);
l[3] = c.k._inner[(intDivide(p, 2))][2];
p++;
m[0] = this.aed(p, false, c, k, j, i);
m[1] = c.k._inner[(intDivide(p, 2))][1];
m[2] = this.aed(p, false, c, k, j, i);
m[3] = c.k._inner[(intDivide(p, 2))][2];
p = e * 2;
n[0] = this.aed(p, false, c, k, j, i);
n[1] = c.k._inner[(intDivide(p, 2))][1];
n[2] = this.aed(p, false, c, k, j, i);
n[3] = c.k._inner[(intDivide(p, 2))][2];
p++;
o[0] = this.aed(p, false, c, k, j, i);
o[1] = c.k._inner[(intDivide(p, 2))][1];
o[2] = this.aed(p, false, c, k, j, i);
o[3] = c.k._inner[(intDivide(p, 2))][2];
}
else {
let q = d * 2;
l[0] = this.aed(q, true, c, k, j, i);
l[1] = c.k._inner[(intDivide(q, 2))][1];
l[2] = this.aed(q, true, c, k, j, i);
l[3] = c.k._inner[(intDivide(q, 2))][2];
q++;
m[0] = this.aed(q, true, c, k, j, i);
m[1] = c.k._inner[(intDivide(q, 2))][1];
m[2] = this.aed(q, true, c, k, j, i);
m[3] = c.k._inner[(intDivide(q, 2))][2];
q = e * 2;
n[0] = this.aed(q, true, c, k, j, i);
n[1] = c.k._inner[(intDivide(q, 2))][1];
n[2] = this.aed(q, true, c, k, j, i);
n[3] = c.k._inner[(intDivide(q, 2))][2];
q++;
o[0] = this.aed(q, true, c, k, j, i);
o[1] = c.k._inner[(intDivide(q, 2))][1];
o[2] = this.aed(q, true, c, k, j, i);
o[3] = c.k._inner[(intDivide(q, 2))][2];
}
if (d == e) {
return [l, m];
}
return [l, m, n, o];
}
al(a) {
let b = this.aea(a);
if (b == null) {
return null;
}
let c = new Array(1);
if (b.length == 4) {
let d = new Array(4);
d[0] = { $type: Point_$type, x: b[0][2], y: b[0][3] };
d[1] = { $type: Point_$type, x: b[1][2], y: b[1][3] };
d[2] = { $type: Point_$type, x: b[2][2], y: b[2][3] };
d[3] = { $type: Point_$type, x: b[3][2], y: b[3][3] };
c[0] = d;
}
else {
let e = new Array(2);
e[0] = { $type: Point_$type, x: b[0][2], y: b[0][3] };
e[1] = { $type: Point_$type, x: b[1][2], y: b[1][3] };
c[0] = e;
}
return c;
}
i4(a, b, c, d, e, f, g, h) {
let i = NaN;
if (c >= 0 && c < b.count) {
i = b.item(c);
}
let j = NaN;
if (d >= 0 && d < b.count) {
j = b.item(d);
}
if (f == 0) {
return j;
}
if (e == b.count - 1) {
return i;
}
if (isNaN_(j) && g != 0 && a <= 0.5 && !h) {
return i;
}
if (isNaN_(i) && g != 0 && a >= 0.5 && !h) {
return j;
}
if (a > 0.5) {
return j;
}
return i;
}
aed(a, b, c, d, e, f) {
let g;
if (b) {
if (f) {
g = (a & 1) == 0;
if (g || (intDivide(a, 2)) + 1 < 0) {
return c.k._inner[(intDivide(a, 2))][0];
}
if (c.k.count == (intDivide(a, 2)) + 1) {
return c.k._inner[(intDivide(a, 2))][0];
}
return c.k._inner[(intDivide(a, 2)) + 1][0];
}
g = (a & 1) == 0;
return c.k._inner[(intDivide(a, 2))][0] + (g ? d : -d);
}
if (f) {
g = (a & 1) == 0;
if (g || ((intDivide(a, 2)) + 1) >= c.k.count) {
return c.k._inner[(intDivide(a, 2))][0];
}
if (c.k.count == (intDivide(a, 2)) + 1) {
return c.k._inner[(intDivide(a, 2))][0];
}
return c.k._inner[(intDivide(a, 2)) + 1][0];
}
g = (a & 1) == 0;
return c.k._inner[(intDivide(a, 2))][0] + (g ? -d : d);
}
abz(a, b) {
super.abz(a, b);
let c = b.ca;
let d = b.b9;
let e = this.getEffectiveViewport1(b);
let f = typeCast(ISortingAxis_$type, this.adr) != null;
let g = this.adr.dr;
let h = 0;
if (this.adr != null) {
h = 0.5 * this.adr.getCategorySize(c, d, e);
}
let i = a.k;
let j = 2 * i.count;
let k = new List$1(Array_$type, 2, j);
if (!this.adr.dr) {
for (let l = 0; l < j; l++) {
let m = new Array(4);
m[0] = this.aed(l, false, a, h, g, f);
m[1] = a.k._inner[(intDivide(l, 2))][1];
m[2] = this.aed(l, false, a, h, g, f);
m[3] = a.k._inner[(intDivide(l, 2))][2];
k.add(m);
}
}
else {
for (let n = 0; n < j; n++) {
let o = new Array(4);
o[0] = this.aed(n, true, a, h, g, f);
o[1] = a.k._inner[(intDivide(n, 2))][1];
o[2] = this.aed(n, true, a, h, g, f);
o[3] = a.k._inner[(intDivide(n, 2))][2];
k.add(o);
}
}
let p = typeCast(StepLineSeriesView.$, b);
let q = p.c9.d;
this.aae.a2(this, this.aay(), runOn(this, this.zy), this.aa7(b), this.aa8(b));
let r = false;
let s = this.aae.b;
if (s != null) {
r = true;
}
if (r) {
let t = new ScalerParams(0, b.ca, b.b9, this.adr.dr, e);
this.abv(i, -1, this.valueColumn.count, this.adr, t, b.t, -1);
}
let u = p.d0;
let v = p.d1;
let w = p.dz;
this.aae.ad(u, true, false, true, false);
this.aae.ad(v, true, false, true, false);
this.aae.ad(w, false, true, false, false);
w._opacity = 0.75 * this.aae.j;
if (b.dd(a)) {
p.dv(j, k, false, 1, this.ab8(k, j - 1, b.b9, b.ca), q, this.im);
b.dg(a);
}
}
qk(a, b, c) {
this.abr(a, b, c, this.z5, 0);
}
ak(a, b) {
let c = new List$1(ChartSelection.$, 0);
this.qk(a, c, b);
return c.toArray();
}
get useHighMarkerFidelity() {
return this.aa2;
}
}
/**
* @hidden
*/
export class StepLineSeriesView extends AnchoredCategorySeriesView {
static { this.$t = markType(StepLineSeriesView, 'StepLineSeriesView', AnchoredCategorySeriesView.$); }
constructor(a) {
super(a);
this.dt = null;
this.d3 = new Path();
this.d2 = new Path();
this.d4 = new Path();
this.dy = new Path();
this.dx = new Path();
this.dw = new Path();
this.dt = a;
}
a4() {
super.a4();
if (!this.t) {
this.dt.xy = Defaults.c;
}
}
get d0() {
return this.d3;
}
get d1() {
return this.d4;
}
get dz() {
return this.d2;
}
du() {
this.d2.an = null;
this.d3.an = null;
this.d4.an = null;
this.a2();
}
dv(a, b, c, d, e, f, g) {
this.dt.aeb.a = typeCast(ISortingAxis_$type, this.db.fetchXAxis()) !== null ? true : false;
this.dt.aeb.m(this.d3, this.d2, this.d4, a, b, c, d, e, f, g);
this.a2();
}
bq() {
super.bq();
this.dx.an = this.d3.an;
this.dy.an = this.d4.an;
this.dw.an = this.d2.an;
let a = this.b3();
this.dx._stroke = a;
this.dx.ad = this.f.io + 3;
this.dy._stroke = a;
this.dy.ad = this.f.io + 3;
this.dw._fill = a;
this.dw._opacity = 1;
}
bj(a, b) {
super.bj(a, b);
if (a.d) {
if (b) {
a.t(this.dw);
a.t(this.dx);
a.t(this.dy);
}
else {
a.t(this.d2);
a.t(this.d3);
a.t(this.d4);
}
}
}
ax(a) {
super.ax(a);
this.f.bc.exportPathData(a, this.d3, "lowerShape", ["Lower", "Main"]);
this.f.bc.exportPathData(a, this.d4, "upperShape", ["Upper"]);
this.f.bc.exportPathData(a, this.d2, "translucentShape", ["Translucent"]);
}
an() {
let a = new Color();
a.colorString = "rgba(95,95,95,0.5)";
this.f.wn = a;
this.f.jx = 3;
this.f.jy = 1;
this.f.jz = 4;
this.f.hk = false;
}
}