UNPKG

recharts

Version:
21 lines (17 loc) 719 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var RADIAN = Math.PI / 180; var polarToCartesian = exports.polarToCartesian = function polarToCartesian(cx, cy, radius, angle) { return { x: cx + Math.cos(-RADIAN * angle) * radius, y: cy + Math.sin(-RADIAN * angle) * radius }; }; var getMaxRadius = exports.getMaxRadius = function getMaxRadius(width, height, cx, cy) { var margin = arguments.length <= 4 || arguments[4] === undefined ? { top: 0, right: 0, bottom: 0, left: 0 } : arguments[4]; return Math.min(Math.abs(cx - margin.left || 0), Math.abs(width - cx - margin.right || 0), Math.abs(cy - margin.top || 0), Math.abs(height - cy - margin.bottom || 0)); };