UNPKG

igniteui-react-charts

Version:

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

278 lines (277 loc) 9.56 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_es() { return true; } constructor() { super(); let a = new CategoryHighlightLayerFrame(); let b = new CategoryHighlightLayerFrame(); let c = new CategoryHighlightLayerFrame(); let d = this.kd / 1000; this.xe = a; this.xd = b; this.xf = c; this.ab = CategoryHighlightLayer.$; } ct() { return new CategoryHighlightLayerView(this); } q1(a) { super.q1(a); this.z8 = a; } get aab() { return this.c(CategoryHighlightLayer.aai); } set aab(a) { this.h(CategoryHighlightLayer.aai, a); } ys(a, b) { if (this.z7 == null || this.z7 == a) { if (!this.a1.c) { this.rs(b); } } } z9(a) { return a != null && a.co(); } yv(a, b) { super.yv(a, b); let c = a; c.g.clear(); let d = this.aaa; if (isNaN_(this.z4.x) && isNaN_(this.z4.y)) { return; } if (this.z7 != null) { if (this.z9(this.z7)) { this.aag(this.z7, 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.z9(f)) { this.aag(f, c, d); } } } } } aag(a, b, c) { if (this.cw == null || this.cw.b2.isEmpty || this.cw.b1.isEmpty) { return; } let d = this.z4.x; if (a.cp && isNaN_(d)) { d = 0; } let e = this.wl(this.cw); d = e.left + e.width * (d - this.cw.b2.left) / this.cw.b2.width; let f = this.z4.y; if (!a.cp && isNaN_(f)) { f = 0; } f = e.top + e.height * (f - this.cw.b2.top) / this.cw.b2.height; let g = a.mj({ $type: Point_$type, x: d, y: f }, c, this.aab); this.aaf(g, b, a); } aaf(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.zq(); d.h = this.zr(); if (d.g == null) { d.g = this.z8.cm(c.jy); } if (d.h == null) { d.h = this.z8.cm(c.jy); } d.d = this.ie; d.f = Base.getHashCodeStatic(c); if (!a.isEmpty) { b.g.addItem(d.f, d); } } yy(a, b) { super.yy(a, b); let c = this.z8.cf; let d = a; let e = 0; for (let f of fromEnum(d.g.values)) { let g = c.item(e); this.aah(f, g); e++; } c.count = e; } ga() { return true; } aah(a, b) { if (isNaN_(a.b) || isNaN_(a.e) || isNaN_(a.a) || isNaN_(a.c) || isNaN_(a.d)) { b._visibility = 1; return; } this.z8.ch(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.v4 != null) { b.ai = this.v4; } else { b.ai = null; } b.aj = this.v5; b.am = this.v7; b.al = this.v6; b.ak = this.v6; b.ac = this.jh; } ra(a, b, c, d) { super.ra(a, b, c, d); switch (b) { case CategoryHighlightLayer.$$p[0]: this.rs(true); break; case CategoryHighlightLayer.$$p[1]: this.rs(true); break; } } } CategoryHighlightLayer.$t = /*@__PURE__*/ markType(CategoryHighlightLayer, 'CategoryHighlightLayer', AnnotationLayer.$); CategoryHighlightLayer.aai = /*@__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:z7:aaj', [CategoryAxisBase.$, null], 'UseInterpolation:aaa:aak', [0, false]]); return CategoryHighlightLayer; })(); /** * @hidden */ export let CategoryHighlightLayerView = /*@__PURE__*/ (() => { class CategoryHighlightLayerView extends AnnotationLayerView { constructor(a) { super(a); this.ce = null; this.cf = null; this.cg = null; this.ce = a; this.cg = new List$1(Rectangle.$, 0); } ax() { super.ax(); this.cf = ((() => { let $ret = new Pool$1(Rectangle.$); $ret.create = runOn(this, this.cn); $ret.activate = runOn(this, this.ci); $ret.disactivate = runOn(this, this.ck); $ret.destroy = runOn(this, this.cj); return $ret; })()); } cn() { let a = new Rectangle(); a.ab = false; this.cg.add(a); return a; } ci(a) { a._visibility = 0; } ck(a) { a._visibility = 1; } cj(a) { this.cg.remove(a); } cl(a) { if (a == null) { return a; } return BrushUtil.m(a, 0.1); } cm(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; } } ch(a, b, c, d, e) { a._visibility = 0; a.n = b; a.o = c; a.width = d; a.height = e; } bc(a, b) { super.bc(a, b); if (a.d && !b) { for (let c = 0; c < this.cg.count; c++) { let d = this.cg._inner[c]; if (d._visibility == 0) { a.w(d); } } } } aq(a) { super.aq(a); for (let b = 0; b < this.cg.count; b++) { this.f.bc.exportRectangleData(a, this.cg._inner[b], "cihRect", ["Main", "CategoryItem"]); } } } CategoryHighlightLayerView.$t = /*@__PURE__*/ markType(CategoryHighlightLayerView, 'CategoryHighlightLayerView', AnnotationLayerView.$); return CategoryHighlightLayerView; })();