igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
278 lines (277 loc) • 9.58 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-react-core";
import { CategoryHighlightLayerFrame } from "./CategoryHighlightLayerFrame";
import { Base, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, runOn } from "igniteui-react-core";
import { XamDataChart } from "./XamDataChart";
import { CategoryHighlightFrameRect } from "./CategoryHighlightFrameRect";
import { List$1 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, truncate } from "igniteui-react-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-react-core";
import { Color } from "igniteui-react-core";
/**
* @hidden
*/
export let CategoryHighlightLayer = /*@__PURE__*/ (() => {
class CategoryHighlightLayer extends AnnotationLayer {
bk() {
return new CategoryHighlightLayer();
}
get_eu() {
return true;
}
constructor() {
super();
let a = new CategoryHighlightLayerFrame();
let b = new CategoryHighlightLayerFrame();
let c = new CategoryHighlightLayerFrame();
let d = this.kn / 1000;
this.xy = a;
this.xx = b;
this.xz = c;
this.ab = CategoryHighlightLayer.$;
}
ct() {
return new CategoryHighlightLayerView(this);
}
ri(a) {
super.ri(a);
this.aau = a;
}
get aax() {
return this.c(CategoryHighlightLayer.aa4);
}
set aax(a) {
this.h(CategoryHighlightLayer.aa4, a);
}
zd(a, b) {
if (this.aat == null || this.aat == a) {
if (!this.a1.c) {
this.r9(b);
}
}
}
aav(a) {
return a != null && a.dy();
}
zg(a, b) {
super.zg(a, b);
let c = a;
c.j.clear();
let d = this.aaw;
if (isNaN_(this.aaq.x) && isNaN_(this.aaq.y)) {
return;
}
if (this.aat != null) {
if (this.aav(this.aat)) {
this.aa2(this.aat, c, d);
}
}
else {
if (typeCast(XamDataChart.$, this.dc) !== null) {
let e = this.dc;
for (let f of fromEnum(e.zr)) {
if (typeCast(CategoryAxisBase.$, f) !== null && this.aav(f)) {
this.aa2(f, c, d);
}
}
}
}
}
aa2(a, b, c) {
if (this.cw == null || this.cw.ca.isEmpty || this.cw.b9.isEmpty) {
return;
}
let d = this.aaq.x;
if (a.dz && isNaN_(d)) {
d = 0;
}
let e = this.w5(this.cw);
d = e.left + e.width * (d - this.cw.ca.left) / this.cw.ca.width;
let f = this.aaq.y;
if (!a.dz && isNaN_(f)) {
f = 0;
}
f = e.top + e.height * (f - this.cw.ca.top) / this.cw.ca.height;
let g = a.rc({ $type: Point_$type, x: d, y: f }, c, this.aax);
this.aa1(g, b, a);
}
aa1(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.aac();
d.h = this.aad();
if (d.g == null) {
d.g = this.aau.cv(c.og);
}
if (d.h == null) {
d.h = this.aau.cv(c.og);
}
d.d = this.im;
d.f = Base.getHashCodeStatic(c);
if (!a.isEmpty) {
b.j.addItem(d.f, d);
}
}
zj(a, b) {
super.zj(a, b);
let c = this.aau.co;
let d = a;
let e = 0;
for (let f of fromEnum(d.j.values)) {
let g = c.item(e);
this.aa3(f, g);
e++;
}
c.count = e;
}
gh() {
return true;
}
aa3(a, b) {
if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.a) || isNaN_(a.c) || isNaN_(a.d)) {
b._visibility = 1;
return;
}
this.aau.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.wn != null) {
b.ai = this.wn;
}
else {
b.ai = null;
}
b.aj = this.wo;
b.am = this.wq;
b.al = this.wp;
b.ak = this.wp;
b.ac = this.jq;
}
rr(a, b, c, d) {
super.rr(a, b, c, d);
switch (b) {
case CategoryHighlightLayer.$$p[0]:
this.r9(true);
break;
case CategoryHighlightLayer.$$p[1]:
this.r9(true);
break;
}
}
}
CategoryHighlightLayer.$t = /*@__PURE__*/ markType(CategoryHighlightLayer, 'CategoryHighlightLayer', AnnotationLayer.$);
CategoryHighlightLayer.aa4 = /*@__PURE__*/ DependencyProperty.i("BAndHighlightWidth", Number_$type, CategoryHighlightLayer.$, /*@__PURE__*/ new PropertyMetadata(2, 10, (a, b) => a.raisePropertyChanged("BAndHighlightWidth", b.oldValue, b.newValue)));
CategoryHighlightLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, CategoryHighlightLayer, 'raisePropertyChanged', ['TargetAxis:aat:aa5', [CategoryAxisBase.$, null], 'UseInterpolation:aaw:aa6', [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.q(a, 0.1);
}
cv(a) {
if (a != null) {
let b = BrushUtil.q(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 = /*@__PURE__*/ markType(CategoryHighlightLayerView, 'CategoryHighlightLayerView', AnnotationLayerView.$);
return CategoryHighlightLayerView;
})();