@antv/f2
Version:
Charts for mobile visualization.
38 lines (37 loc) • 1.32 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _tslib = require("tslib");
var _fEngine = require("@antv/f-engine");
var _util = require("@antv/util");
var _default = exports.default = function _default(props) {
var _a = props.theme,
theme = _a === void 0 ? {} : _a;
var _b = (0, _util.deepMix)((0, _tslib.__assign)({}, theme.line), props),
coord = _b.coord,
points = _b.points,
style = _b.style,
animation = _b.animation;
var checkNaN = points.some(function (d) {
return isNaN(d.x) || isNaN(d.y);
});
if (checkNaN) return null;
var start = points[0] || {};
var end = points[1] || {};
var coordCenter = coord.center;
var radius = Math.sqrt((start.x - coordCenter.x) * (start.x - coordCenter.x) + (start.y - coordCenter.y) * (start.y - coordCenter.y));
var startAngle = Math.atan2(start.y - coordCenter.y, start.x - coordCenter.x);
var endAngle = Math.atan2(end.y - coordCenter.y, end.x - coordCenter.x);
return (0, _fEngine.jsx)("group", null, (0, _fEngine.jsx)("arc", {
style: (0, _tslib.__assign)({
cx: coordCenter.x,
cy: coordCenter.y,
r: radius,
startAngle: "".concat(startAngle, "rad"),
endAngle: "".concat(endAngle, "rad")
}, style),
animation: animation
}));
};
;