@antv/f2
Version:
Charts for mobile visualization.
28 lines • 1.08 kB
JavaScript
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { jsx } from '../../../jsx';
import { deepMix } from '@antv/util';
export default (function (props) {
var _props$theme = props.theme,
theme = _props$theme === void 0 ? {} : _props$theme;
var _deepMix = deepMix(_objectSpread({}, theme.line), props),
coord = _deepMix.coord,
points = _deepMix.points,
style = _deepMix.style,
animation = _deepMix.animation;
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 jsx("group", null, jsx("arc", {
attrs: _objectSpread({
x: coordCenter.x,
y: coordCenter.y,
r: radius,
startAngle: startAngle,
endAngle: endAngle
}, style),
animation: animation
}));
});