igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
278 lines (277 loc) • 9.77 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 { AnnotationLayer } from "./AnnotationLayer";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { DependencyProperty } from "igniteui-angular-core";
import { CategoryHighlightLayerFrame } from "./CategoryHighlightLayerFrame";
import { Base, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-angular-core";
import { XamDataChart } from "./XamDataChart";
import { CategoryHighlightFrameRect } from "./CategoryHighlightFrameRect";
import { List$1 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, truncate } from "igniteui-angular-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-angular-core";
import { Color } from "igniteui-angular-core";
/**
* @hidden
*/
export let CategoryHighlightLayer = /*@__PURE__*/ (() => {
class CategoryHighlightLayer extends AnnotationLayer {
constructor() {
super();
let a = new CategoryHighlightLayerFrame();
let b = new CategoryHighlightLayerFrame();
let c = new CategoryHighlightLayerFrame();
let d = this.kc / 1000;
this.xb = a;
this.xa = b;
this.xc = c;
this.ab = CategoryHighlightLayer.$;
}
bj() {
return new CategoryHighlightLayer();
}
get_er() {
return true;
}
cs() {
return new CategoryHighlightLayerView(this);
}
q0(a) {
super.q0(a);
this.zx = a;
}
get z0() {
return this.c(CategoryHighlightLayer.z7);
}
set z0(a) {
this.h(CategoryHighlightLayer.z7, a);
}
yn(a, b) {
if (this.zw == null || this.zw == a) {
if (!this.a1.c) {
this.rq(b);
}
}
}
zy(a) {
return a != null && a.co();
}
yq(a, b) {
super.yq(a, b);
let c = a;
c.g.clear();
let d = this.zz;
if (isNaN_(this.zt.x) && isNaN_(this.zt.y)) {
return;
}
if (this.zw != null) {
if (this.zy(this.zw)) {
this.z5(this.zw, c, d);
}
}
else {
if (typeCast(XamDataChart.$, this.db) !== null) {
let e = this.db;
for (let f of fromEnum(e.axes)) {
if (typeCast(CategoryAxisBase.$, f) !== null && this.zy(f)) {
this.z5(f, c, d);
}
}
}
}
}
z5(a, b, c) {
if (this.cv == null || this.cv.by.isEmpty || this.cv.bx.isEmpty) {
return;
}
let d = this.zt.x;
if (a.cp && isNaN_(d)) {
d = 0;
}
let e = this.wi(this.cv);
d = e.left + e.width * (d - this.cv.by.left) / this.cv.by.width;
let f = this.zt.y;
if (!a.cp && isNaN_(f)) {
f = 0;
}
f = e.top + e.height * (f - this.cv.by.top) / this.cv.by.height;
let g = a.mj({ $type: Point_$type, x: d, y: f }, c, this.z0);
this.z4(g, b, a);
}
z4(a, b, c) {
let d = new CategoryHighlightFrameRect();
d.b = a.left;
d.e = a.top;
d.c = a.right;
d.a = a.bottom;
d.g = this.zj();
d.h = this.zk();
if (d.g == null) {
d.g = this.zx.cf(c.jy);
}
if (d.h == null) {
d.h = this.zx.cf(c.jy);
}
d.d = this.id;
d.f = Base.getHashCodeStatic(c);
if (!a.isEmpty) {
b.g.addItem(d.f, d);
}
}
yt(a, b) {
super.yt(a, b);
let c = this.zx.b8;
let d = a;
let e = 0;
for (let f of fromEnum(d.g.values)) {
let g = c.item(e);
this.z6(f, g);
e++;
}
c.count = e;
}
f9() {
return true;
}
z6(a, b) {
if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.a) || isNaN_(a.c) || isNaN_(a.d)) {
b._visibility = 1;
return;
}
this.zx.ca(b, a.b, a.e, a.c - a.b, a.a - a.e);
b._fill = a.g;
b._stroke = a.h;
b.ad = a.d;
if (this.v1 != null) {
b.ai = this.v1;
}
else {
b.ai = null;
}
b.aj = this.v2;
b.am = this.v4;
b.al = this.v3;
b.ak = this.v3;
b.ac = this.jg;
}
q8(a, b, c, d) {
super.q8(a, b, c, d);
switch (b) {
case CategoryHighlightLayer.$$p[0]:
this.rq(true);
break;
case CategoryHighlightLayer.$$p[1]:
this.rq(true);
break;
}
}
}
CategoryHighlightLayer.$t = markType(CategoryHighlightLayer, 'CategoryHighlightLayer', AnnotationLayer.$);
CategoryHighlightLayer.z7 = DependencyProperty.i("BAndHighlightWidth", Number_$type, CategoryHighlightLayer.$, new PropertyMetadata(2, 10, (a, b) => a.raisePropertyChanged("BAndHighlightWidth", b.oldValue, b.newValue)));
CategoryHighlightLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CategoryHighlightLayer, 'raisePropertyChanged', ['TargetAxis:zw:z8', [CategoryAxisBase.$, null], 'UseInterpolation:zz:z9', [0, false]]);
return CategoryHighlightLayer;
})();
/**
* @hidden
*/
export let CategoryHighlightLayerView = /*@__PURE__*/ (() => {
class CategoryHighlightLayerView extends AnnotationLayerView {
constructor(a) {
super(a);
this.b7 = null;
this.b8 = null;
this.b9 = null;
this.b7 = a;
this.b9 = new List$1(Rectangle.$, 0);
}
au() {
super.au();
this.b8 = ((() => {
let $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(this, this.cg);
$ret.activate = runOn(this, this.cb);
$ret.disactivate = runOn(this, this.cd);
$ret.destroy = runOn(this, this.cc);
return $ret;
})());
}
cg() {
let a = new Rectangle();
a.ab = false;
this.b9.add(a);
return a;
}
cb(a) {
a._visibility = 0;
}
cd(a) {
a._visibility = 1;
}
cc(a) {
this.b9.remove(a);
}
ce(a) {
if (a == null) {
return a;
}
return BrushUtil.m(a, 0.1);
}
cf(a) {
if (a != null) {
let b = BrushUtil.m(a, 0.3);
if (b.isGradient) {
let c = b;
if (c.gradientStops != null) {
for (let d = 0; d < c.gradientStops.length; d++) {
let e = c.gradientStops[d];
e.color = Color.u(truncate(Math.round((e.color.l) * 0.2)), e.color.o, e.color.n, e.color.m);
e.color = e.color;
}
}
}
else {
b.color = Color.u(truncate(Math.round((b.color.l) * 0.2)), b.color.o, b.color.n, b.color.m);
b.color = b.color;
}
return b;
}
else {
return null;
}
}
ca(a, b, c, d, e) {
a._visibility = 0;
a.n = b;
a.o = c;
a.width = d;
a.height = e;
}
a8(a, b) {
super.a8(a, b);
if (a.d && !b) {
for (let c = 0; c < this.b9.count; c++) {
let d = this.b9._inner[c];
if (d._visibility == 0) {
a.w(d);
}
}
}
}
an(a) {
super.an(a);
for (let b = 0; b < this.b9.count; b++) {
this.e.bc.exportRectangleData(a, this.b9._inner[b], "cihRect", ["Main", "CategoryItem"]);
}
}
}
CategoryHighlightLayerView.$t = markType(CategoryHighlightLayerView, 'CategoryHighlightLayerView', AnnotationLayerView.$);
return CategoryHighlightLayerView;
})();