UNPKG

igniteui-react-charts

Version:

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

424 lines (423 loc) 15.2 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 { Series } from "./Series"; import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference"; import { Axis } from "./Axis"; import { DependencyProperty } from "igniteui-react-core"; import { CategoryAxisBase } from "./CategoryAxisBase"; import { Point_$type, typeCast, Delegate_$type, markType, markDep } from "igniteui-react-core"; import { Brush } from "igniteui-react-core"; import { Thickness } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { Dictionary$2 } from "igniteui-react-core"; import { Pool$1 } from "igniteui-react-core"; import { AxisAnnotation } from "./AxisAnnotation"; import { SeriesView } from "./SeriesView"; import { NotImplementedException } from "igniteui-react-core"; import { AxisRange } from "./AxisRange"; import { NumericAxisBase } from "./NumericAxisBase"; import { AxisAnnotationFrame } from "./AxisAnnotationFrame"; import { ScalerParams } from "./ScalerParams"; import { CategoryXAxis } from "./CategoryXAxis"; import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager"; import { PropertyMetadata } from "igniteui-react-core"; import { DeviceUtils } from "igniteui-react-core"; import { isNaN_, isInfinity } from "igniteui-react-core"; import { stringFormat } from "igniteui-react-core"; import { Path } from "igniteui-react-core"; /** * @hidden */ export let ValueOverlay = /*@__PURE__*/ (() => { class ValueOverlay extends Series { bk() { return new ValueOverlay(); } constructor() { super(); this.xh = 0; this.xi = 0; this.xe = 0; this.w1 = null; this.w7 = null; this.w6 = null; this.ab = ValueOverlay.$; } i5(a, b, c) { return this.xj; } xf(a, b) { let c = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2)); let d = Math.acos((a.x - b.x) / c); if ((a.y - b.y) < 0) { d = (2 * Math.PI) - d; } return d; } we(a, b, c) { if (this.w0 == null) { return { $type: Point_$type, x: NaN, y: NaN }; } let d = this.xg(); let e = NaN; let f = NaN; let g = NaN; let h = { $type: Point_$type, x: 0.5, y: 0.5 }; let i = NaN; switch (this.w0.a2) { case 2: i = Math.sqrt(Math.pow(a.x - h.x, 2) + Math.pow(a.y - h.y, 2)); g = d; e = h.x + Math.cos(g) * i; f = h.y + Math.sin(g) * i; f = this.cw.b1.top + this.cw.b1.height * (f - this.cw.b2.top) / this.cw.b2.height; e = this.cw.b1.left + this.cw.b1.width * (e - this.cw.b2.left) / this.cw.b2.width; break; case 0: e = d; f = a.y; f = this.cw.b1.top + this.cw.b1.height * (f - this.cw.b2.top) / this.cw.b2.height; break; case 1: f = d; e = a.x; e = this.cw.b1.left + this.cw.b1.width * (e - this.cw.b2.left) / this.cw.b2.width; break; case 3: g = this.xf(a, h); i = d; e = h.x + Math.cos(g) * i; f = h.y + Math.sin(g) * i; f = this.cw.b1.top + this.cw.b1.height * (f - this.cw.b2.top) / this.cw.b2.height; e = this.cw.b1.left + this.cw.b1.width * (e - this.cw.b2.left) / this.cw.b2.width; break; } return { $type: Point_$type, x: e, y: f }; } j3(a) { throw new NotImplementedException(0); } kn(a) { return this; } gd(a) { return false; } ay(a) { let b = typeCast(NumericAxisBase.$, a); let c = this.xj; if (isNaN_(c) || isInfinity(c)) { return null; } return new AxisRange(c, c); } rt(a) { this.o5(true, this.cw); if (!this.w5()) { if (this.w1 != null) { this.x2(NaN, this.d4()); } return; } if (this.gf(a)) { if (this.d4()) { if (this.dd.g) { this.dd.t(); } let b = this.xh; this.xh = this.xi; this.xi = b; } else { this.xh = this.xe; } this.xe = this.xg(); this.r9(); } else { this.xe = this.xg(); this.x1(this.xe, this.w3); } } xg() { let a, b; let c = this.getViewInfo(b, a); b = c.p0; a = c.p1; let d = this.getEffectiveViewport1(this.cw); let e = new ScalerParams(0, a, b, this.w0.ch, d); return this.w0.el(this.xj, e); } x1(a, b) { if (this.w0 == null) { return; } let c = typeCast(CategoryAxisBase.$, this.w0); if (c != null && !c.ce) { if (this.xj > c.lk - 1) { return; } if (c.categoryMode != 0) { let d = this.getEffectiveViewport1(b); let e = 0.5 * c.getCategorySize(b.b2, b.b1, d); let f = false; if (c.cp && !c.ch) { f = true; } if (typeCast(CategoryXAxis.$, c) !== null && c.ch) { f = true; } if (f) { e = -e; } a += e; } } let g = typeCast(NumericAxisBase.$, this.w0); if (g != null) { if (this.xj < g.l4 || this.xj > g.l3) { return; } if (g.lp && this.xj < 0) { return; } } let h; switch (this.w0.a2) { case 2: case 3: h = this.w0.j8(a, b.b2, b.b1, this.getEffectiveViewport1(b), this.wl(b)); break; default: h = this.w0.j8(a, b.b2, b.b1, this.getEffectiveViewport1(b), this.wl(b)); break; } if (h != null) { b.b5(h); } if (!b.r) { this.x2(a, this.d4()); } } he(a, b, c) { let d = true; d = super.he(a, b, c); if (!c.p() || b.isEmpty || a.isEmpty || this.w0 == null || this.w0.bi == null) { d = false; } return d; } st(a, b) { this.rs(false); } ss(a, b) { this.rs(false); } pb(a, b, c, d) { throw new NotImplementedException(0); } ra(a, b, c, d) { super.ra(a, b, c, d); switch (b) { case ValueOverlay.$$p[11]: if (c != null) { c.b0(this); } if (d != null) { d.ct(this); } this.rs(false); this.ql(); break; case "TransitionProgress": this.xi = this.xh + this.jq * (this.xe - this.xh); if (this.d6(this.cw)) { return; } if (this.jq == 1) { this.x1(this.xe, this.w3); this.qo(); } else { this.x1(this.xi, this.w3); } if (this.dc != null) { this.dc.qp(this); } break; case ValueOverlay.$$p[13]: let e = typeCast(NumericAxisBase.$, this.w0); if (e != null) { e.c1(); } this.rs(true); this.qm(); break; case ValueOverlay.$$p[12]: case ValueOverlay.$$p[10]: case ValueOverlay.$$p[1]: case ValueOverlay.$$p[0]: case ValueOverlay.$$p[3]: case ValueOverlay.$$p[4]: case ValueOverlay.$$p[9]: case ValueOverlay.$$p[5]: case ValueOverlay.$$p[6]: case ValueOverlay.$$p[7]: case ValueOverlay.$$p[8]: this.rs(true); break; } } qb() { super.qb(); if (this.w0 != null) { this.w0.ib(false); } } o5(a, b) { super.o5(a, b); let c = b; c.b4(); } w5() { if (this.w0 == null || this.w0.bi == null || isNaN_(this.xj) || this._visibility != 0) { return false; } let a = typeCast(CategoryAxisBase.$, this.w0); if (a != null && a.lk == 0) { return false; } return true; } preferredCategoryMode(a) { return 0; } get categoryAxis() { return typeCast(CategoryAxisBase.$, this.w0); } ct() { return new ValueOverlayView(this); } q1(a) { super.q1(a); this.w3 = typeCast(ValueOverlayView.$, a); } ru(a, b) { super.ru(a, b); if (!this.g0) { this.cw.a7(b); return; } this.cw.a7(b); if (this.d6(this.cv) || !this.w5()) { return; } let c = this.getEffectiveViewport1(this.cw); let d = this.w0.el(this.xj, new ScalerParams(0, this.cv.b2, a, this.w0.ch, c)); this.x1(d, typeCast(ValueOverlayView.$, this.cv)); this.g0 = false; } getOffsetValue() { return 0; } getCategoryWidth() { return 0; } get yk() { return new Thickness(1, this.xa, this.xc, this.xb, this.w9); } ai() { return [this.w0]; } x2(a, b) { if (isNaN_(a)) { if (this.w1 != null) { AxisAnnotationFrameManager.b(this.w1); AxisAnnotationFrameManager.d(this, this.w1, true, this.w6, this.w7, b, this.xk, this.xk, this.w2, this.w2); } return; } let c = false; if (this.w6 == null) { c = true; this.w7 = new List$1(Axis.$, 0); this.w6 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0); } this.w1 = new AxisAnnotationFrame(); let d = this.vb; if (d == null) { d = this.vh; } let e = this.w0.cp; AxisAnnotationFrameManager.c(this.w1, { $type: Point_$type, x: a, y: a }, this, this.dc, this.getEffectiveViewport(), d, this.yh, this.w8, this.yj, this.yi, this.yk, this.xd, this.yh, this.w8, this.yj, this.yi, this.yk, this.xd, !e && this.w4, e && this.w4); AxisAnnotationFrameManager.d(this, this.w1, c, this.w6, this.w7, b, this.xk, this.xk, this.w2, this.w2); } get_isValueOverlay() { return true; } xx(a) { if (this.w0 != null) { return this.w0.gf(a); } return null; } get xz() { let a = this.xx(this.xj); return a != null ? a : stringFormat("{0:0.##}", this.xj); } } ValueOverlay.$t = /*@__PURE__*/ markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]); ValueOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:w8:x3', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'AxisAnnotationBackground:yh:x4', [Brush.$, null], 'AxisAnnotationFormatLabel:w2:x5', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:xk:x6', [1, -1], 'AxisAnnotationOutline:yi:x7', [Brush.$, null], 'AxisAnnotationPaddingBottom:w9:x8', [1, NaN], 'AxisAnnotationPaddingLeft:xa:x9', [1, NaN], 'AxisAnnotationPaddingRight:xb:ya', [1, NaN], 'AxisAnnotationPaddingTop:xc:yb', [1, NaN], 'AxisAnnotationStrokeThickness:xd:yc', [1, NaN], 'AxisAnnotationTextColor:yj:yd', [Brush.$, null], 'Axis:w0:ye', [Axis.$, null], 'IsAxisAnnotationEnabled:w4:yf', [0, false], 'Value:xj:yg', [1, 0]]); return ValueOverlay; })(); /** * @hidden */ export let ValueOverlayView = /*@__PURE__*/ (() => { class ValueOverlayView extends SeriesView { constructor(a) { super(a); this.b6 = null; this.b6 = new Path(); } bh() { super.bh(); this.b6._stroke = this.f.vb; this.b6.ad = this.f.ie; this.b6.ai = this.f.v4; this.b6.aj = this.f.v5; } bi() { super.bi(); let a = this.bv(); this.b6._stroke = a; this.b6.ad = this.f.ie + 3; this.b6._stroke = a; this.b6.ad = this.f.ie + 3; } b5(a) { this.b6.an = a; this.av(); } b4() { this.b6.an = null; this.av(); } bc(a, b) { super.bc(a, b); if (a.d) { a.t(this.b6); } } aq(a) { super.aq(a); this.f.bc.exportPathData(a, this.b6, "ValueOverlayPath", []); } } ValueOverlayView.$t = /*@__PURE__*/ markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$); return ValueOverlayView; })();