UNPKG

igniteui-react-charts

Version:

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

122 lines (121 loc) 4.39 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 { __extends } from "tslib"; 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 */ var RadialAxes = /** @class */ /*@__PURE__*/ (function (_super) { __extends(RadialAxes, _super); function RadialAxes(a, b) { var _this = _super.call(this) || this; _this.b = null; _this.a = null; _this.i = { $type: Point_$type, x: 0.5, y: 0.5 }; _this.b = a; _this.a = b; return _this; } RadialAxes.prototype.d = function (a, b, c, d, e) { var f = this.i.x + (b * Math.cos(a)); return ViewportUtils.e(f, c, d, e); }; RadialAxes.prototype.g = function (a, b, c, d, e, f, g) { var h = Math.min(b != null ? b.count : 0, c != null ? c.count : 0); var i = false; if (a.count == h) { i = true; } var j; var k; var l = this.i.x; var m = this.i.y; var n; var o; for (var p = 0; p < h; p++) { j = this.a.getScaledAngle(b.item(p)); k = this.b.tm(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 }); } } }; RadialAxes.prototype.h = function (a, b, c, d, e, f, g) { var h = ViewportUtils.b(a, c, d, e); var i = ViewportUtils.g(b, c, d, e); var j = Math.sqrt(Math.pow(h - this.i.x, 2) + Math.pow(i - this.i.y, 2)); var 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.to(j); return { p5: f, p6: g }; }; RadialAxes.prototype.e = function (a, b, c, d, e) { var f = this.i.y + (b * Math.sin(a)); return ViewportUtils.i(f, c, d, e); }; RadialAxes.prototype.c = function (a, b, c, d) { var e = { $type: Point_$type, x: ViewportUtils.e(this.i.x, b, c, d), y: ViewportUtils.i(this.i.y, b, c, d) }; var f = { $type: Point_$type, x: ViewportUtils.e(a.x, b, c, d), y: ViewportUtils.i(a.y, b, c, d) }; return GeometryUtil.g(e, f); }; RadialAxes.prototype.f = function (a, b, c, d, e, f) { var g = d.width / c.width; var h = ViewportUtils.f(g, b, c); var i = (h * this.b.tq) / 2; var 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.qb - 1; } else { var k = void 0, l = void 0; var m = GeometryUtil.p(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 = markType(RadialAxes, 'RadialAxes'); return RadialAxes; }(Base)); export { RadialAxes };