UNPKG

victory-native

Version:

A charting library for React Native with a focus on performance and customization.

22 lines (21 loc) 802 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBarThickness = void 0; const getBarThickness = ({ axisStart, axisEnd, points, innerPadding, customBarThickness, barCount, }) => { if (customBarThickness !== undefined) return customBarThickness; const pointsLength = points.length > 0 && Array.isArray(points[0]) ? points[0].length : points.length; const axisLength = axisEnd - axisStart; const numerator = (1 - innerPadding) * axisLength; const denominator = barCount && barCount > 0 ? barCount : pointsLength - 1 <= 0 ? pointsLength : pointsLength - 1; if (denominator <= 0) return 0; return numerator / denominator; }; exports.getBarThickness = getBarThickness;