igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
278 lines (277 loc) • 9.8 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.km / 1000;
this.xw = a;
this.xv = b;
this.xx = c;
this.ab = CategoryHighlightLayer.$;
}
bk() {
return new CategoryHighlightLayer();
}
get_eu() {
return true;
}
ct() {
return new CategoryHighlightLayerView(this);
}
rg(a) {
super.rg(a);
this.aat = a;
}
get aaw() {
return this.c(CategoryHighlightLayer.aa3);
}
set aaw(a) {
this.h(CategoryHighlightLayer.aa3, a);
}
zc(a, b) {
if (this.aas == null || this.aas == a) {
if (!this.a1.c) {
this.r7(b);
}
}
}
aau(a) {
return a != null && a.dx();
}
zf(a, b) {
super.zf(a, b);
let c = a;
c.j.clear();
let d = this.aav;
if (isNaN_(this.aap.x) && isNaN_(this.aap.y)) {
return;
}
if (this.aas != null) {
if (this.aau(this.aas)) {
this.aa1(this.aas, c, d);
}
}
else {
if (typeCast(XamDataChart.$, this.dc) !== null) {
let e = this.dc;
for (let f of fromEnum(e.zq)) {
if (typeCast(CategoryAxisBase.$, f) !== null && this.aau(f)) {
this.aa1(f, c, d);
}
}
}
}
}
aa1(a, b, c) {
if (this.cw == null || this.cw.ca.isEmpty || this.cw.b9.isEmpty) {
return;
}
let d = this.aap.x;
if (a.dy && isNaN_(d)) {
d = 0;
}
let e = this.w3(this.cw);
d = e.left + e.width * (d - this.cw.ca.left) / this.cw.ca.width;
let f = this.aap.y;
if (!a.dy && isNaN_(f)) {
f = 0;
}
f = e.top + e.height * (f - this.cw.ca.top) / this.cw.ca.height;
let g = a.q7({ $type: Point_$type, x: d, y: f }, c, this.aaw);
this.aa0(g, b, a);
}
aa0(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.aab();
d.h = this.aac();
if (d.g == null) {
d.g = this.aat.cv(c.ob);
}
if (d.h == null) {
d.h = this.aat.cv(c.ob);
}
d.d = this.il;
d.f = Base.getHashCodeStatic(c);
if (!a.isEmpty) {
b.j.addItem(d.f, d);
}
}
zi(a, b) {
super.zi(a, b);
let c = this.aat.co;
let d = a;
let e = 0;
for (let f of fromEnum(d.j.values)) {
let g = c.item(e);
this.aa2(f, g);
e++;
}
c.count = e;
}
gg() {
return true;
}
aa2(a, b) {
if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.a) || isNaN_(a.c) || isNaN_(a.d)) {
b._visibility = 1;
return;
}
this.aat.cq(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.wl != null) {
b.ai = this.wl;
}
else {
b.ai = null;
}
b.aj = this.wm;
b.am = this.wo;
b.al = this.wn;
b.ak = this.wn;
b.ac = this.jp;
}
rp(a, b, c, d) {
super.rp(a, b, c, d);
switch (b) {
case CategoryHighlightLayer.$$p[0]:
this.r7(true);
break;
case CategoryHighlightLayer.$$p[1]:
this.r7(true);
break;
}
}
}
CategoryHighlightLayer.$t = markType(CategoryHighlightLayer, 'CategoryHighlightLayer', AnnotationLayer.$);
CategoryHighlightLayer.aa3 = 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:aas:aa4', [CategoryAxisBase.$, null], 'UseInterpolation:aav:aa5', [0, false]]);
return CategoryHighlightLayer;
})();
/**
* @hidden
*/
export let CategoryHighlightLayerView = /*@__PURE__*/ (() => {
class CategoryHighlightLayerView extends AnnotationLayerView {
constructor(a) {
super(a);
this.cn = null;
this.co = null;
this.cp = null;
this.cn = a;
this.cp = new List$1(Rectangle.$, 0);
}
a4() {
super.a4();
this.co = ((() => {
let $ret = new Pool$1(Rectangle.$);
$ret.create = runOn(this, this.cw);
$ret.activate = runOn(this, this.cr);
$ret.disactivate = runOn(this, this.ct);
$ret.destroy = runOn(this, this.cs);
return $ret;
})());
}
cw() {
let a = new Rectangle();
a.ab = false;
this.cp.add(a);
return a;
}
cr(a) {
a._visibility = 0;
}
ct(a) {
a._visibility = 1;
}
cs(a) {
this.cp.remove(a);
}
cu(a) {
if (a == null) {
return a;
}
return BrushUtil.o(a, 0.1);
}
cv(a) {
if (a != null) {
let b = BrushUtil.o(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;
}
}
cq(a, b, c, d, e) {
a._visibility = 0;
a.n = b;
a.o = c;
a.width = d;
a.height = e;
}
bj(a, b) {
super.bj(a, b);
if (a.d && !b) {
for (let c = 0; c < this.cp.count; c++) {
let d = this.cp._inner[c];
if (d._visibility == 0) {
a.w(d);
}
}
}
}
ax(a) {
super.ax(a);
for (let b = 0; b < this.cp.count; b++) {
this.f.bc.exportRectangleData(a, this.cp._inner[b], "cihRect", ["Main", "CategoryItem"]);
}
}
}
CategoryHighlightLayerView.$t = markType(CategoryHighlightLayerView, 'CategoryHighlightLayerView', AnnotationLayerView.$);
return CategoryHighlightLayerView;
})();