UNPKG

cl-react-graph

Version:
25 lines (19 loc) 618 B
import { IAxes } from './legacy/types'; export const gridHeight = (props: any): number => { const { height, margin, axis } = props; return height - (margin.top * 2) - xAxisHeight(axis); }; export const yAxisWidth = (axis: IAxes) => { return axis.y.label === '' ? axis.y.width : axis.y.width + 30; }; export const xAxisHeight = (axis: IAxes) => { return axis.x.label === '' ? axis.x.height : axis.x.height + 30 + (axis?.x?.margin ?? 0); }; export const gridWidth = (props: any): number => { const { axis, width, margin } = props; return width - (margin.left * 2) - yAxisWidth(axis); };