UNPKG

@patternfly/react-charts

Version:

This library provides a set of React chart components for use with the PatternFly reference implementation.

25 lines (22 loc) 814 B
import { Helpers } from 'victory-core'; interface ChartPieOriginInterface { height: number; // Chart height padding: any; // Chart padding width: number; // Chart width } /** * Returns the origin for pie based charts. For example, something with a radius such as pie, donut, donut utilization, * and donut threshold. * * @private Not intended as public API and subject to change */ export const getPieOrigin = ({ height, padding, width }: ChartPieOriginInterface) => { const { top, bottom, left, right } = Helpers.getPadding(padding); const radius = Helpers.getRadius({ height, width, padding }); const offsetX = (width - radius * 2 - left - right) / 2; const offsetY = (height - radius * 2 - top - bottom) / 2; return { x: radius + left + offsetX, y: radius + top + offsetY }; };