UNPKG

@antv/g2plot

Version:

G2 Plot, a market of plots built with the Grammar of Graphics'

35 lines 1.17 kB
import { getCoordinate } from '@antv/coord'; import VariableNodes from '../../../util/responsive/node/variable-node'; import Responsive from '../../../util/responsive/responsive'; export default function responsiveRing(layer) { var props = layer.options; var responsiveTheme = layer.getResponsiveTheme(); var padding = props.padding; var radius = props.radius ? props.radius : 1; var width = layer.width, height = layer.height; /** 创建坐标系 */ var polar = getCoordinate('polar'); var coord = new polar({ radius: radius, start: { x: padding[3], y: padding[0] }, end: { x: width - padding[1], y: height - padding[2] }, }); var region = { radius: radius, coord: coord, }; var nodes = new VariableNodes({ nodes: [{ name: 'innerRadius', value: 0 }], }); var constraints = responsiveTheme.ring.constraints; new Responsive({ nodes: nodes, constraints: constraints, region: region, plot: layer, onEnd: function () { props.innerRadius = nodes.nodes[0].value; }, }); } //# sourceMappingURL=geometry.js.map