UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

278 lines (277 loc) 9.58 kB
/* 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_et() { return true; } constructor() { super(); let a = new CategoryHighlightLayerFrame(); let b = new CategoryHighlightLayerFrame(); let c = new CategoryHighlightLayerFrame(); let d = this.kh / 1000; this.xn = a; this.xm = b; this.xo = c; this.ab = CategoryHighlightLayer.$; } ct() { return new CategoryHighlightLayerView(this); } q8(a) { super.q8(a); this.aah = a; } get aak() { return this.c(CategoryHighlightLayer.aar); } set aak(a) { this.h(CategoryHighlightLayer.aar, a); } y1(a, b) { if (this.aag == null || this.aag == a) { if (!this.a1.c) { this.rz(b); } } } aai(a) { return a != null && a.dp(); } y4(a, b) { super.y4(a, b); let c = a; c.g.clear(); let d = this.aaj; if (isNaN_(this.aad.x) && isNaN_(this.aad.y)) { return; } if (this.aag != null) { if (this.aai(this.aag)) { this.aap(this.aag, c, d); } } else { if (typeCast(XamDataChart.$, this.dc) !== null) { let e = this.dc; for (let f of fromEnum(e.axes)) { if (typeCast(CategoryAxisBase.$, f) !== null && this.aai(f)) { this.aap(f, c, d); } } } } } aap(a, b, c) { if (this.cw == null || this.cw.ca.isEmpty || this.cw.b9.isEmpty) { return; } let d = this.aad.x; if (a.dq && isNaN_(d)) { d = 0; } let e = this.wu(this.cw); d = e.left + e.width * (d - this.cw.ca.left) / this.cw.ca.width; let f = this.aad.y; if (!a.dq && isNaN_(f)) { f = 0; } f = e.top + e.height * (f - this.cw.ca.top) / this.cw.ca.height; let g = a.p5({ $type: Point_$type, x: d, y: f }, c, this.aak); this.aao(g, b, a); } aao(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.zz(); d.h = this.z0(); if (d.g == null) { d.g = this.aah.cv(c.nc); } if (d.h == null) { d.h = this.aah.cv(c.nc); } d.d = this.ig; d.f = Base.getHashCodeStatic(c); if (!a.isEmpty) { b.g.addItem(d.f, d); } } y7(a, b) { super.y7(a, b); let c = this.aah.co; let d = a; let e = 0; for (let f of fromEnum(d.g.values)) { let g = c.item(e); this.aaq(f, g); e++; } c.count = e; } gb() { return true; } aaq(a, b) { if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.a) || isNaN_(a.c) || isNaN_(a.d)) { b._visibility = 1; return; } this.aah.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.wd != null) { b.ai = this.wd; } else { b.ai = null; } b.aj = this.we; b.am = this.wg; b.al = this.wf; b.ak = this.wf; b.ac = this.jk; } rh(a, b, c, d) { super.rh(a, b, c, d); switch (b) { case CategoryHighlightLayer.$$p[0]: this.rz(true); break; case CategoryHighlightLayer.$$p[1]: this.rz(true); break; } } } CategoryHighlightLayer.$t = /*@__PURE__*/ markType(CategoryHighlightLayer, 'CategoryHighlightLayer', AnnotationLayer.$); CategoryHighlightLayer.aar = /*@__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:aag:aas', [CategoryAxisBase.$, null], 'UseInterpolation:aaj:aat', [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 = /*@__PURE__*/ markType(CategoryHighlightLayerView, 'CategoryHighlightLayerView', AnnotationLayerView.$); return CategoryHighlightLayerView; })();