UNPKG

igniteui-react-charts

Version:

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

120 lines (119 loc) 4.44 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 { Base, Point_$type, markType } from "igniteui-react-core"; import { ViewportUtils } from "./ViewportUtils"; import { GeometryUtil } from "igniteui-react-core"; import { truncate, isNaN_ } from "igniteui-react-core"; /** * @hidden */ export let RadialAxes = /*@__PURE__*/ (() => { class RadialAxes extends Base { constructor(a, b) { super(); this.b = null; this.a = null; this.i = { $type: Point_$type, x: 0.5, y: 0.5 }; this.b = a; this.a = b; } d(a, b, c, d, e) { let f = this.i.x + (b * Math.cos(a)); return ViewportUtils.e(f, c, d, e); } g(a, b, c, d, e, f, g) { let h = Math.min(b != null ? b.count : 0, c != null ? c.count : 0); let i = false; if (a.count == h) { i = true; } let j; let k; let l = this.i.x; let m = this.i.y; let n; let o; for (let p = 0; p < h; p++) { j = this.a.getScaledAngle(b.item(p)); k = this.b.sh(c.item(p)); n = l + (k * f(p, j)); o = m + (k * g(p, j)); n = e.left + e.width * (n - d.left) / d.width; o = e.top + e.height * (o - d.top) / d.height; if (!i) { a.add({ $type: Point_$type, x: n, y: o }); } else { a.item(p, { $type: Point_$type, x: n, y: o }); } } } h(a, b, c, d, e, f, g) { let h = ViewportUtils.b(a, c, d, e); let i = ViewportUtils.g(b, c, d, e); let j = Math.sqrt(Math.pow(h - this.i.x, 2) + Math.pow(i - this.i.y, 2)); let k = Math.acos((h - this.i.x) / j); if (j == 0 && isNaN_(k)) { k = 0; } if ((i - this.i.y) < 0) { k = (2 * Math.PI) - k; } f = this.a.getUnscaledAngle(k); g = this.b.sj(j); return { p5: f, p6: g }; } e(a, b, c, d, e) { let f = this.i.y + (b * Math.sin(a)); return ViewportUtils.i(f, c, d, e); } c(a, b, c, d) { let e = { $type: Point_$type, x: ViewportUtils.e(this.i.x, b, c, d), y: ViewportUtils.i(this.i.y, b, c, d) }; let f = { $type: Point_$type, x: ViewportUtils.e(a.x, b, c, d), y: ViewportUtils.i(a.y, b, c, d) }; return GeometryUtil.j(e, f); } f(a, b, c, d, e, f) { let g = d.width / c.width; let h = ViewportUtils.f(g, b, c); let i = (h * this.b.sl) / 2; let j = { $type: Point_$type, x: ViewportUtils.e(this.i.x, b, c, d), y: ViewportUtils.i(this.i.y, b, c, d) }; if (j.x < a.right && j.x > a.left && j.y < a.bottom && j.y > a.top) { e = 0; f = this.a.o6 - 1; } else { let k, l; let m = GeometryUtil.s(a, i, j, k, l); k = m.p3; l = m.p4; if (k == -1 || l == -1) { e = -1; f = -1; } else { k = this.a.getUnscaledAngle(k); l = this.a.getUnscaledAngle(l); if (this.a.categoryMode != 0) { k -= 0.5; l -= 0.5; } e = truncate(Math.round(k)); f = truncate(Math.round(l)); } } return { p4: e, p5: f }; } } RadialAxes.$t = /*@__PURE__*/ markType(RadialAxes, 'RadialAxes'); return RadialAxes; })();